-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dicom-image-loader): add rgba condition interception for canvas createImageData API #1043
fix(dicom-image-loader): add rgba condition interception for canvas createImageData API #1043
Conversation
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I have the same problem. Would be nice if it will be merged and fix in my project too. Because now I have to using hack with replacing pixelData and updating actors for viewports. |
Can you describe the image that needs to be tested? |
I can't provide a sample image because it is a corporate policy not to provide them, but I confirm that there is a problem after vtk added that check and fixes like this (see also #1002) solve it |
A dicom file with rgb color series image would do |
I think that this is root cause about |
@Blackman99 Hey man,i suggest changing |
Thanks! Change has been updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay in my review. I have been (and still am) occupied with other tasks. However, I appreciate the fix you provided.
Context
The canvas context API

createImageData
would always return aImageData
. And itsdata
field is always a rgba color modeUint8ClampedArray
, like this:In the newest vtk package which has already been upragded in cornserstone repo would throw a error like this:

As a result, the image would not render.
This PR fix it.
Changes & Results
Add a condition, if not using rgba, then replace the data with a new Uint8ClampedArray with
imageFrame.samplesPerPixel * columns * rows
lengthTesting
I've tested on my private project. I'm sorry I can't share it with others because the image
belongs to company.
Sorr for the inconvenience.
Checklist
PR
semantic-release format and guidelines.
Code
My code has been well-documented (function documentation, inline comments,
etc.)
I have run the
yarn build:update-api
to update the API documentation, and havecommitted the changes to this PR. (Read more here https://www.cornerstonejs.org/docs/contribute/update-api)
Public Documentation Updates
additions or removals.
Tested Environment