Viewers
Viewers copied to clipboard
OHIF Viewer Display Issues with DICOM Images: "decodeRGB: rgbBuffer length must be divisible by 3" and "RangeError: model.size is not a multiple of model.numberOfComponents"
Describe the Bug
Problem Description
I'm encountering display issues with certain DICOM images in the OHIF Viewer. While some images are displayed correctly, others fail to load, and specific errors are shown in the browser's developer console. The errors are:
-
Uncaught (in promise) Error: decodeRGB: rgbBuffer length must be divisible by 3
-
Uncaught (in promise) RangeError: model.size is not a multiple of model.numberOfComponents
DICOM Image Details
The problematic DICOM images have the following characteristics:
-
ImageType
:DERIVED\SECONDARY\OTHER\NONE
-
PhotometricInterpretation
:RGB
-
BitsAllocated
,BitsStored
,HighBit
: 8 bits -
PixelRepresentation
: 0 (unsigned) -
PixelData
sizes match the expected sizes based on the dimensions and bit configuration.
Local Loading Behavior
When loading these DICOM images locally in OHIF, a different behavior is observed, indicating a potential issue with how images are processed or handled in different loading contexts.
Additional Information
- Reviewing the
PixelData
withdcmdump
shows that the data size is consistent with the image dimensions and color depth. - The problem seems to be related to how OHIF handles or interprets the RGB data of the DICOM images.
Any guidance or solutions to resolve these display issues in OHIF would be greatly appreciated.
Steps to Reproduce
- Load the affected DICOM images into the OHIF Viewer.
- Observe that certain images do not display and check the console for the mentioned errors.
The current behavior
I'm encountering display issues with certain DICOM images in the OHIF Viewer. While some images are displayed correctly, others fail to load, and specific errors are shown in the browser's developer console. The errors are:
-
Uncaught (in promise) Error: decodeRGB: rgbBuffer length must be divisible by 3
-
Uncaught (in promise) RangeError: model.size is not a multiple of model.numberOfComponents
The expected behavior
All DICOM images should be displayed correctly in the OHIF viewer without errors in the console.
OS
Windows 10
Node version
OHIF Viewer (3.8.0-beta.45)
Browser
Firefox Dev 122.0b
I encountered similar issue after updating kitware/vtk.js version to "29.3.0" from "27.3.1"
DataArray.js:518 Uncaught (in promise) RangeError: model.size is not a multiple of model.numberOfComponents
at f (DataArray.js:518:11)
at Object.n [as newInstance] (macros2.js:917:5)
at ig.createVTKImageData (StackViewport.ts:1603:25)
at ig._createVTKImageData (StackViewport.ts:1634:28)
at ig._updateActorToDisplayImageId (StackViewport.ts:2284:10)
at ig.renderImageObject (StackViewport.ts:2104:14)
at renderToCanvasGPU.ts:136:14
at new Promise (
Just to add, this issue started on version "@kitware/vtk.js": "29.1.2".
There is a bit of conversation about this change here https://github.com/Kitware/vtk-js/commit/3cc3abb871cabb79831d26bb268990549ef6ca59
This is affecting us with CT SENTINEL NODE SCANs from Siemens machines
I dragged and dropped them in https://viewer-dev.ohif.org/localbasic and worked fine
Hi! I'm getting this error for a particular dicom file, and not in others. Is there any solution for this yet?
Hi how to replace with DCOM images
@sedghi regarding your above comment, what version of ohif is being used on that demo?
Hi! I'm getting this error for a particular dicom file, and not in others. Is there any solution for this yet?
Bug disappears using the latest version of OHIF.