Skip to content
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

Not all colors are displayed correctly in DICOM PR graphics #143

Closed
milkyway007 opened this issue Aug 3, 2020 · 6 comments
Closed

Not all colors are displayed correctly in DICOM PR graphics #143

milkyway007 opened this issue Aug 3, 2020 · 6 comments

Comments

@milkyway007
Copy link

Describe the bug
I am working on a piece of software that generates DICOM Color Softcopy Presentation State files. I am testing produced CSPS files using the Weasis viewer. Everything works fine. However, some colors are distorted. Green (0,128,0), blue (0,0,255), black (0,0,0) color is displayed correctly. Yellow (255,255,0) is changed to light green (~99,255,0), white (255,255,255) - to light blue (~99,255,255), red (255,0,0) - to dark red (~99,0,0), orange (255,165,0) - to light green (~99,165,0). As you can see, the problem is with the red channel. Its value is multiplied by approximately 0,38, regardless of concrete value (I have tested different values). I am not able to figure out problems with our software.

Desktop (please complete the following information):

  • OS: Windows 10
  • Java Rutime: OpenJDK Runtime Environment AdoptOpenJDK (build 14+36)
  • Weasis Version: 3.6.1

Screenshots
Original image
1

The result displayed with Weasis
2

@nroduit
Copy link
Owner

nroduit commented Aug 6, 2020

This explanation does not allow me to draw any conclusions.

If you are waiting for an answer, you should provide a more precise explanation about the DICOM attributes or an example file.

@milkyway007
Copy link
Author

I will attach a zip with
secondary capture image and color softcopy presentation state files.
DICOM_files.zip
Inform if you need more info.

@nroduit
Copy link
Owner

nroduit commented Aug 7, 2020

@milkyway007
Copy link
Author

Thank you very much for your answer.

Based on it I wrote an RGB to CIELab converter. The source code is attached to my answer. Firstly, this class converts an RGB value to a CIELab value. Then L, a, and b values are linearly scaled to 16 bits as the standard requires.

The results are as follows:

Color
Green
RGB: 0,128,0
CIELab: L: 46,228760110623; a: -51,6991318531787;b: 49,8975342624086
Scaled CIELab: 30296\19609\45720

Blue
RGB: 0,0,255
CIELab: L: 32,3025866672495; a: 79,1966617893093;b: -107,856977530782
Scaled CIELab: 21170\53250\5177

Black
RGB: 0,0,0
CIELab: L: 0; a: 0;b: 0
Scaled CIELab: 0\32896\32896

Yellow
RGB: 255,255,0
CIELab: L: 97,1382469812973; a: -21,5559083348323;b: 94,4824854464446
Scaled CIELab: 63660\27356\57178

White
RGB: 255,255,255
CIELab: L: 100; a: 0,00526049995830391;b: -0,00428585423328798
Scaled CIELab: 65535\32897\32895

Red
RGB: 255,0,0
CIELab: L: 53,2328817858425; a: 80,109309529822;b: 67,2200683102643
Scaled CIELab: 34886\53484\50172

Orange
RGB: 255,165,0
CIELab: L: 74,9322155874529; a: 23,9358747104639;b: 78,9565229112003
Scaled CIELab: 49107\39048\53188

Using this thing, for example, http://colorizer.org/ you can control that produced CIELab values are correct.

Produced DICOM images are located in the attached ZIP.

Weasis screenshot
image

So, Weasis shows something very different from the original image.

ToCieLabConverter.txt
DICOM_files.zip

It seems that Weasis expects more likely RGB values but not always reads them correctly.

@nroduit
Copy link
Owner

nroduit commented Aug 12, 2020

As this is the first time I see a DICOM PR using the PatternOnColorCielabValue field, I realize that the implementation was messy. The examples I had were using GraphicLayerRecommendedDisplayRGBValue.

I remade the implementation (in the last 2 commits) and now it displays properly.
image

@nroduit nroduit changed the title Not all colors are displayed correctly. Not all colors are displayed correctly in DCIOM PR graphics Aug 12, 2020
@nroduit nroduit changed the title Not all colors are displayed correctly in DCIOM PR graphics Not all colors are displayed correctly in DICOM PR graphics Aug 12, 2020
@milkyway007
Copy link
Author

Thank you for your cooperation!

@nroduit nroduit closed this as completed Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants