DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Protected Member Functions | Private Attributes | List of all members
DiLookupTable Class Reference

Class to handle color palette look-up tables. More...

Inheritance diagram for DiLookupTable:

## Public Member Functions
| DiLookupTable (const DiDocument *docu, const DcmTagKey &descriptor, const DcmTagKey &data, const DcmTagKey &explanation, const EL_BitsPerTableEntry descripMode=ELM_UseValue, EI_Status *status=NULL)
| constructor More...
| DiLookupTable (const DiDocument *docu, const DcmTagKey &sequence, const DcmTagKey &descriptor, const DcmTagKey &data, const DcmTagKey &explanation, const EL_BitsPerTableEntry descripMode=ELM_UseValue, const unsigned long pos=0, unsigned long *card=NULL)
| constructor More...
| DiLookupTable (const DcmUnsignedShort &data, const DcmUnsignedShort &descriptor, const DcmLongString *explanation=NULL, const EL_BitsPerTableEntry descripMode=ELM_UseValue, const signed long first=-1, EI_Status *status=NULL)
| constructor More...
| DiLookupTable (const DcmOtherByteOtherWord &data, const DcmUnsignedShort &descriptor, const DcmLongString *explanation=NULL, const EL_BitsPerTableEntry descripMode=ELM_UseValue, const signed long first=-1, EI_Status *status=NULL)
| constructor More...
| DiLookupTable (Uint16 *buffer, const Uint32 count, const Uint16 bits)
| constructor More...
virtual | ~DiLookupTable ()
| destructor
int | invertTable (const int flag=0x1)
| invert all LUT values. More...
int | mirrorTable (const int flag=0x1)
| mirror the order of all LUT entries. More...
DiLookupTable * | createInverseLUT () const
| create an inverse copy of the current LUT. More...
int | compareLUT (const DcmUnsignedShort &data, const DcmUnsignedShort &descriptor)
| compares current LUT with specified LUT More...
int | compareLUT (const DcmOtherByteOtherWord &data, const DcmUnsignedShort &descriptor)
| compares current LUT with specified LUT More...
virtual OFBool | operator== (const DiBaseLUT &lut)
| compares current LUT with specified LUT More...
virtual OFBool | operator== (const DiLookupTable &lut)
| compares current LUT with specified LUT More...
Public Member Functions inherited from DiBaseLUT
| DiBaseLUT (const Uint32 count=0, const Uint16 bits=0)
| constructor More...
virtual | ~DiBaseLUT ()
| destructor
Uint32 | getCount () const
| get number of LUT entries More...
Uint16 | getBits () const
| get number of bits per entry More...
Uint32 | getFirstEntry (const Uint32=0) const
| get index of first LUT entry. More...
Sint32 | getFirstEntry (const Sint32) const
| get index of first LUT entry. More...
Uint32 | getLastEntry (const Uint32=0) const
| get index of last LUT entry. More...
Sint32 | getLastEntry (const Sint32) const
| get index of last LUT entry. More...
Uint16 | getValue (const Uint16 pos) const
| get value of specified LUT entry More...
Uint16 | getValue (const Uint32 pos) const
| get value of specified LUT entry. More...
Uint16 | getValue (const Sint32 pos) const
| get value of specified LUT entry. More...
Uint16 | getFirstValue () const
| get value of first LUT entry. More...
Uint16 | getLastValue () const
| get value of last LUT entry. More...
const Uint16 * | getData () const
| get pointer to LUT data More...
Uint16 | getMinValue () const
| get minimum value of the LUT. More...
Uint16 | getMaxValue () const
| get maximum value of the LUT. More...
Uint32 | getAbsMaxRange () const
| get absolute value range of the LUT entries. More...
int | isValid () const
| check whether LUT is valid More...
const char * | getExplanation () const
| get LUT explanation string More...
Public Member Functions inherited from DiObjectCounter
void | addReference ()
| add a reference. More...
void | removeReference ()
| remove a reference. More...

