cornerstonejs / cornerstone

[Deprecated] Use Cornerstone3D Instead https://cornerstonejs.org/
MIT License
2.07k stars 598 forks source link

Cannot read property 'displayedArea' of undefined #395

Open paul-asvb opened 5 years ago

paul-asvb commented 5 years ago

Error appears when on calling of:

 cornerstone.setLayerImage(element, image, currentLayerId);

I call the function inside the fusionRenderer of the example of cornerstoneTools.

The old example worked with dcm images and a custom MetaProvider here: old example

@dannyrb mentioned here scTools issue that the API did not change, so i assume its a problem with the layer API

The imageObject can come from the Cornerstone Web Image Loader and looks fine to me:

color: true
columnPixelSpacing: undefined
columns: 256
getCanvas: ƒ ()
getImage: ƒ ()
getPixelData: ƒ ()
height: 256
imageId: "http://localhost:8080/000001.png"
intercept: 0
invert: false
maxPixelValue: 255
minPixelValue: 0
render: ƒ renderWebImage(enabledElement, invalidated)
rgba: false
rowPixelSpacing: undefined
rows: 256
sizeInBytes: 262144
slope: 1
width: 256
windowCenter: 128
windowWidth: 255

or from the Wado Loader:

cachedLut: {lutArray: Uint8ClampedArray(2179), windowWidth: 360, windowCenter: 36, invert: false, voiLUT: undefined, …}
color: false
columnPixelSpacing: 1
columns: 512
data: e {byteArrayParser: {…}, byteArray: Uint8Array(527164), elements: {…}, warnings: Array(0)}
decodeTimeInMS: 0
floatPixelData: undefined
getPixelData: ƒ ()
height: 512
imageId: "wadouri:http://localhost:4000/assets/dicom/bellona/chest_lung/34.dcm"
intercept: -1024
invert: false
loadTimeInMS: 6
maxPixelValue: 2178
minPixelValue: 0
rowPixelSpacing: 1
rows: 512
sharedCacheKey: "http://localhost:4000/assets/dicom/bellona/chest_lung/34.dcm"
sizeInBytes: 262144
slope: 1
stats: {lastGetPixelDataTime: 0, lastStoredPixelDataToCanvasImageDataTime: 0.4000000008090865, lastPutImageDataTime: 0.23499999952036887, lastRenderTime: 1.0849999998754356, lastLutGenerateTime: 0}
totalTimeInMS: 23
width: 512
windowCenter: 36
windowWidth: 360
paul-asvb commented 5 years ago

Just found that the viewport of the layer is undefined.

dannyrb commented 5 years ago

@ASVBPREAUBV can you provide a reproduction on CodePen or CodeSandbox so we can more easily reproduce and assist?