0

I am making a dicom viewer by myself.

Changing the color of the dicom image was successful, but it's a solid color.

So, to solve the monochromatic part, I brought the dicom palette. https://dicom.nema.org/dicom/2013/output/chtml/part06/chapter_B.html

But it goes in a weird way and not the way I thought it would.

After much deliberation, I found out that there is a palette among the properties of the bitmap. But it doesn't work at all. As a result of searching, many answers may not work, and it is recommended to directly touch the pixel data. And the length of my palette is always zero.

Oncolor Red version

enter image description here

dicom HeartIronSetVersion

enter image description here

final target

enter image description here

 for (int i = 0; i < bitmap2.Width; i++)
                {
                    for (int j = 0; j < bitmap2.Height; j++)
                    {
                        actualColor = bitmap2.GetPixel(i, j);

                        int a = actualColor.A;
                        int r = actualColor.R;


                        Color col = palette[r];
                        //IronHeartsetWith Alpha
                        //redBitmap.SetPixel(i, j, Color.FromArgb(a, palette[r]));
                        //IronHeartSet
                        //redBitmap.SetPixel(i, j, col);
                        //RedVer
                        redBitmap.SetPixel(i, j, Color.FromArgb(a, r, 0, 0));

                        //redBitmap.SetPixel(i, j, Color.FromArgb((int)r, 1, 0, 0));

                    }


                }
               
로다현
  • 125
  • 1
  • 12
  • From the skeleton image it seems they are using the `L value`(illumination), maybe you can try converting the rgb to gray using `L = 0.299 * R + 0.587 * G + 0.114 * B` and then apply mapping? – Operator77 Dec 20 '21 at 10:40
  • 1
    What is the actual goal? Use the built in palettes in the bitmap class? Apply an existing palette to a color image? Create the palette in the first place? – JonasH Dec 20 '21 at 11:05
  • @JonasH I have already made the palette. After I change the color of this image I'm going to fusion this image. I can't figure out how to use this palette to express the picture I was thinking of. – 로다현 Dec 21 '21 at 00:41

1 Answers1

1

I thought there was a special code for applying the palette in the diom, but it wasn't.

The problem was caused by an error in the pixels in the palette part in my code.

Thanks to everyone who replied.

(The value after the 230th in the palette was 0...)

result

enter image description here

로다현
  • 125
  • 1
  • 12