Repository navigation
fix(colors): convert DICOM CIELab relative to the D50 white point - #655
Merged
Merged
Conversation
1.0 port of #598 (commit 3843de7). src/colors.js and src/adapters/VTKjs/Segmentation.js on 1.0-beta were the same as on master before #598, so this takes the #598 versions of both files: sRGB -> XYZ (D65) -> Bradford -> XYZ (D50) -> CIELab and the reverse, per channel gamut clipping, and the new dicomlab2RGB8, rgb82DICOMLAB and d50WhitePointXYZ. The VTKjs adapter uses dicomlab2RGB8. The changelog entry is the same as on master. The 0.x test test/colors.test.js moves to test/issues/pr598-colors-d50.test.js. The test file changes of #598 for readFileAsArrayBuffer were a backport from 1.0-beta and are not needed here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Maintainer decision Q1 of the review of the 1.0 port of #598. The changelog.md entry stays as it is. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…CIELab conversion On the current 1.0-beta, the #598 colors code takes dcmjs.js to x1.0825 and dcmjs.es.js to x1.0649. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 24, 2026
wayfarer3130
marked this pull request as ready for review
November 24, 2026 20:28
|
🎉 This PR is included in version 1.0.0-beta.17 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Summary
This PR is the 1.0 port of #598 (commit
3843de7).Colorsconverts DICOM CIELab with the D50 white point, as PS3.3 C.10.7.1.1 requires. Before, the conversion used the D65 white point.Changes
src/colors.js: the conversion uses the D65 sRGB matrix and a Bradford adaptation from D65 to D50. New functions:dicomlab2RGB8andrgb82DICOMLAB. New constant:d50WhitePointXYZ. A color out of the sRGB gamut clips for each channel.src/adapters/VTKjs/Segmentation.js: uses the new conversion.1.0-beta, these two files were the same as onmasterbefore fix(colors): convert DICOM CIELab relative to the D50 white point #598. This PR takes the fix(colors): convert DICOM CIELab relative to the D50 white point #598 versions of both files with no change.changelog.md: the same entry as onmaster. The identical text prevents a conflict whenmastermerges into 1.0.beta-1-release-notes.md: one bullet. The colors of a SEG or SR object that an older dcmjs wrote can shift. For example, a saturated blue[0, 0, 255]now displays as[91, 0, 255].test/bundle-size.test.js: the ceilings increase to 1.083 (dcmjs.js) and 1.065 (dcmjs.es.js). The conversion adds about 3.5 KB.Review
An independent review compared the port with
master.src/colors.jsandSegmentation.jsare the same asmasterat3843de7. The build exports the onlyColorsclass fromsrc/index.js. No package inpackages/has a second copy. The review ran the conversion in Node: the results agree with the DCMTK and PixelMed reference values within 0.0005. No function name is removed, anddicomlab2RGBstill returns values from 0 to 1.Tests
The 0.x test moves to
test/issues/pr598-colors-d50.test.js.1.0-betawithout the fix, all 23 tests fail. For example:Colors.rgb82DICOMLAB is not a function.The API must do this:
The user experience must have this:
🤖 Generated with Claude Code