## Protected Member Functions
void | Init (const DiDocument *docu, DcmItem *item, const DcmTagKey &descriptor, const DcmTagKey &data, const DcmTagKey &explanation, const EL_BitsPerTableEntry descripMode=ELM_UseValue, EI_Status *status=NULL)
| initialize lookup table More...
void | Init (const Uint16 *data, const unsigned long count, const DcmUnsignedShort &descriptor, const DcmLongString *explanation=NULL, const EL_BitsPerTableEntry descripMode=ELM_UseValue, const signed long first=-1, EI_Status *status=NULL)
| initialize lookup table More...
void | checkTable (unsigned long count, Uint16 bits, const EL_BitsPerTableEntry descripMode=ELM_UseValue, EI_Status *status=NULL)
| check (and possibly correct) lookup table for consistency More...
void | checkBits (const Uint16 bits, const Uint16 rightBits, const Uint16 wrongBits=0, const EL_BitsPerTableEntry descripMode=ELM_UseValue)
| check (and possibly correct) value for bits per LUT entry. More...
Protected Member Functions inherited from DiBaseLUT
| DiBaseLUT (Uint16 *buffer, const Uint32 count=0, const Uint16 bits=0)
| constructor More...
int | compare (const DiBaseLUT *lut)
| compares current LUT with specified LUT More...
Protected Member Functions inherited from DiObjectCounter
| DiObjectCounter ()
| constructor. More...
virtual | ~DiObjectCounter ()
| destructor

## Private Attributes
int | OriginalBitsAllocated
| number of bits originally allocated for a LUT entry
void * | OriginalData
| pointer to original data buffer (where the LUT data is created from)

## Additional Inherited Members
Protected Attributes inherited from DiBaseLUT
Uint32 | Count
| number of LUT entries
Uint16 | FirstEntry
| first input value mapped (FIV)
Uint16 | Bits
| number of bits per entry
Uint16 | MinValue
| minimum LUT value
Uint16 | MaxValue
| maximum LUT value
int | Valid
| status code, indicating whether LUT is valid
OFString | Explanation
| LUT explanation string.
const Uint16 * | Data
| pointer to lookup table data
Uint16 * | DataBuffer
| pointer to data buffer (will be deleted in the destructor)

## Detailed Description

Class to handle color palette look-up tables.

## Constructor & Destructor Documentation

## ◆ DiLookupTable() [1/5]

DiLookupTable::DiLookupTable | ( | const DiDocument * | docu,
|  | const DcmTagKey & | descriptor,
|  | const DcmTagKey & | data,
|  | const DcmTagKey & | explanation,
|  | const EL_BitsPerTableEntry | descripMode = `ELM_UseValue`,
|  | EI_Status * | status = `NULL`
| ) |  |

constructor

Parameters

  docu | pointer to dataset (encapsulated)
  descriptor | tag key containing the LUT descriptor
  data | tag key containing the LUT data
  explanation | tag key containing the LUT explanation
  descripMode | mode specifying the use of the bits per table entry value
  status | pointer to image status variable (optional)

## ◆ DiLookupTable() [2/5]

DiLookupTable::DiLookupTable | ( | const DiDocument * | docu,
|  | const DcmTagKey & | sequence,
|  | const DcmTagKey & | descriptor,
|  | const DcmTagKey & | data,
|  | const DcmTagKey & | explanation,
|  | const EL_BitsPerTableEntry | descripMode = `ELM_UseValue`,
|  | const unsigned long | pos = `0`,
|  | unsigned long * | card = `NULL`
| ) |  |

constructor

Parameters

  docu | pointer to dataset (encapsulated)
  sequence | tag key containing the LUT sequence
  descriptor | tag key containing the LUT descriptor
  data | tag key containing the LUT data
  explanation | tag key containing the LUT explanation
  descripMode | mode specifying the use of the bits per table entry value
  pos | position in the LUT sequence which should be used (optional)
  card | pointer to storage area where the number of sequence entries should be stored (optional)

## ◆ DiLookupTable() [3/5]

DiLookupTable::DiLookupTable | ( | const DcmUnsignedShort & | data,
|  | const DcmUnsignedShort & | descriptor,
|  | const DcmLongString * | explanation = `NULL`,
|  | const EL_BitsPerTableEntry | descripMode = `ELM_UseValue`,
|  | const signed long | first = `-1`,
|  | EI_Status * | status = `NULL`
| ) |  |

constructor

Parameters

  data | element containing the LUT data
  descriptor | element containing the LUT descriptor
  explanation | element containing the LUT explanation (optional)
  descripMode | mode specifying the use of the bits per table entry value
  first | expected value for "first input value mapped" (optional)
  status | pointer to image status variable (optional)

## ◆ DiLookupTable() [4/5]

DiLookupTable::DiLookupTable | ( | const DcmOtherByteOtherWord & | data,
|  | const DcmUnsignedShort & | descriptor,
|  | const DcmLongString * | explanation = `NULL`,
|  | const EL_BitsPerTableEntry | descripMode = `ELM_UseValue`,
|  | const signed long | first = `-1`,
|  | EI_Status * | status = `NULL`
| ) |  |

constructor

Parameters

  data | element containing the LUT data (must be of VR=OW)
  descriptor | element containing the LUT descriptor
  explanation | element containing the LUT explanation (optional)
  descripMode | mode specifying the use of the bits per table entry value
  first | expected value for "first input value mapped" (optional)
  status | pointer to image status variable (optional)

## ◆ DiLookupTable() [5/5]

DiLookupTable::DiLookupTable | ( | Uint16 * | buffer,
|  | const Uint32 | count,
|  | const Uint16 | bits
| ) |  |

constructor

Parameters

  buffer | pointer to array with LUT entries
  count | number of LUT entries
  bits | number of bits per entry

## Member Function Documentation

## ◆ checkBits()

void DiLookupTable::checkBits | ( | const Uint16 | bits,
|  | const Uint16 | rightBits,
|  | const Uint16 | wrongBits = `0`,
|  | const EL_BitsPerTableEntry | descripMode = `ELM_UseValue`
| ) |  |
| protected

check (and possibly correct) value for bits per LUT entry.

Be very lenient with the value stored in the LUT descriptor and therefore perform some addition (heuristical tests) to assume the most probable value.

Parameters

  bits | actual value for bits per entry
  rightBits | right value (8 or 16)
  wrongBits | wrong value (8 or 16)
  descripMode | mode specifying the use of the bits per table entry value

## ◆ checkTable()

void DiLookupTable::checkTable | ( | unsigned long | count,
|  | Uint16 | bits,
|  | const EL_BitsPerTableEntry | descripMode = `ELM_UseValue`,
|  | EI_Status * | status = `NULL`
| ) |  |
| protected

check (and possibly correct) lookup table for consistency

Parameters

  count | number of LUT entries
  bits | bits per LUT entry
  descripMode | mode specifying the use of the bits per table entry value
  status | pointer to image status variable (optional)

## ◆ compareLUT() [1/2]

int DiLookupTable::compareLUT | ( | const DcmOtherByteOtherWord & | data,
|  | const DcmUnsignedShort & | descriptor
| ) |  |

compares current LUT with specified LUT

Parameters

  data | element containing the LUT data (must be of VR=OW)
  descriptor | element containing the LUT descriptor

Returns
  true if LUTs are not equal (1 = invalid LUT / memory error, 2 = descriptor differs, 3 = data differs) false (0) otherwise

## ◆ compareLUT() [2/2]

int DiLookupTable::compareLUT | ( | const DcmUnsignedShort & | data,
|  | const DcmUnsignedShort & | descriptor
| ) |  |

compares current LUT with specified LUT

Parameters

  data | element containing the LUT data
  descriptor | element containing the LUT descriptor

