Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Range< T > Class Template Reference

#include <Image/Range.H>

Collaboration diagram for Range< T >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class T>
class Range< T >

A class for managing min/max range information.

This class is primarily intended to work with algorithms that manipulate the dynamic range of Image<T>'s. For example, it can help to specify how an image should have its current dynamic range remapped to a new range (see remapRange() in Image_MathOps.H). In addition, the Range<T> class provides an operator() that allows it to be used as a functor in generic algorithms for accumulating the min/max over a sequence of elements (as in rangeOf() in Image_MathOps.H).

Definition at line 53 of file Range.H.

Public Member Functions

 Range ()
 Default constructor.
 Range (const T &mi, const T &ma)
 Construct with given min and max values.
const T & min () const
 Get the current min value.
const T & max () const
 Get the current max value.
range () const
 Get the range (i.e. the difference of max minus min).
void setMin (const T &mi)
 Set the range's min value.
void setMax (const T &ma)
 Set the range's max value.
void mergeMin (const T &v)
 Update our min value if val is less than the current max.
void mergeMax (const T &val)
 Update our max value if val is greater than the current max.
void merge (const T &val)
 Update our min or max value if val falls outside of the current range.
void operator() (const T &v)
 This operator() allows straightforward use in generic algorithms.
void merge (const Range< T > &other)
 Merge other's min and max values into ours.


Constructor & Destructor Documentation

template<class T>
Range< T >::Range  )  [inline]
 

Default constructor.

We initialize the object's min element with type T's max value, and we initialize the object's max element with type T's min value. This seeming paradoxical situation is in fact "The Right Thing" if we want to accumulate the min/max over a range of elements. The starting condition of the Range object should make the weakest possible assumption about the values that will be observed; and this weakest assumption is precisely to start with the min being as large as possible, and the max being as small as possible.

Definition at line 120 of file Range.H.

template<class T>
Range< T >::Range const T &  mi,
const T &  ma
[inline]
 

Construct with given min and max values.

Definition at line 127 of file Range.H.


Member Function Documentation

template<class T>
const T& Range< T >::max  )  const [inline]
 

Get the current max value.

Definition at line 77 of file Range.H.

Referenced by buildPyrRetinexLog(), buildTitle(), FfmpegEncoder::close(), doOneNormalize(), FourierFeatureExtractor::illustrate(), Image_xx_rangeOf_xx_1(), Image_xx_rangeOf_xx_2(), inspect(), main(), ClassicSearchItemFactory::make(), makeSumoDisplay(), Range< T >::merge(), normalizeFloat(), StatsOutputSeries::Impl::printStatsRGB(), StatsOutputSeries::Impl::printStatsSummary(), showStats(), stainImg(), and FfmpegEncoder::writeRawFrame().

template<class T>
void Range< T >::merge const Range< T > &  other  )  [inline]
 

Merge other's min and max values into ours.

Definition at line 156 of file Range.H.

References Range< T >::max(), Range< T >::mergeMax(), Range< T >::mergeMin(), and Range< T >::min().

template<class T>
void Range< T >::merge const T &  val  )  [inline]
 

Update our min or max value if val falls outside of the current range.

Definition at line 141 of file Range.H.

References Range< T >::mergeMax(), and Range< T >::mergeMin().

Referenced by FfmpegEncoder::close(), getRange(), LogPolarTransform::LogPolarTransform(), main(), makeSumoDisplay(), Range< T >::operator()(), StatsOutputSeries::Impl::printStatsRGB(), rangeOf(), showStats(), and FfmpegEncoder::writeRawFrame().

template<class T>
void Range< T >::mergeMax const T &  val  )  [inline]
 

Update our max value if val is greater than the current max.

Definition at line 137 of file Range.H.

Referenced by Range< T >::merge().

template<class T>
void Range< T >::mergeMin const T &  v  )  [inline]
 

Update our min value if val is less than the current max.

Definition at line 133 of file Range.H.

Referenced by Range< T >::merge().

template<class T>
const T& Range< T >::min  )  const [inline]
 

Get the current min value.

Definition at line 74 of file Range.H.

Referenced by buildTitle(), FfmpegEncoder::close(), FourierFeatureExtractor::illustrate(), Image_xx_rangeOf_xx_1(), Image_xx_rangeOf_xx_2(), inspect(), LogPolarTransform::LogPolarTransform(), main(), ClassicSearchItemFactory::make(), makeSumoDisplay(), Range< T >::merge(), normalizeFloat(), StatsOutputSeries::Impl::printStatsRGB(), StatsOutputSeries::Impl::printStatsSummary(), remapRange(), showStats(), stainImg(), and FfmpegEncoder::writeRawFrame().

template<class T>
void Range< T >::operator() const T &  v  )  [inline]
 

This operator() allows straightforward use in generic algorithms.

In particular, this is useful for accumulating the min/max over a range of elements. For example, rangeOf() could be implemented like this:

      Image<T> img;
      Range<T> rng = std::for_each(img.begin(), img.end(), Range<T>());

We construct a default Range<T> object, which is copied and passed to for_each(), which in turn calls operator() on that range object for each element in the iterator sequence that is visited.

Definition at line 149 of file Range.H.

References Range< T >::merge().

template<class T>
T Range< T >::range  )  const [inline]
 

Get the range (i.e. the difference of max minus min).

Definition at line 80 of file Range.H.

Referenced by LogPolarTransform::LogPolarTransform(), and remapRange().

template<class T>
void Range< T >::setMax const T &  ma  )  [inline]
 

Set the range's max value.

Definition at line 86 of file Range.H.

template<class T>
void Range< T >::setMin const T &  mi  )  [inline]
 

Set the range's min value.

Definition at line 83 of file Range.H.


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 13:46:16 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4