# Histogram

### Description

Histogram is basically a double array, but it contains some useful methods and meta information, which makes it a perfect data structure to store information about frequencies of numeric values, e.g. frequency of image pixel values.

Each histogram has a domain start and a bin size. These values determine what range of actual X coordinates is represented by each bin of the histogram. It is worth mentioning that the bin size of a histogram has to be a positive number as a size less then or equal to zero is not supported. Infinite values in the domain start and bin size bin size are also not supported (An attempt to set one of those variables to an incorrect value will result in an error). Additionally, infinite/NaN values in the bins of the histogram can cause filters to compute incorrect results and thus such values should be used with caution.

class Histogram : public Array< double > { private: float domainStart; float binSize; public: Histogram(); Histogram(float start, float end, float size); Histogram(float start, float size, int count); Histogram(float start, float size, void* data, int count); int Size() const; void Reserve( int newCapacity ); double* Begin(); double* End(); const double* Begin(); const double* End(); float DomainStart() const; void SetDomainStart(float begin); void SetDomainStartOf(const avl::Histogram& other); float BinSize() const; void SetBinSize(float newBinSize); void SetBinSizeOf(const avl::Histogram& other); int BinCount() const; void SetBinCount(int newBinCount); void SetBinCountOf(const avl::Histogram& other); float DomainLength() const; float DomainEnd() const; };