cornerstonejs / cornerstone3D

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
https://cornerstonejs.org
MIT License
528 stars 271 forks source link

[Bug] After using compression, DICOM files rendereed as brighter #1373

Open abhijeet-qure opened 2 months ago

abhijeet-qure commented 2 months ago

Describe the Bug

As discussed during the office hours on July 4th, I am raising this issue for further investigation. Here is the background information regarding the issue. Please take a look at the anonymized DICOM file, which includes both the original and compressed versions.

We have converted the DICOM file to the compression format/transfer syntax using dmctk to "1.2.840.10008.1.2.4.51", which is the "JPEG Baseline (Processes 2 & 4): Default Transfer Syntax for Lossy JPEG 12-bit Image Compression (Process 4 only)." However, when the image is loaded onto the CS3D viewport, it appears much brighter, as if the window level has been changed. Upon checking the metadata, there are no indications of such changes. Further investigation revealed that the image has different RescaleSlope and RescaleIntercept metadata values. Interestingly, the image appears normal when viewed on the Weasis viewer. Also, i am using the WadoURI loader to load images from the locally hosted server via HTTP

Here are the different images viewed on OHIF and Weasis viewer

CleanShot 2024-07-04 at 19 29 52@2x

CleanShot 2024-07-04 at 19 29 18@2x

Attaching originals and compressed zip compressed.zip original.zip

Steps to Reproduce

I used dcmtk tool to compress the DICOM with the following command

dcmcjpeg +ee +q 100 +sm 100 <input-file> <output-file>

Loaded image onto OHIF and Weassis to re-produce the issue

The current behavior

Image is appearing to be brighter as mentioned in above screenshot

The expected behavior

Image to be not bright and should look like viewed in Weasis in screenshot earlier

OS

macOS

Node version

None

Browser

Safari 17.5, Chrome Version 126.0.6478.127 (Official Build) (arm64)

abhijeet-qure commented 2 months ago

@sedghi FYI

abhijeet-qure commented 1 month ago

@sedghi, can you help here? Or can you guide me to look into this issue further? Thank you.