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))