OpenMS
|
Representation of a histogram. More...
#include <OpenMS/MATH/STATISTICS/Histogram.h>
Public Types | |
typedef std::vector< ValueType >::const_iterator | ConstIterator |
Non-mutable iterator of the bins. More... | |
Public Member Functions | |
Assignment and equality operators | |
bool | operator== (const Histogram &histogram) const |
Equality operator. More... | |
bool | operator!= (const Histogram &histogram) const |
Inequality operator. More... | |
Histogram & | operator= (const Histogram &histogram) |
Assignment. More... | |
Iterators | |
BinSizeType | min_ |
Lower bound. More... | |
BinSizeType | max_ |
Upper bound. More... | |
BinSizeType | bin_size_ |
Bin size. More... | |
std::vector< ValueType > | bins_ |
Vector of bins. More... | |
ConstIterator | begin () const |
Non-mutable iterator pointing to the first bin. More... | |
ConstIterator | end () const |
Non-mutable iterator pointing after the last bin. More... | |
void | applyLogTransformation (BinSizeType multiplier) |
Transforms the bin values with f(x)=multiplier*log(x+1) More... | |
Size | valueToBin (BinSizeType val) const |
Returns the bin index a given value belongs to. More... | |
void | initBins_ () |
initialize the bins More... | |
Constructors and Destructors | |
Histogram () | |
default constructor More... | |
Histogram (const Histogram &histogram) | |
copy constructor More... | |
Histogram (BinSizeType min, BinSizeType max, BinSizeType bin_size) | |
constructor with min, max (inclusive) and bin width More... | |
template<typename DataIterator > | |
Histogram (DataIterator begin, DataIterator end, BinSizeType min, BinSizeType max, BinSizeType bin_size) | |
constructor with data iterator and min, max, bin_size parameters More... | |
virtual | ~Histogram () |
destructor More... | |
BinSizeType | minBound () const |
returns the lower bound (inclusive) More... | |
BinSizeType | maxBound () const |
returns the upper bound (inclusive) More... | |
ValueType | maxValue () const |
returns the bin with the highest count More... | |
ValueType | minValue () const |
returns the bin with lowest count More... | |
BinSizeType | binSize () const |
returns the bin size More... | |
Size | size () const |
returns the number of bins More... | |
ValueType | operator[] (Size index) const |
returns the value of bin index More... | |
BinSizeType | centerOfBin (Size bin_index) const |
returns the center position of the bin with the index bin_index More... | |
BinSizeType | rightBorderOfBin (Size bin_index) const |
returns the first value to the right side of the bin with the index bin_index , which is not part of this bin, i.e. open right side of the interval. More... | |
BinSizeType | leftBorderOfBin (Size bin_index) const |
returns the leftmost value of the bin with the index bin_index , which is part of this bin, i.e. closed left side of the interval. More... | |
ValueType | binValue (BinSizeType val) const |
returns the value of bin corresponding to the value val More... | |
Size | inc (BinSizeType val, ValueType increment=1) |
increases the bin corresponding to value val by increment More... | |
Size | incUntil (BinSizeType val, bool inclusive, ValueType increment=1) |
Increment all bins from to lowest(=first) bin up to (and including?) the bin for val by a certain number of counts. More... | |
Size | incFrom (BinSizeType val, bool inclusive, ValueType increment=1) |
Increment all bins from the bin of val to the highest(=last) bin by a certain number of counts. More... | |
void | reset (BinSizeType min, BinSizeType max, BinSizeType bin_size) |
resets the histogram with the given range and bin size More... | |
template<typename DataIterator > | |
static void | getCumulativeHistogram (DataIterator begin, DataIterator end, bool complement, bool inclusive, Histogram< ValueType, BinSizeType > &histogram) |
Representation of a histogram.
The first template argument gives the Type of the values that are stored in the bins. The second argument gives the type for the bin size and range.
typedef std::vector<ValueType>::const_iterator ConstIterator |
Non-mutable iterator of the bins.
|
inline |
default constructor
|
inline |
constructor with min, max (inclusive) and bin width
Exception::OutOfRange | is thrown if bin_size negative or zero |
References Histogram< ValueType, BinSizeType >::initBins_().
|
inline |
constructor with data iterator and min, max, bin_size parameters
Exception::OutOfRange | is thrown if bin_size negative or zero |
References Histogram< ValueType, BinSizeType >::begin(), Histogram< ValueType, BinSizeType >::end(), Histogram< ValueType, BinSizeType >::inc(), and Histogram< ValueType, BinSizeType >::initBins_().
|
inlinevirtual |
destructor
|
inline |
Transforms the bin values with f(x)=multiplier*log(x+1)
References Histogram< ValueType, BinSizeType >::bins_.
|
inline |
Non-mutable iterator pointing to the first bin.
References Histogram< ValueType, BinSizeType >::bins_.
Referenced by Histogram< ValueType, BinSizeType >::getCumulativeHistogram(), and Histogram< ValueType, BinSizeType >::Histogram().
|
inline |
returns the bin size
References Histogram< ValueType, BinSizeType >::bin_size_.
|
inline |
returns the value of bin corresponding to the value val
Exception::OutOfRange | is thrown if the value is out of valid range |
References Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::valueToBin().
|
inline |
returns the center position of the bin with the index bin_index
Exception::IndexOverflow | is thrown for invalid indices |
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::min_.
Referenced by OpenMS::Math::operator<<().
|
inline |
Non-mutable iterator pointing after the last bin.
References Histogram< ValueType, BinSizeType >::bins_.
Referenced by Histogram< ValueType, BinSizeType >::getCumulativeHistogram(), and Histogram< ValueType, BinSizeType >::Histogram().
|
inlinestatic |
|
inline |
increases the bin corresponding to value val
by increment
Exception::OutOfRange | is thrown if the value is out of valid range |
References Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::valueToBin().
Referenced by Histogram< ValueType, BinSizeType >::Histogram().
|
inline |
Increment all bins from the bin of val
to the highest(=last) bin by a certain number of counts.
val | The value which determines the lowest bin |
inclusive | Is the lowest bin included? |
increment | Increase each bin by this value |
value
References Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::valueToBin().
Referenced by Histogram< ValueType, BinSizeType >::getCumulativeHistogram().
|
inline |
Increment all bins from to lowest(=first) bin up to (and including?) the bin for val
by a certain number of counts.
val | The value which determines the highest bin |
inclusive | Is the highest bin included? |
increment | Increase each bin by this value |
value
References Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::valueToBin().
Referenced by Histogram< ValueType, BinSizeType >::getCumulativeHistogram().
|
inlineprotected |
initialize the bins
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::max_, and Histogram< ValueType, BinSizeType >::min_.
Referenced by Histogram< ValueType, BinSizeType >::Histogram().
|
inline |
returns the leftmost value of the bin with the index bin_index
, which is part of this bin, i.e. closed left side of the interval.
Exception::IndexOverflow | is thrown for invalid indices |
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::min_.
|
inline |
returns the upper bound (inclusive)
References Histogram< ValueType, BinSizeType >::max_.
Referenced by Histogram< ValueType, BinSizeType >::rightBorderOfBin().
|
inline |
returns the bin with the highest count
References Histogram< ValueType, BinSizeType >::bins_.
|
inline |
returns the lower bound (inclusive)
References Histogram< ValueType, BinSizeType >::min_.
|
inline |
returns the bin with lowest count
References Histogram< ValueType, BinSizeType >::bins_.
|
inline |
Inequality operator.
References Histogram< ValueType, BinSizeType >::operator==().
|
inline |
Equality operator.
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, Histogram< ValueType, BinSizeType >::max_, and Histogram< ValueType, BinSizeType >::min_.
Referenced by Histogram< ValueType, BinSizeType >::operator!=().
|
inline |
returns the value of bin index
Exception::IndexOverflow | is thrown for invalid indices |
References Histogram< ValueType, BinSizeType >::bins_.
|
inline |
resets the histogram with the given range and bin size
Exception::OutOfRange | is thrown if bin_size negative or zero |
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, Histogram< ValueType, BinSizeType >::max_, and Histogram< ValueType, BinSizeType >::min_.
|
inline |
returns the first value to the right side of the bin with the index bin_index
, which is not part of this bin, i.e. open right side of the interval.
Exception::IndexOverflow | is thrown for invalid indices |
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, Histogram< ValueType, BinSizeType >::maxBound(), and Histogram< ValueType, BinSizeType >::min_.
|
inline |
returns the number of bins
References Histogram< ValueType, BinSizeType >::bins_.
Referenced by OpenMS::Math::operator<<().
|
inline |
Returns the bin index a given value belongs to.
Exception::OutOfRange | is thrown if the value is out of valid range [min, max] |
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, Histogram< ValueType, BinSizeType >::max_, and Histogram< ValueType, BinSizeType >::min_.
Referenced by Histogram< ValueType, BinSizeType >::binValue(), Histogram< ValueType, BinSizeType >::inc(), Histogram< ValueType, BinSizeType >::incFrom(), and Histogram< ValueType, BinSizeType >::incUntil().
|
protected |
Bin size.
Referenced by Histogram< ValueType, BinSizeType >::binSize(), Histogram< ValueType, BinSizeType >::centerOfBin(), Histogram< ValueType, BinSizeType >::initBins_(), Histogram< ValueType, BinSizeType >::leftBorderOfBin(), Histogram< ValueType, BinSizeType >::operator=(), Histogram< ValueType, BinSizeType >::operator==(), Histogram< ValueType, BinSizeType >::reset(), Histogram< ValueType, BinSizeType >::rightBorderOfBin(), and Histogram< ValueType, BinSizeType >::valueToBin().
|
protected |
Vector of bins.
Referenced by Histogram< ValueType, BinSizeType >::applyLogTransformation(), Histogram< ValueType, BinSizeType >::begin(), Histogram< ValueType, BinSizeType >::binValue(), Histogram< ValueType, BinSizeType >::centerOfBin(), Histogram< ValueType, BinSizeType >::end(), Histogram< ValueType, BinSizeType >::inc(), Histogram< ValueType, BinSizeType >::incFrom(), Histogram< ValueType, BinSizeType >::incUntil(), Histogram< ValueType, BinSizeType >::leftBorderOfBin(), Histogram< ValueType, BinSizeType >::maxValue(), Histogram< ValueType, BinSizeType >::minValue(), Histogram< ValueType, BinSizeType >::operator=(), Histogram< ValueType, BinSizeType >::operator==(), Histogram< ValueType, BinSizeType >::operator[](), Histogram< ValueType, BinSizeType >::reset(), Histogram< ValueType, BinSizeType >::rightBorderOfBin(), Histogram< ValueType, BinSizeType >::size(), and Histogram< ValueType, BinSizeType >::valueToBin().
|
protected |
Upper bound.
Referenced by Histogram< ValueType, BinSizeType >::initBins_(), Histogram< ValueType, BinSizeType >::maxBound(), Histogram< ValueType, BinSizeType >::operator=(), Histogram< ValueType, BinSizeType >::operator==(), Histogram< ValueType, BinSizeType >::reset(), and Histogram< ValueType, BinSizeType >::valueToBin().
|
protected |
Lower bound.
Referenced by Histogram< ValueType, BinSizeType >::centerOfBin(), Histogram< ValueType, BinSizeType >::initBins_(), Histogram< ValueType, BinSizeType >::leftBorderOfBin(), Histogram< ValueType, BinSizeType >::minBound(), Histogram< ValueType, BinSizeType >::operator=(), Histogram< ValueType, BinSizeType >::operator==(), Histogram< ValueType, BinSizeType >::reset(), Histogram< ValueType, BinSizeType >::rightBorderOfBin(), and Histogram< ValueType, BinSizeType >::valueToBin().