how to get RGB value from Palette color lookup tables ? - DICOM

This is a discussion on how to get RGB value from Palette color lookup tables ? - DICOM ; hi, i got image with dump: (0028,0000) UL 1368 # 4 Group Length (0028,0002) US 1 # 2 Samples per Pixel (0028,0004) CS [PALETTE COLOR] # 14 Photometric Interpretation (0028,0006) US 1 # 2 Planar Configuration (0028,0010) US 480 # ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: how to get RGB value from Palette color lookup tables ?

  1. how to get RGB value from Palette color lookup tables ?

    hi,

    i got image with dump:

    (0028,0000) UL 1368 # 4 Group Length
    (0028,0002) US 1 # 2 Samples per Pixel
    (0028,0004) CS [PALETTE COLOR] # 14 Photometric Interpretation
    (0028,0006) US 1 # 2 Planar Configuration
    (0028,0010) US 480 # 2 Rows
    (0028,0011) US 640 # 2 Columns
    (0028,0100) US 8 # 2 Bits Allocated
    (0028,0101) US 8 # 2 Bits Stored
    (0028,0102) US 7 # 2 High Bit
    (0028,0103) US 0 # 2 Pixel Representation
    (0028,1101) SS (no value available) # 6 Red Palette Color Lookup
    Table Descriptor
    (0028,1102) SS (no value available) # 6 Green Palette Color
    Lookup Table Descriptor
    (0028,1103) SS (no value available) # 6 Blue Palette Color Lookup
    Table Descriptor
    (0028,1201) OW Array bytes # 400 Red Palette Color
    Lookup Table Data
    (0028,1202) OW Array bytes # 400 Green Palette Color
    Lookup Table Data
    (0028,1203) OW Array bytes # 400 Blue Palette Color Lookup
    Table Data
    (7fe0,0000) UL 307208 4 Group Length
    (7fe0,0010) OW Array bytes # 307200 Pixel Data

    few first values of Red Palette Color Lookup Table Data are (as signed
    byte's):
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 32, 0, 68, 0, 106, 0, -114, 0, 0, 0, 36, 0, 73, 0, 109, 0, -110,
    0, -74, 0, -37, 0, -1, 0, 113, 0, -107, 0, -69, 0, -33, 0, -1, 0, -1,
    0, -1, 0, -1, 0, -29, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1... and so on...
    up to 400

    few first values of pixel data are:
    [96,96,97,97,99, (...) ]

    and now i have no idea how to get RGB value from that, I found

    http://groups.google.com/group/comp....b12fab644e631c

    but i don't know how to understand in my example words:
    " - 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)."

    what value i.e. 96 means ? is it and index into a lookup table ?

    thanks for any help
    best regards
    darod


  2. Re: how to get RGB value from Palette color lookup tables ?

    ok, i got it

    1. it looks like the transfer syntax for the LUT data is Big Endian (it
    contains 200 entries)
    2. each value in pixel data is an index into a LUT table
    3.to get RBG value for each pixel from LUT tables it should be done:
    (...)
    if (this.getPhotometricInt().equals("PALETTE COLOR")){
    int i = (int) realPixelValue[0]; //an index into LUT tables

    int r = this.getRedLUTTable()[i];
    int g = this.getGreenLUTTable()[i];
    int b = this.getBlueLUTTable()[i];

    retVal = ((b & 0xFF) << 16) | ((g & 0xFF) << 8) | (r & 0xFF); //RGB
    value
    (...)

    best regards
    darod


    darod wrote:
    > hi,
    >
    > i got image with dump:
    >
    > (0028,0000) UL 1368 # 4 Group Length
    > (0028,0002) US 1 # 2 Samples per Pixel
    > (0028,0004) CS [PALETTE COLOR] # 14 Photometric Interpretation
    > (0028,0006) US 1 # 2 Planar Configuration
    > (0028,0010) US 480 # 2 Rows
    > (0028,0011) US 640 # 2 Columns
    > (0028,0100) US 8 # 2 Bits Allocated
    > (0028,0101) US 8 # 2 Bits Stored
    > (0028,0102) US 7 # 2 High Bit
    > (0028,0103) US 0 # 2 Pixel Representation
    > (0028,1101) SS (no value available) # 6 Red Palette Color Lookup
    > Table Descriptor
    > (0028,1102) SS (no value available) # 6 Green Palette Color
    > Lookup Table Descriptor
    > (0028,1103) SS (no value available) # 6 Blue Palette Color Lookup
    > Table Descriptor
    > (0028,1201) OW Array bytes # 400 Red Palette Color
    > Lookup Table Data
    > (0028,1202) OW Array bytes # 400 Green Palette Color
    > Lookup Table Data
    > (0028,1203) OW Array bytes # 400 Blue Palette Color Lookup
    > Table Data
    > (7fe0,0000) UL 307208 4 Group Length
    > (7fe0,0010) OW Array bytes # 307200 Pixel Data
    >
    > few first values of Red Palette Color Lookup Table Data are (as signed
    > byte's):
    > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0,
    > 0, 0, 32, 0, 68, 0, 106, 0, -114, 0, 0, 0, 36, 0, 73, 0, 109, 0, -110,
    > 0, -74, 0, -37, 0, -1, 0, 113, 0, -107, 0, -69, 0, -33, 0, -1, 0, -1,
    > 0, -1, 0, -1, 0, -29, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1... and so on...
    > up to 400
    >
    > few first values of pixel data are:
    > [96,96,97,97,99, (...) ]
    >
    > and now i have no idea how to get RGB value from that, I found
    >
    > http://groups.google.com/group/comp....b12fab644e631c
    >
    > but i don't know how to understand in my example words:
    > " - 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)."
    >
    > what value i.e. 96 means ? is it and index into a lookup table ?
    >
    > thanks for any help
    > best regards
    > darod



+ Reply to Thread