Just dipping my toes into the world of Angular 6. I'm currently grappling with integrating cornerstonejs into my Angular 6 project. However, all my efforts seem to hit a snag with this error message:
The dreaded error TS7016: Could not find a declaration file for module 'cornerstone-core/dist/cornerstone.js'
I did go ahead and install cornerstone-core using npm install cornerstone-core
.
If someone could lend a helping hand by pointing out why this code is being troublesome, that would be greatly appreciated.
component.ts
import { Component, ElementRef, ViewChild, OnInit, AfterViewInit } from '@angular/core';
import * as cornerstone from 'cornerstone-core/dist/cornerstone.js';
@Component({
selector: 'image-stack-viewer',
templateUrl: './image-stack-viewer.component.html',
styleUrls: ['./image-stack-viewer.component.css']
})
export class ImageStackViewerComponent implements OnInit, AfterViewInit {
@ViewChild('testpod') canvasDiv: ElementRef;
constructor() { }
ngOnInit() {
}
ngAfterViewInit() {
const imageId = ''//my-mage-url;
var element = this.canvasDiv;
cornerstone.enable(this.canvasDiv);
cornerstone.loadImage(imageId).then(function (image:any) {
cornerstone.displayImage(element, image);
});
}
}
Html
<div #testpod width="500" height="400"></div>