Returns
  true if LUTs are not equal (1 = invalid LUT / memory error, 2 = descriptor differs, 3 = data differs) false (0) otherwise

## ◆ createInverseLUT()

DiLookupTable* DiLookupTable::createInverseLUT | ( |  | ) | const

create an inverse copy of the current LUT.

(input values become output values and vice versa) This function is used for DICOM print (mainly 8<->12 bit).

Returns
  pointer to inverse LUT

## ◆ Init() [1/2]

void DiLookupTable::Init | ( | const DiDocument * | docu,
|  | DcmItem * | item,
|  | const DcmTagKey & | descriptor,
|  | const DcmTagKey & | data,
|  | const DcmTagKey & | explanation,
|  | const EL_BitsPerTableEntry | descripMode = `ELM_UseValue`,
|  | EI_Status * | status = `NULL`
| ) |  |
| protected

initialize lookup table

Parameters

  docu | pointer to dataset (encapsulated)
  item | pointer to item in dataset where to start (maybe NULL)
  descriptor | tag key containing the LUT descriptor
  data | tag key containing the LUT data
  explanation | tag key containing the LUT explanation
  descripMode | mode specifying the use of the bits per table entry value
  status | pointer to image status variable (optional)

## ◆ Init() [2/2]

void DiLookupTable::Init | ( | const Uint16 * | data,
|  | const unsigned long | count,
|  | const DcmUnsignedShort & | descriptor,
|  | const DcmLongString * | explanation = `NULL`,
|  | const EL_BitsPerTableEntry | descripMode = `ELM_UseValue`,
|  | const signed long | first = `-1`,
|  | EI_Status * | status = `NULL`
| ) |  |
| protected

initialize lookup table

Parameters

  data | array containing the LUT data
  count | number of entries in LUT data array
  descriptor | element containing the LUT descriptor
  explanation | element containing the LUT explanation (optional)
  descripMode | mode specifying the use of the bits per table entry value
  first | expected value for "first input value mapped" (optional)
  status | pointer to image status variable (optional)

## ◆ invertTable()

int DiLookupTable::invertTable | ( | const int | flag = `0x1` | ) |

invert all LUT values.

(new_value = max_value - old_value, e.g. used for presentation LUTs)

Parameters

  flag | if bit 0 is set (0x1, default) the internal copy of the LUT data is modified or a copy of the original data is created (if not already existing), if bit 1 is set (0x2) the original LUT data is modified, a combination of both modes is also supported.

Returns
  status true if successful (0x1 if internal data modified, 0x2 if original data, 0x3 if both), false otherwise

## ◆ mirrorTable()

int DiLookupTable::mirrorTable | ( | const int | flag = `0x1` | ) |

mirror the order of all LUT entries.

i.e. the last one becomes the first etc. (value[i] = value[last - i], e.g. used for presentation LUTs)

Parameters

  flag | if bit 0 is set (0x1, default) the internal copy of the LUT data is modified or a copy of the original data is created (if not already existing), if bit 1 is set (0x2) the original LUT data is modified, a combination of both modes is also supported.

Returns
  status true if successful (0x1 if internal data modified, 0x2 if original data, 0x3 if both), false otherwise

## ◆ operator==() [1/2]

virtual OFBool DiLookupTable::operator== | ( | const DiBaseLUT & | lut | ) |
| virtual

compares current LUT with specified LUT

Parameters

  lut | LUT to be compared with the current one

Returns
  OFTrue if LUTs are equal, OFFalse otherwise

Reimplemented from DiBaseLUT.

## ◆ operator==() [2/2]

virtual OFBool DiLookupTable::operator== | ( | const DiLookupTable & | lut | ) |
| virtual

compares current LUT with specified LUT

Parameters

  lut | LUT to be compared with the current one

Returns
  OFTrue if LUTs are equal, OFFalse otherwise

The documentation for this class was generated from the following file:

- dcmimgle/include/dcmtk/dcmimgle/diluptab.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1