33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/ofstd/oftypes.h"
35 #include "dcmtk/ofstd/ofcond.h"
36 #include "dcmtk/dcmimage/diqtpix.h"
37 #include "dcmtk/dcmimage/diqthash.h"
38 #include "dcmtk/ofstd/ofstring.h"
104 return *(
array[idx]);
111 inline DcmQuantComponent
getRed(
unsigned long idx)
const
123 inline DcmQuantComponent
getGreen(
unsigned long idx)
const
135 inline DcmQuantComponent
getBlue(
unsigned long idx)
const
161 unsigned long theMaxval,
162 unsigned long numberOfColors,
163 DcmLargestDimensionType largeType,
164 DcmRepresentativeColorType repType);
173 register int r2, g2, b2;
174 register long newdist;
175 register int r1 = OFstatic_cast(
int, px.
getRed());
176 register int g1 = OFstatic_cast(
int, px.
getGreen());
177 register int b1 = OFstatic_cast(
int, px.
getBlue());
178 register long dist = 2000000000;
179 for (
unsigned long i = 0; i <
numColors; ++i)
184 newdist = r2*r2 + g2*g2 + b2*b2;
187 result = OFstatic_cast(
int, i);
207 OFBool write16BitEntries);
a class representing a list of DICOM elements in which each element has a different tag and elements ...
DcmQuantHistogramItemPointer * array
color table data
objects of this class represent individual RGB pixels.
const DcmQuantPixel & getPixel(unsigned long idx) const
returns the color at index idx.
DcmQuantComponent getGreen(unsigned long idx) const
returns the green color component at index idx
this class extends DcmQuantPixel by an integer value which is used for various purposes.
unsigned long numColors
number of entries in color table
this class implements a color table that can either be a look-up table or an image color histogram...
DcmQuantComponent getBlue() const
returns the blue component
DcmQuantComponent getBlue(unsigned long idx) const
returns the blue color component at index idx
void clear()
resets the object to default-constructed state
DcmQuantComponent getRed(unsigned long idx) const
returns the red color component at index idx
unsigned long getColors() const
returns the number of colors in the color table
OFCondition medianCut(DcmQuantColorTable &histogram, unsigned long sum, unsigned long theMaxval, unsigned long numberOfColors, DcmLargestDimensionType largeType, DcmRepresentativeColorType repType)
computes a color LUT for the given image histogram.
unsigned long maxval
maximum pixel value to which all color samples were down-sampled during computation of the histogram...
OFCondition write(DcmItem &target, OFBool writeAsOW, OFBool write16BitEntries)
writes the current color table into a DICOM object, encoded as Red/Green/Blue Palette Color Lookup Ta...
unsigned long getMaxVal() const
after a call to computeHistogram(), this method returns the maximum pixel value to which all color sa...
void setDescriptionString(OFString &str) const
creates a description string suitable for use as Derivation Description.
DcmQuantComponent getGreen() const
returns the green component
int computeIndex(const DcmQuantPixel &px) const
determines for a given color the closest match in the color LUT.
~DcmQuantColorTable()
destructor
DcmQuantComponent getRed() const
returns the red component
DcmQuantColorTable()
constructor
Interface class for dcmimgle/dcmimage module.
DcmQuantColorTable & operator=(const DcmQuantColorTable &src)
private undefined copy assignment operator
void computeClusters()
after a call to medianCut(), this method computes for each entry in the color map the minimum of the ...
a simple string class that implements a subset of std::string.
OFCondition computeHistogram(DicomImage &image, unsigned long maxcolors)
creates a color table containing a histogram of the given image.
General purpose class for condition codes.