STIRA
0.1
|
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 | |
T | 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... | |
T | 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. | |
T | GetBinSize () const |
Gets the width of a histogram bin. | |
T | GetDataMinimum () const |
Gets the minimum of the data range. | |
T | 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) | |
T | 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 | |
T | mMin |
min intensity in histogram | |
T | mMax |
max intensity in histogram | |
simple histogram class
|
protected |
Copy constructor.
pHistogram | histogram from which to initialize this new histogram |
References stira::histogram::HistogramMaster< T >::GetBinSize(), stira::histogram::HistogramMaster< T >::GetBinValue(), stira::histogram::HistogramMaster< T >::GetDataMaximum(), stira::histogram::HistogramMaster< T >::GetDataMinimum(), stira::histogram::HistogramMaster< T >::GetNrOfBands(), stira::histogram::HistogramMaster< T >::GetNrOfBins(), stira::histogram::HistogramMaster< T >::GetNrOfCounts(), 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, stira::histogram::HistogramMaster< T >::mNrOfCounts, and stira::histogram::HistogramMaster< T >::mpHistogram.
|
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.
valueToAdd | the value to the histogram |
binNr | the 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().
|
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
bandNr | for multidimensional histograms, e.g. one histogram per color band in an image |
binNr | the bin number to add one count to |
References stira::histogram::HistogramMaster< T >::AddOneToBinSafe(), stira::histogram::HistogramMaster< T >::mNrOfCounts, and stira::histogram::HistogramMaster< T >::mpHistogram.
|
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
bandNr | for multidimensional histograms, e.g. one histogram per color band in an image |
binNr | the bin number to add one count to |
References stira::histogram::HistogramMaster< T >::AddOneToBinSafe(), stira::histogram::HistogramMaster< T >::mNrOfCounts, and stira::histogram::HistogramMaster< T >::mpHistogram.
|
inlineprotected |
adds one count in given bin nr for a given band nr Specific safe call for above with extra boundary checking
bandNr | for multidimensional histograms, e.g. one histogram per color band in an image |
binNr | the 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().
|
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
bandNr | for multidimensional histograms, e.g. one histogram per color band in an image |
binNr | the 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.
|
inline |
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
bandNr | for multidimensional histograms, e.g. one histogram per color band in an image |
binNr | the bin number to read out |
References stira::histogram::HistogramMaster< T >::GetBinValueSafe(), and stira::histogram::HistogramMaster< T >::mpHistogram.
Referenced by stira::histogram::IntHistogram::Clone(), stira::histogram::FloatHistogram::ComputeIDivergence(), stira::histogram::FloatHistogram::ComputeJensenShannonMetric(), stira::imagetools::NumberGridTools< T >::ComputeLocalMutualInformation(), stira::histogram::FloatHistogram::ComputeStandardKullbackLeiblerDistance(), stira::histogram::FloatHistogram::ComputeSymmetricKullbackLeiblerDistance(), stira::histogram::FloatHistogram::FloatHistogram(), stira::contrastenhance::HistogramTools::HistogramEqualizeSingleBand(), stira::histogram::HistogramMaster< T >::HistogramMaster(), stira::histogram::FloatHistogram::InitializeWithNormalizedCumulativeHistogram(), stira::histogram::FloatHistogram::InitializeWithNormalizedHistogram(), stira::contrastenhance::HistogramTools::MatchHistogramValue(), and stira::contrastenhance::AdaptiveHistogramEqualizer::Run().
|
inline |
gets nr of counts in given bin nr for a given band nr Specific safe call for above with extra boundary checking
bandNr | for multidimensional histograms, e.g. one histogram per color band in an image |
binNr | the 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().
|
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.
binSize | the width of a histogram bin |
nrOfBands | nr of spectral bands in an image |
minValue | minimum value represented in the histogram |
maxValue | maximum 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.
|
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
bandNr | for multidimensional histograms, e.g. one histogram per color band in an image |
binNr | the 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().
|
inlineprotected |
sets nr of counts in given bin nr for a given band nr Specific safe call for above with extra boundary checking
bandNr | for multidimensional histograms, e.g. one histogram per color band in an image |
binNr | the 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().
|
pure virtual |
for diagnostics, write histogram to file To be implemented by child classes
fileName | name of file to write to |
Implemented in stira::histogram::IntHistogram, and stira::histogram::FloatHistogram.