-
Notifications
You must be signed in to change notification settings - Fork 2
Add support for multiple Output ICC profile types #6
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
Add support for multiple Output ICC profile types #6
Conversation
The default Output ICC profile is still "sRGB" (backwards compatibility). Additionally, a second wide-gamut Output ICC profile "Display-P3" has been added. This profile uses a D65 white point, a sRGB transfer function, the DCI-P3 primaries and is widely supported by modern browsers.
The original implementation assumes the display used to view the WSI images is using the sRGB color space. Now we first check if the display color space is sRGB or Display-P3 (a more recent wide-gamut color space). Based on this dicomicc is configured to either transform colors to the sRGB color space or to the Display-P3 color space. Prerequisite: approval of Pull Request to add support for Display-P3 in libdicomicc (ImagingDataCommons/libdicomicc#6)
|
I'm not sure if this failing macOS build and test has something to do with my changes, or if in general this test is broken? |
install to a system dir does not work on mac
|
Just wandering if the macos version shouldn't also use |
|
I added a change which 'might' fix the build issue on macos (which is unrelated to the other functional changes in this PR), however, a maintainer needs to approve running the github action to see if this resolves the issue. |
|
Hi @fedorov, |
wasm/src/ColorManager.hpp
Outdated
| ColorManager(FrameInfo frameInfo, | ||
| const val &iccProfile) { | ||
| const val &iccProfile, | ||
| int outputType = 0 /* 0: sRGB (default), 1: Display-P3 */) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the enum constants here instead of 0 and 1?
|
@diricxbart I appreciate your contribution, but I have to say I am not sure how to proceed. The developer of this library who had expertise in the subject moved on, and I am not sure who can review this PR appropriately. I do not have the needed expertise I am afraid. @dclunie do you think you could take a look at the new profile added? @igoroctaviano how can we test and confirm this does not cause a regression in slim? |
|
FYI, the addition of this new color space is not (quite) yet standardized in DICOM - see CP 2474, which @diricxbart initiated and is currently out for letter ballot. I would suggest that ADOBERGB and ROMMRGB also be included as alternatives, not just DISPLAYP3, and I too prefer meaningful string-named enums rather than opaque numeric values. I haven't looked at the code so I can't comment on how this new parameter is being used (fed to the color management system to actually command that the color conversion from PCS to the defined color space be performed). |
… + Add support for Adobe RGB (1998) and ROMM RGB
|
@fedorov My latest commit should handle your feedback on using the enum constant. @dclunie My latest commit now also additionally adds support for Adobe RGB (1998) and ROMM RGB. @fedorov To validate the new functionality, I took the following approach. The main thing this PR adds is a selectable output ICC profile, instead of a fixed sRGB profile. The key thing to validate here is, I think, the correctness of the 3 new ICC profiles which are created. The approach I took here was twofold: (1) read the spec for each of these colour spaces (see links I added as documentation in the code) and (2) compare against existing ICC profiles in this repository. I each time used the v4 ICC profiles, using the parametric curve approach: DisplayP3-v4.icc, ProPhoto-v4.icc (which is an alias for ROMM RGB) and AdobeCompat-v4.icc. Next I used the ICC Profile Inspector and compared the different tags ( Please find here some additional background info on why the type 4 parametric curve was selected instead of the original type 5 (see this commit), assuring black and white remain unchanged by the transfer curve. |
… white remain unchanged by the transfer function. See saucecontrol/Compact-ICC-Profiles#22 (comment) for more info
|
Hi @fedorov , anything else I can help with to get this change approved? |
|
I am sorry! @dclunie do you have any other requests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for multiple output ICC profile types to extend the color management capabilities beyond the default sRGB. The default behavior remains unchanged for backward compatibility.
- Introduces an enum
DcmIccOutputTypewith four color profile options: sRGB, Display-P3, Adobe RGB, and ROMM RGB - Adds a new function
dcm_icc_transform_create_for_outputthat accepts an output type parameter - Updates the ColorManager constructor to accept an optional output type parameter with sRGB as default
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| wasm/src/jslib.cpp | Exposes the new DcmIccOutputType enum to JavaScript and updates ColorManager constructor to accept output type parameter |
| wasm/src/ColorManager.hpp | Modifies constructor to accept optional output type parameter and uses new create function |
| src/dicomicc.h | Defines DcmIccOutputType enum and declares new create function with output type support |
| src/dicomicc.c | Implements profile creation functions for each color space and adds backward-compatible wrapper |
| package.json | Bumps version from 0.1.0 to 0.2.0 |
| CMakeLists.txt | Updates minor version number from 1 to 2 |
| .github/workflows/run_unit_tests.yml | Updates cmake configuration with install prefix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@diricxbart mac build is failing! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@fedorov I processed the copilot review remarks and implemented an attempt to fix the failing macos build as I think it indicates that cmake is already installed in that image and doesn't have to be installed again (not 100% sure though) |
The default Output ICC profile is still "sRGB" (backwards compatibility).
Additionally, a second wide-gamut Output ICC profile "Display-P3" has been added.
This profile uses a D65 white point, a sRGB transfer function, the DCI-P3 primaries and is widely supported by modern browsers.