33 #include "dcmtk/config/osconfig.h"
35 #include "dcmtk/dcmimage/dicopxt.h"
36 #include "dcmtk/dcmimgle/diinpx.h"
45 template<
class T1,
class T2>
65 if ((pixel != NULL) && (this->
Count > 0) && (status == EIS_Normal))
69 status = EIS_InvalidValue;
70 DCMIMAGE_ERROR(
"invalid value for 'PlanarConfiguration' (" << this->
PlanarConfiguration <<
")");
94 if (this->
Init(pixel))
96 register T2 *r = this->
Data[0];
97 register T2 *g = this->
Data[1];
98 register T2 *b = this->
Data[2];
99 register unsigned long i;
106 register const T1 *p = pixel;
111 for (i = count / 2; i != 0; --i)
113 y1 = removeSign(*(p++), offset);
114 y2 = removeSign(*(p++), offset);
115 cb = removeSign(*(p++), offset);
116 cr = removeSign(*(p++), offset);
117 convertValue(*(r++), *(g++), *(b++), y1, cb, cr, maxvalue);
118 convertValue(*(r++), *(g++), *(b++), y2, cb, cr, maxvalue);
133 double dr = 1.1631 * OFstatic_cast(
double, y) + 1.5969 * OFstatic_cast(
double, cr) - 0.8713 * OFstatic_cast(
double, maxvalue);
134 double dg = 1.1631 * OFstatic_cast(
double, y) - 0.3913 * OFstatic_cast(
double, cb) - 0.8121 * OFstatic_cast(
double, cr) + 0.5290 * OFstatic_cast(
double, maxvalue);
135 double db = 1.1631 * OFstatic_cast(
double, y) + 2.0177 * OFstatic_cast(
double, cb) - 1.0820 * OFstatic_cast(
double, maxvalue);
136 red = (dr < 0.0) ? 0 : (dr > OFstatic_cast(
double, maxvalue)) ? maxvalue : OFstatic_cast(T2, dr);
137 green = (dg < 0.0) ? 0 : (dg > OFstatic_cast(
double, maxvalue)) ? maxvalue : OFstatic_cast(T2, dg);
138 blue = (db < 0.0) ? 0 : (db > OFstatic_cast(
double, maxvalue)) ? maxvalue : OFstatic_cast(T2, db);