33 #include "dcmtk/config/osconfig.h"
35 #include "dcmtk/ofstd/ofbmanip.h"
36 #include "dcmtk/ofstd/ofcast.h"
38 #include "dcmtk/dcmimgle/dipxrept.h"
39 #include "dcmtk/dcmimgle/dimopx.h"
40 #include "dcmtk/dcmimgle/dimoopx.h"
127 return OFstatic_cast(
const void *,
Data);
136 return OFstatic_cast(
void *,
Data);
147 return OFstatic_cast(
void *, &
Data);
178 if ((idx >= 0) && (idx <= 1))
185 center = (OFstatic_cast(
double,
MinValue[idx]) + OFstatic_cast(
double,
MaxValue[idx]) + 1) / 2;
186 width = OFstatic_cast(
double,
MaxValue[idx]) - OFstatic_cast(
double,
MinValue[idx]) + 1;
187 result = (width > 0);
207 const unsigned long top_pos,
208 const unsigned long width,
209 const unsigned long height,
210 const unsigned long columns,
211 const unsigned long rows,
212 const unsigned long frame,
217 if ((
Data != NULL) && (left_pos < columns) && (top_pos < rows))
219 register T *p =
Data + (columns * rows * frame) + (top_pos * columns) + left_pos;
220 const unsigned long right_pos = (left_pos + width < columns) ? left_pos + width : columns;
221 const unsigned long bottom = (top_pos + height < rows) ? top_pos + height : rows;
222 const unsigned long skip_x = left_pos + (columns - right_pos);
223 register unsigned long x;
224 register unsigned long y;
225 register T value = 0;
227 register T max = min;
228 for (y = top_pos; y < bottom; ++y)
230 for (x = left_pos; x < right_pos; ++x)
235 else if (value > max)
243 voiCenter = (OFstatic_cast(
double, min) + OFstatic_cast(
double, max) + 1) / 2;
244 voiWidth = OFstatic_cast(
double, max) - OFstatic_cast(
double, min) + 1;
245 result = (width > 0);
265 Uint32 *quant =
new Uint32[count];
268 register unsigned long i;
270 for (i = 0; i <
Count; ++i)
276 DCMIMGLE_WARN(
"invalid value (" <<
Data[i] <<
") in DiMonoPixelTemplate<T>::getHistogramWindow()");
279 const Uint32 threshvalue = OFstatic_cast(Uint32, thresh * OFstatic_cast(
double, Count));
280 register Uint32 t = 0;
282 while ((i < count) && (t < threshvalue))
284 const T minvalue = (i < count) ? OFstatic_cast(T,
MinValue[0] + i) : 0;
287 while ((i > 0) && (t < threshvalue))
289 const T maxvalue = (i > 0) ? OFstatic_cast(T,
MinValue[0] + i) : 0;
291 if (minvalue < maxvalue)
296 center = (OFstatic_cast(
double, minvalue) + OFstatic_cast(
double, maxvalue) + 1) / 2;
297 width = OFstatic_cast(
double, maxvalue) - OFstatic_cast(
double, minvalue) + 1;
330 const unsigned long count)
349 const int mode = 0x1)
355 if ((minvalue == 0) && (maxvalue == 0))
357 DCMIMGLE_DEBUG(
"determining global minimum and maximum pixel values for monochrome image");
358 register T *p =
Data;
359 register T value = *p;
360 register unsigned long i;
363 for (i =
Count; i > 1; --i)
366 if (value < minvalue)
368 else if (value > maxvalue)
382 DCMIMGLE_DEBUG(
"determining next minimum and maximum pixel values for monochrome image");
383 register T *p =
Data;
385 register int firstmin = 1;
386 register int firstmax = 1;
387 register unsigned long i;
388 for (i =
Count; i != 0; --i)
391 if ((value > minvalue) && ((value <
MinValue[1]) || firstmin))
396 if ((value < maxvalue) && ((value >
MaxValue[1]) || firstmax))
Template class to handle monochrome pixel data.
DiMonoPixelTemplate(const unsigned long count)
constructor
int getMinMaxWindow(const int idx, double ¢er, double &width)
get automatically computed min-max window
int getMinMaxValues(double &min, double &max) const
get minimum and maximum pixel values
T MinValue[2]
minimum pixel values (0 = global, 1 = ignoring global)
Abstract base class to handle monochrome pixel data.
Abstract base class to create monochrome output data.
const void * getData() const
get pointer to internal pixel data
int getHistogramWindow(const double thresh, double ¢er, double &width)
get automatically computed histogram window
T * Data
pointer to pixel data
DiMonoPixelTemplate(const DiMonoPixel *pixel, const unsigned long count)
constructor
Template class to determine pixel representation.
Class to handle modality specific transformations (incl.
void determineMinMax(T minvalue=0, T maxvalue=0, const int mode=0x1)
determine minimum and maximum pixel values
DiMonoPixelTemplate(DiMonoOutputPixel *pixel, DiMonoModality *modality)
constructor
T MaxValue[2]
maximum pixel values
static void zeroMem(T *dest, const unsigned long count)
sets specified number of elements in destination memory to zero
void * getDataArrayPtr()
get reference to pointer to internal pixel data.
void * getDataPtr()
get pointer to internal pixel data
DiMonoPixelTemplate(const DiInputPixel *pixel, DiMonoModality *modality)
constructor
virtual ~DiMonoPixelTemplate()
destructor
EP_Representation getRepresentation() const
get integer representation
virtual EP_Representation getRepresentation() const
determine integer representation for template type T
Abstract base class to handle pixel data.
DiMonoPixelTemplate(const DiPixel *pixel, DiMonoModality *modality)
constructor
virtual int getRoiWindow(const unsigned long left_pos, const unsigned long top_pos, const unsigned long width, const unsigned long height, const unsigned long columns, const unsigned long rows, const unsigned long frame, double &voiCenter, double &voiWidth)
get automatically computed Region of Interest (ROI) window
unsigned long Count
number of pixels