cornerstonejs / cornerstoneWADOImageLoader

[DEPRECATED] DICOM WADO Image Loader for the cornerstone library
MIT License
280 stars 267 forks source link

fix: data type view after scaling #509

Closed Ouwen closed 1 year ago

Ouwen commented 1 year ago

@sedghi @swederik, I was going through to make sure CSWIL would automatically select the proper type for cs3d and think there might be a bug. I could very likely wrong though since afaik no such issue has been reported...

Essentially, cs3d will rely on the native decoded array type CSWIL provides. In the case the PixelData is PixelRepresentation === 0, it is usually a Uint16ArrayBuffer view for CT data. However, usually this data is preScaled within CSWIL and after scaling, a Uint16ArrayBuffer view should really be a Int16ArrayBuffer. However, it does not seem like this view is used in the setPixelDataType function.

It seems like PixelRepresentation also only refers to the stored pixel data tag, not post slope + intercept. (https://groups.google.com/g/comp.protocols.dicom/c/LQv-Vq8fQYA)

A Uint16 view can easily be recast to Int16 view downstream, which may be why no issues have popped up thus far?

Let me know if I'm missing anything here as I'm a bit confused how a Uint16 typed PixelData + rescale would provide back a proper imageFrame.pixelData without the changes below.

netlify[bot] commented 1 year ago

Deploy Preview for cornerstone-wado-image-loader ready!

Name Link
Latest commit 01b63dceb3f2fa8cac3114959a220daf5b67b440
Latest deploy log https://app.netlify.com/sites/cornerstone-wado-image-loader/deploys/63ddee619d9b400008409c9c
Deploy Preview https://deploy-preview-509--cornerstone-wado-image-loader.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

sedghi commented 1 year ago

:tada: This PR is included in version 4.9.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: