cornerstoneWADOImageLoader icon indicating copy to clipboard operation
cornerstoneWADOImageLoader copied to clipboard

"Function signature mismatch" loading JPEG2000 dicom

Open desprit opened this issue 4 years ago • 2 comments

https://rawgit.com/cornerstonejs/cornerstoneWADOImageLoader/master/examples/dicomfile/index.html

offset_out_of_bounds.dcm.gz

I'm able to parse that file with dicom-parser and also open it with desktop software like Weasis.

If I use older version of cornerstoneWADOImageLoader I get a different error:

offset is out of bounds

I tracked that error to the exact place where it is happening, it's in the function decodeOpenJPEG on this line:

var ret = openJPEG.ccall('jp2_decode', 'number', ['number', 'number', 'number', 'number', 'number', 'number', 'number'], [dataPtr, data.length, imagePtrPtr, imageSizePtr, imageSizeXPtr, imageSizeYPtr, imageSizeCompPtr]);

Fun fact. If I set a breakpoint at this line and try to print it in the console before it executes, it will throw the error:

var ret = openJPEG.ccall('jp2_decode', 'number', ['number', 'number', 'number', 'number', 'number', 'number', 'number'], [dataPtr, data.length, imagePtrPtr, imageSizePtr, imageSizeXPtr, imageSizeYPtr, imageSizeCompPtr]);
cornerstoneWADOImageLoader.js:3688 Uncaught RangeError: offset is out of bounds
    at Uint8Array.set (<anonymous>)
    at _emscripten_memcpy_big (cornerstoneWADOImageLoader.js:3688)
    at Ui (cornerstoneWADOImageLoader.js:3695)
    at Bi (cornerstoneWADOImageLoader.js:3695)
    at wb (cornerstoneWADOImageLoader.js:3693)
    at Rb (cornerstoneWADOImageLoader.js:3693)
    at cd (cornerstoneWADOImageLoader.js:3693)
    at zd (cornerstoneWADOImageLoader.js:3693)
    at md (cornerstoneWADOImageLoader.js:3693)
    at oc (cornerstoneWADOImageLoader.js:3693)

but then if I continue execution the image will partly load: 2021-09-27-175911_1831x1220_scrot

And here is this image loaded in Weasis: 2021-09-28-082255_1052x1073_scrot

desprit avatar Sep 28 '21 05:09 desprit

This issue is still there. Has there been any findings on this?

amrita-syn avatar Jan 09 '22 15:01 amrita-syn