Class for computing a histogram and some statistics: average, min, max, mean, std.dev, sum.  
 More...
#include <Histogram.h>
|  | 
| typedef unsigned long | count_t | 
|  | 
| typedef std::vector< count_t > | vect_t | 
|  | 
|  | 
|  | 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. 
 | 
|  | 
| void | setSampleCount (long int n) | 
|  | Does not change the size of the histogram. 
 | 
|  | 
| 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 > | 
| T | scaleOut (size_type i) const | 
|  | 
| template<class T > | 
| T | getMax () const | 
|  | Statistics. 
 | 
|  | 
| template<class T > | 
| T | getMin () const | 
|  | 
| template<class T > | 
| T | getSum () const | 
|  | Sum of the samples. 
 | 
|  | 
| template<class T > | 
| T | getMean () const | 
|  | Unscaled mean. 
 | 
|  | 
| template<class T > | 
| T | getMedian () const | 
|  | 
| template<class T > | 
| T | getWeightedMedian (float p) const | 
|  | 
| template<class T > | 
| T | getVariance () const | 
|  | Computes variance of the values inside the window. 
 | 
|  | 
| template<class T > | 
| 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 std::size_t | recommendSizeByType (const std::type_info &type, std::size_t defaultValue=256) | 
|  | 
|  | 
| typedef double(Histogram::* | stat_ptr_t) () const | 
|  | 
|  | 
| void | initialize () | 
|  | 
| stat_ptr_t | getStatisticPtr (char c) | 
|  | 
|  | 
| double(Histogram::* | statisticPtr )() const | 
|  | 
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. 
◆ compute()
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. 
- Template Parameters
- 
  
    | T | - an iterable type (implements begin() and end()) |  
 
- Parameters
- 
  
    | src | - source data |  | scaling | - linear scaling |  
 
 
 
◆ getSum()
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:
- src/drain/util/Histogram.h
- src/drain/util/Histogram.cpp