Skip to content
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

8-bit colored images are not displayed properly #338

Closed
Zaid-Safadi opened this issue Dec 20, 2022 · 5 comments
Closed

8-bit colored images are not displayed properly #338

Zaid-Safadi opened this issue Dec 20, 2022 · 5 comments

Comments

@Zaid-Safadi
Copy link
Contributor

When using wado-uri or file system to load an ultrasound 8-bit image with with "Photometric Interpretation (0028,0004)" "RGB" and "Samples Per Pixel (0028,0002)" "3" the image rendering is corrupted.

There are different rendering results using CPU or WebGL, You can try this in the Examples:

  1. DICOM P10 from local file system (CPU): image is completely corrupted
  2. DICOM P10 from local file system: Image is rendered correctly but the W/L values are off. Compare this when applying the same WW/WC on other DICOM viewer (desktop or OHIF WADO-RS)

CPU Example Result:
image

WebGL Example Result:
image

Desktop Viewer (notice the non-organ part is black):
image

@Zaid-Safadi
Copy link
Contributor Author

This is an anonymized dataset that reproduces the issue: https://1drv.ms/u/s!AluyBah_ueAcg8EHRae6kDbLtkR5sA?e=c3kRnR

I checked the cornerstone3d example and it configures cornerstoneWADOImageLoader as recommended in this issue cornerstonejs/cornerstoneWADOImageLoader#498:

cornerstoneWADOImageLoader.configure({
  useWebWorkers: true,
  decodeConfig: {
    convertFloatPixelDataToInt: false,
  },
});

@Zaid-Safadi
Copy link
Contributor Author

Zaid-Safadi commented Dec 25, 2022

I was able to track down the corrupted display in:

DICOM P10 from local file system (CPU): image is completely corrupted

to the StackViewport useRGBA flag here:
https://github.com/cornerstonejs/cornerstone3D-beta/blob/5605a39b17749f4f1d0bf6f3ee6f5ee9be492be8/packages/core/src/RenderingEngine/StackViewport.ts#L1520

Once I set the useRGBA to true, the image is rendered to match the way it is rendered in point 2:

DICOM P10 from local file system: Image is rendered correctly but the W/L values are off

@sedghi any idea what could be the problem with RGB <--> RGBA?

The invalid W/L seems to be carried over from old cornerstone as I can reproduce it there.

@sedghi
Copy link
Member

sedghi commented Jan 3, 2023

As I see the desktop and webgl path matches each other, no? I don't understand Desktop Viewer (notice the non-organ part is black):

So you are saying the failed CPU path is corrected if useRGBA is true right? I guess that is a bug and it should use flag as true (which I thought it is true by default), since CPU webgl uses the A (in rgbA) to render greyscale so it need the useRGBA

@Zaid-Safadi
Copy link
Contributor Author

@sedghi , I can create a PR and flip the flag to true if there are no known side effects of doing so. If there is a test suite we can run to verify that would be good too

I need to take better screenshots and show better example for the off W/L between the desktop and cornerstone , I'll create a separate issue for it and we'll focus in this issue on the rgba problem

@sedghi
Copy link
Member

sedghi commented Jan 4, 2023

I'm 99.99% sure that was a mistake by me adding useRGBA to false for CPU route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants