17#ifndef __image_min_max_h__
18#define __image_min_max_h__
27 template <
class ImageType>
33 overall_min (overall_min), overall_max (overall_max),
40 std::lock_guard<std::mutex> lock (mutex);
41 overall_min = std::min (overall_min, min);
42 overall_max = std::max (overall_max, max);
45 void operator() (ImageType& vox) {
47 if (std::isfinite (val)) {
48 if (val < min) min = val;
49 if (val > max) max = val;
53 template <
class MaskType>
54 void operator() (ImageType& vox, MaskType& mask) {
57 if (std::isfinite (val)) {
58 if (val < min) min = val;
59 if (val > max) max = val;
68 static std::mutex mutex;
70 template <
class ImageType> std::mutex __MinMax<ImageType>::mutex;
74 template <
class ImageType>
80 size_t to_axis = std::numeric_limits<size_t>::max())
83 .run (__MinMax<ImageType> (min, max), in);
86 template <
class ImageType,
class MaskType>
93 size_t to_axis = std::numeric_limits<size_t>::max())
96 .run (__MinMax<ImageType> (min, max), in, mask);
MR::default_type value_type
ThreadedLoopRunOuter< decltype(Loop(vector< size_t >()))> ThreadedLoop(const HeaderType &source, const vector< size_t > &outer_axes, const vector< size_t > &inner_axes)
Multi-threaded loop object.
std::string shorten(const std::string &text, size_t longest=40, size_t prefix=10)
convert a long string to 'beginningofstring...endofstring' for display
void min_max(ImageType &in, typename ImageType::value_type &min, typename ImageType::value_type &max, size_t from_axis=0, size_t to_axis=std::numeric_limits< size_t >::max())