STIRA
0.1
|
simple histogram class WARNING: currently only works for default case when bin size is 1 More...
#include <IntHistogram.h>
Public Member Functions | |
IntHistogram (Image *pImage, bool useDataMinMax, double lowerFraction=0.01, double upperFraction=0.99, int binsize=1, ArrayGrid< bool > *pMaskGrid=0) | |
constructor More... | |
IntHistogram (Image *pImage, bool useDataMinMax, common::RectangularROI< int > rroi, double lowerFraction=0.01, double upperFraction=0.99, int binsize=1) | |
constructor More... | |
IntHistogram (ArrayGrid< double > *pGrid, bool useDataMinMax, double lowerFraction=0.01, double upperFraction=0.99, int binsize=1, ArrayGrid< bool > *pMaskGrid=0) | |
constructor More... | |
IntHistogram (ArrayGrid< double > *pGrid, bool useDataMinMax, common::RectangularROI< int > rroi, double lowerFraction=0.01, double upperFraction=0.99, int binsize=1) | |
constructor More... | |
IntHistogram (double binSize, int nrOfBands, int minValue, int maxValue, double lowerFraction=0.01, double upperFraction=0.99) | |
constructor More... | |
virtual | ~IntHistogram () |
destructor | |
IntHistogram (const IntHistogram &pHistogram) | |
Copy constructor. More... | |
IntHistogram * | Clone () |
Creates a clone of this arraygrid This clone becomes the responsability of the caller to delete. | |
bool | UpdateHistogram (IntHistogram *pIntHistogram, double alpha) |
double | GetLowerFraction () |
gets lower fraction when the lower fraction is 5%, it means that we consider the 5% of the pixels with smallest intensities | |
void | SetLowerFraction (double myFraction) |
sets lower fraction when the lower fraction is 5%, it means that we consider the 5% of the pixels with smallest intensities More... | |
double | GetLowerBound (int bandNr=0) |
gets lower bound for given band nr The lower bound depends on the lower fraction: when the lower fraction is 5%, the lower bound is that image band intensity that 5% of the pixels has an intensity (in the given band) smaller than the lower bound More... | |
double | GetUpperFraction () |
gets lower fraction when the upper fraction is 95%, it means that we consider the 95% of the pixels with smallest intensities | |
void | SetUpperFraction (double myFraction) |
sets upper fraction when the upper fraction is 95%, it means that we consider the 95% of the pixels with smallest intensities More... | |
double | GetUpperBound (int bandNr=0) |
gets upper bound for given band nr The upper bound depends on the upper fraction: when the upper fraction is 95%, the upper bound is that image band intensity that 95% of the pixels has an intensity (in the given band) smaller than the lower bound More... | |
double | GetQuantile (int bandNr, double probability) |
Gets the quantile value for a given probability I.e., if we give as probability 0.25, this function will return where in the histogram you reach the point that 25% of the samples are below this point Is actually the same as GetLowerBound for a given LowerFraction and GetUpperBound for a given UpperFraction. | |
void | ConvertInCumulativeHistogram () |
converts histogram data to cumulative histogram | |
virtual bool | Write (std::string fileName) |
for diagnostics, write histogram to file To be implemented by child classes More... | |
bool | DetermineBounds (int bandNr=0) |
determines bound of histogram where lower fraction and upper fraction of the histogram are situated | |
Public Member Functions inherited from stira::histogram::HistogramMaster< int > | |
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 | |
int | 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... | |
int | 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. | |
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. | |
int | GetBinSize () const |
Gets the width of a histogram bin. | |
int | GetDataMinimum () const |
Gets the minimum of the data range. | |
int | GetDataMaximum () const |
Gets the maximum of the data range. | |
void | SetBinValue (int bandNr, int binNr, intvalue) |
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... | |
Additional Inherited Members | |
Protected Member Functions inherited from stira::histogram::HistogramMaster< int > | |
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 | 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 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 | 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 (intbinSize, int nrOfBands, intminValue, intmaxValue) |
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, intvalue) |
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 inherited from stira::histogram::HistogramMaster< int > | |
int ** | mpHistogram |
the actual histogram (we count nr of intensities per colour band) | |
int | 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 | |
int | mMin |
min intensity in histogram | |
int | mMax |
max intensity in histogram | |
simple histogram class WARNING: currently only works for default case when bin size is 1
stira::histogram::IntHistogram::IntHistogram | ( | Image * | pImage, |
bool | useDataMinMax, | ||
double | lowerFraction = 0.01 , |
||
double | upperFraction = 0.99 , |
||
int | binsize = 1 , |
||
ArrayGrid< bool > * | pMaskGrid = 0 |
||
) |
constructor
Constructs object and builds the histogram based on the input parameters. After construction, the histogram is ready to be used
pImage | input image for which to construct the histogram |
lowerFraction | percentage of pixels with lowest intensities; to be ignored |
upperFraction | (1 -upperFraction) is percentage of pixels with highest intensities to be ignored |
binsize | size for a histogram bin |
pMaskGrid | grid which pixels are taken into account (true) and which need to be ignored (false) |
References stira::imagedata::Image::GetNumberOfBands().
stira::histogram::IntHistogram::IntHistogram | ( | Image * | pImage, |
bool | useDataMinMax, | ||
common::RectangularROI< int > | rroi, | ||
double | lowerFraction = 0.01 , |
||
double | upperFraction = 0.99 , |
||
int | binsize = 1 |
||
) |
constructor
Constructs object and builds the histogram based on the input parameters. After construction, the histogram is ready to be used
pImage | input image for which to construct the histogram |
rroi | the rectangular Region Of Interest for which to build the histogram |
lowerFraction | percentage of pixels with lowest intensities; to be ignored |
upperFraction | (1 -upperFraction) is percentage of pixels with highest intensities to be ignored |
binsize | size for a histogram bin |
pMaskGrid | grid which pixels are taken into account (true) and which need to be ignored (false) |
References stira::imagedata::Image::GetNumberOfBands().
stira::histogram::IntHistogram::IntHistogram | ( | ArrayGrid< double > * | pGrid, |
bool | useDataMinMax, | ||
double | lowerFraction = 0.01 , |
||
double | upperFraction = 0.99 , |
||
int | binsize = 1 , |
||
ArrayGrid< bool > * | pMaskGrid = 0 |
||
) |
constructor
Constructs object and builds the histogram based on the input parameters. After construction, the histogram is ready to be used
pGrid | input grid |
lowerFraction | lower fraction of pixel to set |
upperFraction | upper fraction of pixel to set |
binsize | size of bin |
pMaskGrid | boolean grid which pixels to count (at position with true) and which to ignore (at position with false) |
References stira::imagedata::GridStatistics< T >::GetMinMax().
stira::histogram::IntHistogram::IntHistogram | ( | ArrayGrid< double > * | pGrid, |
bool | useDataMinMax, | ||
common::RectangularROI< int > | rroi, | ||
double | lowerFraction = 0.01 , |
||
double | upperFraction = 0.99 , |
||
int | binsize = 1 |
||
) |
constructor
Constructs object and builds the histogram based on the input parameters. After construction, the histogram is ready to be used
pGrid | input grid for which to construct the histogram |
rroi | the rectangular Region Of Interest for which to build the histogram |
lowerFraction | lower percentile divided by 100 (value between 0 and 1) of pixels; pixels with lower intensities will be ignored |
upperFraction | upper percentile divided by 100 (value between 0 and 1) of pixels; pixels with higher intensities will be ignored |
binsize | size for a histogram bin |
pMaskGrid | grid which pixels are taken into account (true) and which need to be ignored (false) |
References stira::imagedata::GridStatistics< T >::GetMinMax().
stira::histogram::IntHistogram::IntHistogram | ( | double | binSize, |
int | nrOfBands, | ||
int | minValue, | ||
int | maxValue, | ||
double | lowerFraction = 0.01 , |
||
double | upperFraction = 0.99 |
||
) |
constructor
Constructs object and builds an empty histogram based on the input parameters. After construction, the histogram is initialized with all bins to 0
binSize | width of a single bin |
nrOfBands | number of bands (usually 3 (color images) or 1 (gray image)) |
minValue | minimum value in the histogram |
maxValue | maximum value in the histogram |
|
inline |
Copy constructor.
pHistogram | histogram from which to initialize this new histogram |
double stira::histogram::IntHistogram::GetLowerBound | ( | int | bandNr = 0 | ) |
gets lower bound for given band nr The lower bound depends on the lower fraction: when the lower fraction is 5%, the lower bound is that image band intensity that 5% of the pixels has an intensity (in the given band) smaller than the lower bound
bandNr | nr of band |
Referenced by stira::contrastenhance::HistogramTools::RobustLinearRescaleNoNew(), stira::contrastenhance::AdaptiveEnhanceLuong::SetWindowSize(), and stira::contrastenhance::Retinex::~Retinex().
double stira::histogram::IntHistogram::GetUpperBound | ( | int | bandNr = 0 | ) |
gets upper bound for given band nr The upper bound depends on the upper fraction: when the upper fraction is 95%, the upper bound is that image band intensity that 95% of the pixels has an intensity (in the given band) smaller than the lower bound
bandNr | nr of band |
Referenced by stira::contrastenhance::HistogramTools::RobustLinearRescaleNoNew(), stira::contrastenhance::AdaptiveEnhanceLuong::SetWindowSize(), stira::contrastenhance::HazeRemover::~HazeRemover(), and stira::contrastenhance::Retinex::~Retinex().
void stira::histogram::IntHistogram::SetLowerFraction | ( | double | myFraction | ) |
sets lower fraction when the lower fraction is 5%, it means that we consider the 5% of the pixels with smallest intensities
myFraction | fraction of the pixels |
void stira::histogram::IntHistogram::SetUpperFraction | ( | double | myFraction | ) |
sets upper fraction when the upper fraction is 95%, it means that we consider the 95% of the pixels with smallest intensities
myFraction | the upper fraction |
|
virtual |
for diagnostics, write histogram to file To be implemented by child classes
fileName | name of file to write to |
Implements stira::histogram::HistogramMaster< int >.
References stira::common::MathUtils::ClipValue(), stira::imagedata::Image::GetBands(), stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::ArrayGrid< T >::GetValue(), and stira::imagedata::ArrayGrid< T >::GetWidth().
Referenced by stira::contrastenhance::Retinex::~Retinex().