Skip to content

Conversation

@diricxbart
Copy link
Contributor

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 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.
diricxbart pushed a commit to diricxbart/dicom-microscopy-viewer that referenced this pull request Jun 22, 2025
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)
@diricxbart
Copy link
Contributor Author

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
@diricxbart
Copy link
Contributor Author

Just wandering if the macos version shouldn't also use sudo make install like the Linux version, now it's not using sudo...

@diricxbart
Copy link
Contributor Author

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.
@fedorov could you please have a look at this?

@diricxbart
Copy link
Contributor Author

Hi @fedorov,
My latest change fixed the pre-existing build failure, I assume this PR is now ready to merge?

ColorManager(FrameInfo frameInfo,
const val &iccProfile) {
const val &iccProfile,
int outputType = 0 /* 0: sRGB (default), 1: Display-P3 */) {
Copy link
Member

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?

@fedorov
Copy link
Member

fedorov commented Aug 5, 2025

@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?

@dclunie
Copy link

dclunie commented Aug 5, 2025

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
@diricxbart
Copy link
Contributor Author

diricxbart commented Aug 7, 2025

@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 (wtpt, chad, rXYZ, gXYZ, bXYZ, rTRC, gTRC and bTRC). I can conclude that for Display-P3, Adobe RGB (1998) and ROMM RGB there's a perfect match...

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.

@diricxbart
Copy link
Contributor Author

Hi @fedorov , anything else I can help with to get this change approved?

@fedorov
Copy link
Member

fedorov commented Sep 4, 2025

I am sorry!

@dclunie do you have any other requests?

@fedorov fedorov requested a review from Copilot September 4, 2025 20:43
Copy link
Contributor

Copilot AI left a 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 DcmIccOutputType with four color profile options: sRGB, Display-P3, Adobe RGB, and ROMM RGB
  • Adds a new function dcm_icc_transform_create_for_output that 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.

@fedorov
Copy link
Member

fedorov commented Sep 4, 2025

@diricxbart mac build is failing!

@diricxbart diricxbart changed the title Add suport for multiple Output ICC profile types Add support for multiple Output ICC profile types Sep 4, 2025
@diricxbart
Copy link
Contributor Author

@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)

@fedorov fedorov merged commit 7c8f993 into ImagingDataCommons:master Sep 5, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants