Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get RGB values from palette entries?

461 views
Skip to first unread message

Andreas S

unread,
Mar 14, 2000, 3:00:00 AM3/14/00
to
Hallo,

perhaps somebody can help me: I am trying to display DICOM images of type
"Palette Color" with no compression of the pixel data.

What do I have? I have got the pixel data as 8bit values, indices for the
lookup tables I assume. The LookUp-Table Descriptor tells me that I have got
200 values in the table, starting with pixel value 0 and with values of 16
bit.

The Palette Color Lookup Table Data for each color contains then values from
0 to about 65000. So far so good.

How do I get then RGB values out of this huge table entries? How do I add
(or what else) three 16bit values to get one 25 bit value (=my RGB value)?


Here's a part of the dump of my DICOM object:

[...]
0028.0002 = Samples per Pixel : [1]
0028.0004 = Photometric Interpretation : [PALETTE COLOR]
0028.0006 = Planar Configuration : [1]
0028.0010 = Rows : [480]
0028.0011 = Columns : [640]
0028.0100 = Bits Allocated : [8]
0028.0101 = Bits Stored : [8]
0028.0102 = High Bit : [7]
0028.0103 = Pixel Representation : [0]
0028.0106 = SmallestImagePixelValue : [56]
0028.0107 = LargestImagePixelValue : [149]
0028.1101 = Red Palette Color Lookup Table Descriptor : [200, 0, 16]
0028.1102 = Green Palette Color Lookup Table Descriptor : [200, 0, 16]
0028.1103 = Blue Palette Color Lookup Table Descriptor : [200, 0, 16]
0028.1201 = Red Palette Color Lookup Table Data : [...]
0028.1202 = Green Palette Color Lookup Table Data : [...]
0028.1203 = Blue Palette Color Lookup Table Data : [...]
7fe0.0010 = Pixel Data : [byte array]

Thank you very much for any hint or help!

Andreas Schröter

Marco Eichelberg

unread,
Mar 14, 2000, 3:00:00 AM3/14/00
to

Andreas S wrote in message <8albvt$3tmab$1...@fu-berlin.de>...

>perhaps somebody can help me: I am trying to display DICOM images of type
>"Palette Color" with no compression of the pixel data.
>
>What do I have? I have got the pixel data as 8bit values, indices for the
>lookup tables I assume. The LookUp-Table Descriptor tells me that I have
got
>200 values in the table, starting with pixel value 0 and with values of 16
>bit.


First of all, your pixel data might or might not be an array of bytes.
If the VR of the pixel data is OB, you have an array of bytes
(for bits allocated = 8), of the VR is OW, you have an array of words
and two bytes in each word. The first pixel is in the low-order byte,
the next pixel in the high order byte; byte order depends on transfer
syntax and the local endianness of your machine.

>The Palette Color Lookup Table Data for each color contains then values
from
>0 to about 65000. So far so good.
>
>How do I get then RGB values out of this huge table entries? How do I add
>(or what else) three 16bit values to get one 25 bit value (=my RGB value)?


For each pixel value from the image pixel data,
you need to do separate lookups for the R, G and B component.
- if pixel value < first value mapped ==> map to first entry in palette data
- if pixel value > (first value mapped + number of entries -1) ==> map to
last entry
- otherwise map to entry number (pixel value - first value mapped).

You will end up with 3 16-bit values for R, G and B, and you need to
shift that appropriately to fit into your output color model,
e.g. take the high order byte of R, G and B and make a
24-bit RGB from that.

Best regards,
Marco Eichelberg
OFFIS


0 new messages