/usr/include/dcmtk/dcmimage/diqtpix.h is in libdcmtk2-dev 3.6.0-15.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | /*
*
* Copyright (C) 2002-2010, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmimage
*
* Author: Marco Eichelberg
*
* Purpose: class DcmQuantPixel
*
* Last Update: $Author: joergr $
* Update Date: $Date: 2010-10-14 13:16:30 $
* CVS/RCS Revision: $Revision: 1.4 $
* Status: $State: Exp $
*
* CVS/RCS Log at end of file
*
*/
#ifndef DIQTPIX_H
#define DIQTPIX_H
#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/oftypes.h" /* for OFBool */
#include "dcmtk/dcmimage/diqttype.h" /* for DcmQuantHashSize, DcmQuantComponent */
#include "dcmtk/dcmimage/diqtstab.h" /* for DcmScaleTable */
/** objects of this class represent individual RGB pixels. This class is
* used by the color quantization classes. For efficiency considerations,
* all methods are declared inline.
*/
class DcmQuantPixel
{
public:
/** default constructor, creates black pixel
*/
DcmQuantPixel()
: red(0)
, green(0)
, blue(0)
{
}
/** copy assignment constructor
*/
DcmQuantPixel(const DcmQuantPixel& arg)
: red(arg.red)
, green(arg.green)
, blue(arg.blue)
{
}
// we don't declare a destructor here, but the standard destructor will do.
/// comparison operator for equality
inline OFBool operator==(const DcmQuantPixel& src) const
{
return (red == src.red) && (green == src.green) && (blue == src.blue);
}
/** this method computes the luminance of the current pixel
* according to the NTSC formula. The range of the luminance equals the
* range of the underlying DcmQuantComponent type. However, the
* luminance is returned as a double.
* @return luminance of this pixel
*/
inline double luminance() const
{
return 0.299 * red + 0.587 * green + 0.114 * blue;
}
/** this method computes an unsigned long hash value for the current pixel.
* The hash algorithm is taken from Jef Poskanzer's ppm utility library.
* The return value is guaranteed to be < DcmQuantHashSize.
* @return hash value for current pixel
*/
inline unsigned long hash() const
{
return ((OFstatic_cast(unsigned long, red) * 33023UL + OFstatic_cast(unsigned long, green) * 30013UL +
OFstatic_cast(unsigned long, blue) * 27011UL) & 0x7fffffffUL) % DcmQuantHashSize;
}
/** returns the red component
* @return red component of this pixel
*/
inline DcmQuantComponent getRed() const
{
return red;
}
/** returns the green component
* @return green component of this pixel
*/
inline DcmQuantComponent getGreen() const
{
return green;
}
/** returns the blue component
* @return blue component of this pixel
*/
inline DcmQuantComponent getBlue() const
{
return blue;
}
/** assigns new R, G and B values to this pixel
* @param r new R
* @param g new G
* @param b new B
*/
inline void assign(
DcmQuantComponent r,
DcmQuantComponent g,
DcmQuantComponent b)
{
red = r;
green = g;
blue = b;
}
/** assigns new R, G and B values to this pixel
* using the given scale table in which all
* three values are looked up.
* @param r new R
* @param g new G
* @param b new B
* @param table scale table (LUT) in which R, G and B are looked up.
*/
inline void scale(
DcmQuantComponent r,
DcmQuantComponent g,
DcmQuantComponent b,
const DcmQuantScaleTable& table)
{
red = table[r];
green = table[g];
blue = table[b];
}
private:
/// red color component of this pixel
DcmQuantComponent red;
/// green color component of this pixel
DcmQuantComponent green;
/// blue color component of this pixel
DcmQuantComponent blue;
};
#endif
/*
* CVS/RCS Log:
* $Log: diqtpix.h,v $
* Revision 1.4 2010-10-14 13:16:30 joergr
* Updated copyright header. Added reference to COPYRIGHT file.
*
* Revision 1.3 2005/12/08 16:01:53 meichel
* Changed include path schema for all DCMTK header files
*
* Revision 1.2 2003/12/23 12:20:07 joergr
* Adapted type casts to new-style typecast operators defined in ofcast.h.
* Updated copyright header.
*
* Revision 1.1 2002/01/25 13:32:07 meichel
* Initial release of new color quantization classes and
* the dcmquant tool in module dcmimage.
*
*
*/
|