Repository navigation
Use DCMTK for all CIELab/RGB color conversions. - #565
Open
michaelonken wants to merge 1 commit into
Open
michaelonken wants to merge 1 commit into
michaelonken wants to merge 1 commit into
Conversation
Update DCMTK to 4e89d4f, whose IODCIELabUtil now computes CIELab relative to the ICC PCS white point (D50) like PixelMed (see #563), and drop dcmqi's own ColorUtilities, which used D65. - Convert Recommended Display RGB/CIELab values via IODCIELabUtil - Derive the fallback CIELab value from the default RGB 128,174,128 - Encode background black as 0/32896/32896 (a*=b*=0), not 32768 - Round palette LUT entries instead of truncating them - Remove the Java reference implementation of the old conversion.
|
Member
|
@mhalle - fyi in case you want to check! |
Member
|
Related highdicom fix: ImagingDataCommons/highdicom#469 |
Member
|
Related dcmjs fix: dcmjs-org/dcmjs#598 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This changes the colors, not only the precision. DICOM stores the Recommended Display CIELab Value in the same way as the ICC Profile Connection Space, so the values are relative to the D50 illuminant. Both old implementations (dcmqi's ColorUtilities and DCMTK up to commit 88105877c from September 2026) computed CIELab relative to D65 instead. DCMTK now converts sRGB -> XYZ (D65)-> Bradford adaptation to D50 -> CIELab. It uses the matrices from the CSS Color Module Level 4 sample code (taken over from PixelMed code).
Effect on existing files: SEG objects written by older versions contain D65-based CIELab values. When this version reads them, the RGB values in the JSON metadata differ a little for colored segments. The largest change is for pure blue. Gray values do not change. Files written by this version are read back exactly (the 8-bit round trip is exact for all 16.7 million RGB values).
Other fixes included: results outside the sRGB range are now clamped (before, they wrapped around in unsigned), results are rounded instead of truncated, and the integer division bug in the old inverse f function (black was read back as 36,36,36) is gone together with the old code.
This PR updates DCMTK to 4e89d4f (including mentioned 88105877c), whose IODCIELabUtil now computes CIELab relative to the ICC PCS white point (D50) like PixelMed (see #563), and drop dcmqi's own ColorUtilities, which used D65.