Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Histogram Class Reference

Class for computing a histogram and some statistics: average, min, max, mean, std.dev, sum. More...

#include <Histogram.h>

Inheritance diagram for Histogram:
Inheritance graph
[legend]
Collaboration diagram for Histogram:
Collaboration graph
[legend]

Public Types

typedef unsigned long count_t
 
typedef std::vector< count_t > vect_t
 

Public Member Functions

 Histogram (size_t size=256)
 
 Histogram (const Histogram &histogram)
 
void setSize (size_t s)
 Sets the number of bins; the resolution of the histogram.
 
int getSize () const
 
int autoSize (const std::type_info &type)
 
void clearBins ()
 Does not change the size of the histogram.
 
template<class T >
void compute (const T &src, const std::type_info &type=typeid(double), const UniTuple< double, 2 > &scaling={1.0, 0.0})
 Collect distribution. More...
 
void setSampleCount (long int n)
 Does not change the size of the histogram. More...
 
size_t getSampleCount () const
 
void setRange (double dataMin, double dataMax)
 Set range of original (physical) values to be mapped on the limited number of bins. Note: max refers to open upper limit.
 
void setRange (const Range< double > &range)
 Set range of original (physical) values to be mapped on the limited number of bins. Note: max refers to open upper limit.
 
void deriveScaling (const ValueScaling &s, const Type &type)
 
void setScale (const ValueScaling &scaling)
 
int getInMin () const
 Set range of original (physical) values to be mapped on the limited number of bins. Note: max refers to open upper limit.
 
int getUpperBoundIn () const
 Returns the upperLimit (exclusive)
 
int getOutMin () const
 
int getUpperBoundOut () const
 Returns the upperLimit (exclusive)
 
void setMedianPosition (double pos)
 Set location of the median, if not in the middle (50%).
 
template<class T >
void increment (T i)
 
template<class T >
void increment (T i, int count)
 
template<class T >
void incrementRaw (T i)
 
template<class T >
void incrementRaw (T i, int count)
 
template<class T >
void decrement (T i)
 
template<class T >
void decrement (T i, int count)
 
template<class T >
void decrementRaw (T i)
 
template<class T >
void decrementRaw (T i, int count)
 
template<class T >
scaleOut (size_type i) const
 
template<class T >
getMax () const
 Statistics.
 
template<class T >
getMin () const
 
template<class T >
getSum () const
 Sum of the samples. More...
 
template<class T >
getMean () const
 Unscaled mean.
 
template<class T >
getMedian () const
 
template<class T >
getWeightedMedian (float p) const
 
template<class T >
getVariance () const
 Computes variance of the values inside the window.
 
template<class T >
getStdDeviation () const
 
const vect_t getVector () const
 
std::ostream & toStream (std::ostream &ostr) const
 
void dump (std::ostream &ostr=std::cout)
 
double getValue ()
 
double getValue (char c)
 Return requested statistic.
 
void setValueFunc (char c)
 

Static Public Member Functions

static std::size_t recommendSizeByType (const std::type_info &type, std::size_t defaultValue=256)
 

Public Attributes

ValueScaling scaling
 
std::string delimiter
 

Protected Types

typedef double(Histogram::* stat_ptr_t) () const
 

Protected Member Functions

void initialize ()
 
stat_ptr_t getStatisticPtr (char c)
 

Protected Attributes

double(Histogram::* statisticPtr )() const
 

Detailed Description

Class for computing a histogram and some statistics: average, min, max, mean, std.dev, sum.

T input type, eg. unsigned char for 8-bit images. T2 output type for values not within the set of input values, like std.dev.

Member Function Documentation

◆ compute()

void compute ( const T &  src,
const std::type_info &  type = typeid(double),
const UniTuple< double, 2 > &  scaling = {1.0, 0.0} 
)

Collect distribution.

Template Parameters
T- an iterable type (implements begin() and end())
Parameters
src- source data
scaling- linear scaling

◆ getSum()

T getSum ( ) const
inline

Sum of the samples.

TODO: handle somehow no-data and other markers - with a different function?

◆ setSampleCount()

void setSampleCount ( long int  n)
inline

Does not change the size of the histogram.

Sets the expected sample count. Deprecating.


The documentation for this class was generated from the following files: