STIRA  0.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
stira::histogram::HistogramMaster< T > Class Template Referenceabstract

simple histogram class More...

#include <HistogramMaster.h>

Public Member Functions

void AddDataPoint (int valueToAdd, int bandNr=0)
 adds a value to the histogram This is a generalization of AddOneToBin, since here also bin sizes not equal to one can be used; the bin number will be calculated depending on the bin size and then one will be added to that bin. More...
 
void SetBinsToZero ()
 set all bins to zero
 
GetBinValue (int bandNr, int binNr) const
 gets nr of counts in given bin nr for a given band nr if the macro USE_SAFE is defined, we use the version with boundary checking, else we use the fast (unsafe) call to get the data from the array More...
 
GetBinValueSafe (int bandNr, int binNr) const
 gets nr of counts in given bin nr for a given band nr Specific safe call for above with extra boundary checking More...
 
int GetNrOfBins () const
 Gets nr of bins in the histogram For now, we assume bin size is 1, so the number of bins is the data range mRange.
 
int GetNrOfBands () const
 Gets nr of bands in the histogram.
 
virtual bool Write (std::string fileName)=0
 for diagnostics, write histogram to file To be implemented by child classes More...
 
int GetNrOfCounts () const
 Gets total nr of counts in the histogram This number is the number of pixels in the image that were counted. We don't count the same pixel over and over again for different bands in the image; we just assume that the ROI for which the histogram was computed is the same for all bands in an image.
 
GetBinSize () const
 Gets the width of a histogram bin.
 
GetDataMinimum () const
 Gets the minimum of the data range.
 
GetDataMaximum () const
 Gets the maximum of the data range.
 
void SetBinValue (int bandNr, int binNr, T value)
 sets nr of counts in given bin nr for a given band nr if the macro USE_SAFE is defined, we use the version with boundary checking, else we use the fast (unsafe) call to get the data from the array More...
 

Protected Member Functions

void AddOneToBin (int bandNr, int binNr)
 adds one count in given bin nr for a given band nr if the macro USE_SAFE is defined, we use the version with boundary checking, else we use the fast (unsafe) call to get the data from the array More...
 
void AddOneToBinSafe (int bandNr, int binNr)
 adds one count in given bin nr for a given band nr Specific safe call for above with extra boundary checking More...
 
void AddOneToBin (int binNr)
 adds one count in given bin nr in case there is just a single band if the macro USE_SAFE is defined, we use the version with boundary checking, else we use the fast (unsafe) call to get the data from the array More...
 
void AddOneToBinSafe (int binNr)
 adds one count in given bin nr in case there is just a single band Specific safe call for above with extra boundary checking More...
 
 HistogramMaster ()
 constructor only to be called from child classes
 
 HistogramMaster (const HistogramMaster &pHistogram)
 Copy constructor. More...
 
virtual ~HistogramMaster ()
 destructor only to be called from child classes
 
void Initialize (T binSize, int nrOfBands, T minValue, T maxValue)
 Initializes member variables and creates and initializes histogram data structure Creation and initialization of the histogram data structure is done by calling CreateInitializedDataStructure, which does not initialize the other member variables. More...
 
void CreateInitializedDataStructure ()
 Just creates and initializes histogram data structure does not initialize the other member variables.
 
void SetBinValueSafe (int bandNr, int binNr, T value)
 sets nr of counts in given bin nr for a given band nr Specific safe call for above with extra boundary checking More...
 

Protected Attributes

T ** mpHistogram
 the actual histogram (we count nr of intensities per colour band)
 
mBinSize
 size of histogram bin
 
int mNrOfBands
 nr of bands in image
 
int mNrOfBins
 nr of bins in histogram
 
int mNrOfCounts
 nr of pixels in image = nr of counts in histogram per band
 
mMin
 min intensity in histogram
 
mMax
 max intensity in histogram
 

Detailed Description

template<class T>
class stira::histogram::HistogramMaster< T >

simple histogram class

Constructor & Destructor Documentation

template<class T >
stira::histogram::HistogramMaster< T >::HistogramMaster ( const HistogramMaster< T > &  pHistogram)
protected

Member Function Documentation

template<class T >
void stira::histogram::HistogramMaster< T >::AddDataPoint ( int  valueToAdd,
int  bandNr = 0 
)
inline

adds a value to the histogram This is a generalization of AddOneToBin, since here also bin sizes not equal to one can be used; the bin number will be calculated depending on the bin size and then one will be added to that bin.

Parameters
valueToAddthe value to the histogram
binNrthe bin number to read out

References stira::histogram::HistogramMaster< T >::AddOneToBinSafe(), stira::histogram::HistogramMaster< T >::mBinSize, stira::histogram::HistogramMaster< T >::mNrOfCounts, and stira::histogram::HistogramMaster< T >::mpHistogram.

Referenced by stira::filter::LocalBinaryPattern::ComputePointLBPSymHistogram(), stira::imageanalysis::FindMaximalIncludedRectangles::Run(), stira::filter::LocalBinaryPattern::RunHistogram(), and stira::contrastenhance::HazeRemover::~HazeRemover().

template<class T >
void stira::histogram::HistogramMaster< T >::AddOneToBin ( int  bandNr,
int  binNr 
)
inlineprotected

adds one count in given bin nr for a given band nr if the macro USE_SAFE is defined, we use the version with boundary checking, else we use the fast (unsafe) call to get the data from the array

Parameters
bandNrfor multidimensional histograms, e.g. one histogram per color band in an image
binNrthe bin number to add one count to

References stira::histogram::HistogramMaster< T >::AddOneToBinSafe(), stira::histogram::HistogramMaster< T >::mNrOfCounts, and stira::histogram::HistogramMaster< T >::mpHistogram.

template<class T >
void stira::histogram::HistogramMaster< T >::AddOneToBin ( int  binNr)
inlineprotected

adds one count in given bin nr in case there is just a single band if the macro USE_SAFE is defined, we use the version with boundary checking, else we use the fast (unsafe) call to get the data from the array

Parameters
bandNrfor multidimensional histograms, e.g. one histogram per color band in an image
binNrthe bin number to add one count to

References stira::histogram::HistogramMaster< T >::AddOneToBinSafe(), stira::histogram::HistogramMaster< T >::mNrOfCounts, and stira::histogram::HistogramMaster< T >::mpHistogram.

template<class T >
void stira::histogram::HistogramMaster< T >::AddOneToBinSafe ( int  bandNr,
int  binNr 
)
inlineprotected

adds one count in given bin nr for a given band nr Specific safe call for above with extra boundary checking

Parameters
bandNrfor multidimensional histograms, e.g. one histogram per color band in an image
binNrthe bin number to add one count to

References stira::histogram::HistogramMaster< T >::mNrOfBands, stira::histogram::HistogramMaster< T >::mNrOfBins, stira::histogram::HistogramMaster< T >::mNrOfCounts, and stira::histogram::HistogramMaster< T >::mpHistogram.

Referenced by stira::histogram::HistogramMaster< T >::AddDataPoint(), and stira::histogram::HistogramMaster< T >::AddOneToBin().

template<class T >
void stira::histogram::HistogramMaster< T >::AddOneToBinSafe ( int  binNr)
inlineprotected

adds one count in given bin nr in case there is just a single band Specific safe call for above with extra boundary checking

Parameters
bandNrfor multidimensional histograms, e.g. one histogram per color band in an image
binNrthe bin number to add one count to

References stira::histogram::HistogramMaster< T >::mNrOfBands, stira::histogram::HistogramMaster< T >::mNrOfBins, stira::histogram::HistogramMaster< T >::mNrOfCounts, and stira::histogram::HistogramMaster< T >::mpHistogram.

template<class T >
T stira::histogram::HistogramMaster< T >::GetBinValue ( int  bandNr,
int  binNr 
) const
inline
template<class T >
T stira::histogram::HistogramMaster< T >::GetBinValueSafe ( int  bandNr,
int  binNr 
) const
inline

gets nr of counts in given bin nr for a given band nr Specific safe call for above with extra boundary checking

Parameters
bandNrfor multidimensional histograms, e.g. one histogram per color band in an image
binNrthe bin number to read out

References stira::histogram::HistogramMaster< T >::mNrOfBands, stira::histogram::HistogramMaster< T >::mNrOfBins, and stira::histogram::HistogramMaster< T >::mpHistogram.

Referenced by stira::histogram::HistogramMaster< T >::GetBinValue().

template<class T>
void stira::histogram::HistogramMaster< T >::Initialize ( binSize,
int  nrOfBands,
minValue,
maxValue 
)
protected

Initializes member variables and creates and initializes histogram data structure Creation and initialization of the histogram data structure is done by calling CreateInitializedDataStructure, which does not initialize the other member variables.

Parameters
binSizethe width of a histogram bin
nrOfBandsnr of spectral bands in an image
minValueminimum value represented in the histogram
maxValuemaximum value represented in the histogram

References stira::histogram::HistogramMaster< T >::CreateInitializedDataStructure(), stira::histogram::HistogramMaster< T >::mBinSize, stira::histogram::HistogramMaster< T >::mMax, stira::histogram::HistogramMaster< T >::mMin, stira::histogram::HistogramMaster< T >::mNrOfBands, stira::histogram::HistogramMaster< T >::mNrOfBins, and stira::histogram::HistogramMaster< T >::mNrOfCounts.

template<class T>
void stira::histogram::HistogramMaster< T >::SetBinValue ( int  bandNr,
int  binNr,
value 
)
inline

sets nr of counts in given bin nr for a given band nr if the macro USE_SAFE is defined, we use the version with boundary checking, else we use the fast (unsafe) call to get the data from the array

Parameters
bandNrfor multidimensional histograms, e.g. one histogram per color band in an image
binNrthe bin number to write a value in

References stira::histogram::HistogramMaster< T >::mpHistogram, and stira::histogram::HistogramMaster< T >::SetBinValueSafe().

Referenced by stira::histogram::FloatHistogram::ComputeJensenShannonMetric(), and stira::histogram::JointHistogram::GetNrOfVerticalBins().

template<class T>
void stira::histogram::HistogramMaster< T >::SetBinValueSafe ( int  bandNr,
int  binNr,
value 
)
inlineprotected

sets nr of counts in given bin nr for a given band nr Specific safe call for above with extra boundary checking

Parameters
bandNrfor multidimensional histograms, e.g. one histogram per color band in an image
binNrthe bin number to write a value in

References stira::histogram::HistogramMaster< T >::mNrOfBands, stira::histogram::HistogramMaster< T >::mNrOfBins, and stira::histogram::HistogramMaster< T >::mpHistogram.

Referenced by stira::histogram::HistogramMaster< T >::SetBinValue().

template<class T>
virtual bool stira::histogram::HistogramMaster< T >::Write ( std::string  fileName)
pure virtual

for diagnostics, write histogram to file To be implemented by child classes

Parameters
fileNamename of file to write to

Implemented in stira::histogram::IntHistogram, and stira::histogram::FloatHistogram.


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