DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DcmQuantColorHashTable Class Reference

this class implements a hash table for colors. More...

## Public Member Functions
| DcmQuantColorHashTable ()
| constructor
| ~DcmQuantColorHashTable ()
| destructor
void | add (const DcmQuantPixel &colorP, int value)
| adds a new color to the hash table.
int | lookup (const DcmQuantPixel &colorP) const
| looks up the given color in the hash table.
unsigned long | addToHashTable (DicomImage &image, unsigned long newmaxval, unsigned long maxcolors)
| adds all pixels of all frames of the given image (which must be a color image) to the hash table.
unsigned long | countEntries () const
| counts the number of entries in the hash table
unsigned long | createHistogram (DcmQuantHistogramItemPointer *&array)
| converts the contents of this hash table into a histogram array.

## Private Member Functions
| DcmQuantColorHashTable (const DcmQuantColorHashTable &src)
| private undefined copy constructor
DcmQuantColorHashTable & | operator= (const DcmQuantColorHashTable &src)
| private undefined copy assignment operator
DcmQuantHistogramItemList & | item (const DcmQuantPixel &colorP)
| Retrieves the specified item from the hash table.

## Private Attributes
table_type | m_Table
| hash array of lists for color/value pairs

## Detailed Description

this class implements a hash table for colors.

Each entry of the hash table consists of an RGB color (DcmQuantPixel object) and an integer value (e. g. counter). This class is used during the quantization of a color image.

## Member Function Documentation

## ◆ add()

void DcmQuantColorHashTable::add | ( | const DcmQuantPixel & | colorP,
|  | int | value )
| inline

adds a new color to the hash table.

The color must not yet be present (the caller is responsible for checking this).

Parameters

  colorP | color to be added to table
  value | integer value (counter) associated to color

References item().

Referenced by DcmQuantColorMapping< T1, T2 >::create().

## ◆ addToHashTable()

unsigned long DcmQuantColorHashTable::addToHashTable | ( | DicomImage & | image,
|  | unsigned long | newmaxval,
|  | unsigned long | maxcolors )

adds all pixels of all frames of the given image (which must be a color image) to the hash table.

The counter (integer value associated to each color) counts the occurrence of the color in the image. If more than maxcolors colors are found, the function returns zero.

Parameters

  image | image in which colors are to be counted
  newmaxval | maximum pixel value to which the contents of the image are scaled down (see documentation of class DcmQuantScaleTable) before counting colors. This is used by the caller to reduce the number of colors in the image if necessary.
  maxcolors | maximum number of colors allowed. If more colors are found, the method immediately returns with a return value of zero.

Returns
  number of colors found, 0 if too many colors.

## ◆ countEntries()

unsigned long DcmQuantColorHashTable::countEntries | ( |  | ) | const

counts the number of entries in the hash table

Returns
  number of entries in hash table

## ◆ createHistogram()

unsigned long DcmQuantColorHashTable::createHistogram | ( | DcmQuantHistogramItemPointer *& | array | ) |

converts the contents of this hash table into a histogram array.

After a successful call to addToHashTable(), this object contains an image histogram stored in a hash table. This method creates a new array of DcmQuantHistogramItem pointers on the heap and moves the contents of the hash table into this array.

Parameters

  array | the hash table array is returned in this parameter

Returns
  number of elements in array

## ◆ item()

DcmQuantHistogramItemList & DcmQuantColorHashTable::item | ( | const DcmQuantPixel & | colorP | ) |
| inline private

Retrieves the specified item from the hash table.

If the item has not been created a new item is created and is returned.

Parameters

  colorP | the item in the hash table

Returns
  the retrieved, or created object

References DcmQuantPixel::hash(), and m_Table.

Referenced by add().

## ◆ lookup()

int DcmQuantColorHashTable::lookup | ( | const DcmQuantPixel & | colorP | ) | const
| inline

looks up the given color in the hash table.

If found, the value associated to the color is returned, -1 otherwise.

Parameters

  colorP | color to look up in hash table

Returns
  value associated to given color if found, -1 otherwise.

References DcmQuantPixel::hash(), DcmQuantHistogramItemList::lookup(), and m_Table.

Referenced by DcmQuantColorMapping< T1, T2 >::create().

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

- dcmimage/include/dcmtk/dcmimage/diqthash.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2