Skip to content

DICOM image fails to load (cornerstone-core) – first slice decoding error #643

Description

@LilachRayzin

Problem:
There are specific DICOM files that fail to load/display when attempting to render the first image. The UI crashes due to a missing width (CanvasRenderingContext2D error). Any subsequent images fail to load as a result of the first slice crashing. However, if I start from slice 2 (index 1), everything loads and displays correctly.

Console Logs:
[INFO] Start to read j2k main header (0). :1
[INFO] Main header has been correctly decoded. :1
[INFO] Header of tile 1 / 1 has been read. :1
[ERROR] Failed to decode. :1
[ERROR] Failed to decode tile 1/1 :1
[ERROR] opj_decompress: failed to decode tile!
DicomPreview | Id:
chunk-LKZCTPPH.js?v=0d87cce0:4072
Uncaught IndexSizeError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.
at webpack_exports.default (chunk-LKZCTPPH.js?v=0d87cce0:4072:50)
at getRenderCanvas (chunk-LKZCTPPH.js?v=0d87cce0:4225:89)
at renderGrayscaleImage (chunk-LKZCTPPH.js?v=0d87cce0:4271:30)
at webpack_exports.default (chunk-LKZCTPPH.js?v=0d87cce0:2836:15)
at draw (chunk-LKZCTPPH.js?v=0d87cce0:1531:91)

Code:
cornerstone
.loadAndCacheImage(ImgIds[0])
.then(image => {
cornerstoneTools.addTool(tool1);
cornerstoneTools.setToolActive('tool1', {});
cornerstone.displayImage(cornerstoneElement, image);
})
.catch(e => {
console.log('Error: Load image', e);
});

Version:
cornerstone-core: ^2.6.1

DICOM metadata example:
LossyImageCompression (0028,2110) 01
LossyImageCompressionRatio (0028,2112) 15.162
LossyImageCompressionMethod (0028,2114) ISO_15444_1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions