33 #include "dcmtk/config/osconfig.h" 35 #include "dcmtk/dcmimage/dicopxt.h" 36 #include "dcmtk/dcmimgle/diluptab.h" 37 #include "dcmtk/dcmimgle/diinpx.h" 45 template<
class T1,
class T2,
class T3>
65 const unsigned long planeSize,
69 if ((pixel != NULL) && (this->
Count > 0) && (status == EIS_Normal))
91 const unsigned long planeSize,
94 if (this->
Init(pixel))
132 register unsigned long l;
133 register unsigned long i = 0;
134 register const T1 *a = pixel;
136 rgb[0] = a + planeSize;
137 rgb[1] = rgb[0] + planeSize;
138 rgb[2] = rgb[1] + planeSize;
142 for (l = planeSize; (l != 0) && (i < count); --l, ++i)
144 value = OFstatic_cast(T2, *(a++));
147 for (
int j = 0; j < 3; ++j)
149 if (value <= palette[j]->getFirstEntry(value))
150 this->
Data[j][i] = OFstatic_cast(T3, palette[j]->getFirstValue());
151 else if (value >= palette[j]->getLastEntry(value))
152 this->
Data[j][i] = OFstatic_cast(T3, palette[j]->getLastValue());
154 this->
Data[j][i] = OFstatic_cast(T3, palette[j]->getValue(value));
160 for (
int j = 0; j < 3; ++j)
161 this->
Data[j][i] = OFstatic_cast(T3, removeSign(*(rgb[j]++), offset));
166 for (
int j = 0; j < 3; ++j)
167 rgb[j] += 2 * planeSize;
170 register unsigned long i;
171 register const T1 *p = pixel;
172 for (i = 0; i < count; ++i)
174 value = OFstatic_cast(T2, *(p++));
177 for (
int j = 0; j < 3; ++j)
179 if (value <= palette[j]->getFirstEntry(value))
180 this->
Data[j][i] = OFstatic_cast(T3, palette[j]->getFirstValue());
181 else if (value >= palette[j]->getLastEntry(value))
182 this->
Data[j][i] = OFstatic_cast(T3, palette[j]->getLastValue());
184 this->
Data[j][i] = OFstatic_cast(T3, palette[j]->getValue(value));
190 for (
int j = 0; j < 3; ++j)
191 this->
Data[j][i] = OFstatic_cast(T3, removeSign(*(p++), offset));
virtual ~DiARGBPixelTemplate()
destructor
Interface class to DICOM data management (dcmdata).
void convert(const T1 *pixel, DiLookupTable *palette[3], const unsigned long planeSize, const int bits)
convert input pixel data to intermediate representation
T3 * Data[3]
pointer to pixel data (3 components)
int PlanarConfiguration
planar configuration of the original pixel data (0 = color-by-pixel, 1 = color-by-plane) ...
Template class to handle color pixel data.
Class to handle color palette look-up tables.
static unsigned long maxval(const int mv_bits, const unsigned long mv_pos=1)
calculate maximum value which could be stored in the specified number of bits
unsigned long InputCount
number of pixels in the input buffer
DiARGBPixelTemplate(const DiDocument *docu, const DiInputPixel *pixel, DiLookupTable *palette[3], EI_Status &status, const unsigned long planeSize, const int bits)
constructor
Template class to handle ARGB pixel data.
int Init(const void *pixel)
initialize internal memory
unsigned long Count
number of pixels