ITK
5.0.0
Insight Segmentation and Registration Toolkit
|
#include <itkHistogram.h>
This class stores measurement vectors in the context of n-dimensional histogram.
Histogram represents an ND histogram. Histogram bins can be regularly or irregularly spaced. The storage for the histogram is managed via the FrequencyContainer specified by the template argument. The default frequency container is a DenseFrequencyContainer. A SparseFrequencyContainer can be used as an alternative.
Frequencies of a bin (SetFrequency(), IncreaseFrequency()) can be specified by measurement, index, or instance identifier.
Measurements can be queried by bin index or instance identifier. In this case, the measurement returned is the centroid of the histogram bin.
The Initialize() method is used to specify the number of bins for each dimension of the histogram. An overloaded version also allows for regularly spaced bins to defined. To define irregularly sized bins, use the SetBinMin()/SetBinMax() methods.
If you do not know the length of the measurement vector at compile time, you should use the VariableDimensionHistogram class, instead of the Histogram class.
If you know the length of the measurement vector at compile time, it can conveniently be obtained from MeasurementVectorTraits. For instance, instantiate a histogram as below:
Definition at line 77 of file itkHistogram.h.
Classes | |
class | ConstIterator |
class | Iterator |
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from itk::DataObject | |
static bool | GetGlobalReleaseDataFlag () |
static void | GlobalReleaseDataFlagOff () |
static void | GlobalReleaseDataFlagOn () |
static void | SetGlobalReleaseDataFlag (bool val) |
Static Public Member Functions inherited from itk::Object | |
static bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOff () |
static void | GlobalWarningDisplayOn () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool flag) |
Static Public Member Functions inherited from itk::LightObject | |
static void | BreakOnError () |
static Pointer | New () |
Protected Member Functions | |
Histogram () | |
void | PrintSelf (std::ostream &os, Indent indent) const override |
~Histogram () override=default | |
Protected Member Functions inherited from itk::Statistics::Sample< Array< TMeasurement > > | |
void | PrintSelf (std::ostream &os, Indent indent) const override |
Sample () | |
~Sample () override=default | |
Protected Member Functions inherited from itk::DataObject | |
DataObject () | |
virtual void | PropagateResetPipeline () |
~DataObject () override | |
Protected Member Functions inherited from itk::Object | |
Object () | |
bool | PrintObservers (std::ostream &os, Indent indent) const |
virtual void | SetTimeStamp (const TimeStamp &time) |
~Object () override | |
Protected Member Functions inherited from itk::LightObject | |
virtual LightObject::Pointer | InternalClone () const |
LightObject () | |
virtual void | PrintHeader (std::ostream &os, Indent indent) const |
virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
virtual | ~LightObject () |
Protected Attributes | |
SizeType | m_Size |
Protected Attributes inherited from itk::LightObject | |
std::atomic< int > | m_ReferenceCount |
Private Types | |
using | OffsetTableType = std::vector< InstanceIdentifier > |
Private Member Functions | |
void | Initialize () override |
Private Attributes | |
bool | m_ClipBinsAtEnds {true} |
FrequencyContainerPointer | m_FrequencyContainer |
std::vector< std::vector < MeasurementType > > | m_Max |
std::vector< std::vector < MeasurementType > > | m_Min |
unsigned int | m_NumberOfInstances {0} |
OffsetTableType | m_OffsetTable |
IndexType | m_TempIndex |
MeasurementVectorType | m_TempMeasurementVector |
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::AbsoluteFrequencyType = typename FrequencyContainerType::AbsoluteFrequencyType |
Frequency and TotalFrequency value type from superclass
Definition at line 113 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::ArrayType = Array< TMeasurement > |
Definition at line 84 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::BinMaxContainerType = std::vector< BinMaxVectorType > |
Definition at line 130 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::BinMaxVectorType = std::vector< MeasurementType > |
Definition at line 128 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::BinMinContainerType = std::vector< BinMinVectorType > |
Definition at line 129 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::BinMinVectorType = std::vector< MeasurementType > |
bin min max value storage types
Definition at line 127 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::ConstPointer = SmartPointer< const Self > |
Definition at line 90 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::FrequencyContainerPointer = typename FrequencyContainerType::Pointer |
Definition at line 110 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::FrequencyContainerType = TFrequencyContainer |
frequency container type alias
Definition at line 109 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::IndexType = Array< ::itk::IndexValueType > |
Index type alias support An index is used to access pixel values.
Definition at line 119 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::IndexValueType = typename IndexType::ValueType |
Definition at line 120 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::InstanceIdentifier = typename Superclass::InstanceIdentifier |
Definition at line 103 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::MeasurementType = TMeasurement |
type of an element of a measurement vector
Definition at line 99 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::MeasurementVectorSizeType = typename Superclass::MeasurementVectorSizeType |
Definition at line 104 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::MeasurementVectorType = typename Superclass::MeasurementVectorType |
Common sample class type alias
Definition at line 102 of file itkHistogram.h.
|
private |
Definition at line 474 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::Pointer = SmartPointer< Self > |
Definition at line 89 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::RelativeFrequencyType = typename FrequencyContainerType::RelativeFrequencyType |
Definition at line 115 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::Self = Histogram |
Standard type alias
Definition at line 87 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SizeType = Array< ::itk::SizeValueType > |
size array type
Definition at line 123 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SizeValueType = typename SizeType::ValueType |
Definition at line 124 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::Superclass = Sample< ArrayType > |
Definition at line 88 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::TotalAbsoluteFrequencyType = typename FrequencyContainerType::TotalAbsoluteFrequencyType |
Definition at line 114 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::TotalRelativeFrequencyType = typename FrequencyContainerType::TotalRelativeFrequencyType |
Definition at line 116 of file itkHistogram.h.
using itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::ValueType = MeasurementVectorType |
Definition at line 106 of file itkHistogram.h.
|
protected |
|
overrideprotecteddefault |
|
inline |
Definition at line 442 of file itkHistogram.h.
|
inline |
Definition at line 454 of file itkHistogram.h.
|
virtual |
Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.
Reimplemented from itk::Object.
|
inline |
Definition at line 449 of file itkHistogram.h.
|
inline |
Definition at line 461 of file itkHistogram.h.
const MeasurementType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetBinMax | ( | unsigned int | dimension, |
InstanceIdentifier | nbin | ||
) | const |
Get the maximum value of nth bin of dimension d
const MeasurementType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetBinMaxFromValue | ( | unsigned int | dimension, |
float | value | ||
) | const |
Get the maximum of the bin along dimension d corresponding to a particular measurement.
const MeasurementType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetBinMin | ( | unsigned int | dimension, |
InstanceIdentifier | nbin | ||
) | const |
Get the minimum value of nth bin of dimension d
const MeasurementType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetBinMinFromValue | ( | unsigned int | dimension, |
float | value | ||
) | const |
Get the minimum of the bin along dimension d corresponding to a particular measurement.
|
virtual |
Is set to false if the bins at edges of the histogram extend to +/- infinity.
const BinMaxVectorType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetDimensionMaxs | ( | unsigned int | dimension | ) | const |
Get the vector of maximums along a dimension
const BinMinVectorType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetDimensionMins | ( | unsigned int | dimension | ) | const |
Get the vector of bin minimums along a dimension
|
override |
Get the frequency of an instance identifier
AbsoluteFrequencyType itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetFrequency | ( | const IndexType & | index | ) | const |
Get the frequency of an index
AbsoluteFrequencyType itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetFrequency | ( | InstanceIdentifier | n, |
unsigned int | dimension | ||
) | const |
Get the frequency of a dimension's nth element.
const MeasurementVectorType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetHistogramMaxFromIndex | ( | const IndexType & | index | ) | const |
Get the maximums of the bin corresponding to a particular index
const MeasurementVectorType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetHistogramMinFromIndex | ( | const IndexType & | index | ) | const |
Get the minimums of the bin corresponding to a particular index
bool itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetIndex | ( | const MeasurementVectorType & | measurement, |
IndexType & | index | ||
) | const |
Get the index of histogram corresponding to the specified measurement value. Returns true if index is valid and false if the measurement is outside the histogram
const IndexType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetIndex | ( | InstanceIdentifier | id | ) | const |
Get the index that is uniquely labelled by an instance identifier The corresponding id is the offset of the index This method uses ImageBase::ComputeIndex() method
InstanceIdentifier itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetInstanceIdentifier | ( | const IndexType & | index | ) | const |
Get the instance identifier of the bin that is indexed by the index. The corresponding instance identifier is the offset of the index This method uses ImageBase::ComputeIndex() method
const BinMaxContainerType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetMaxs | ( | ) | const |
Method the maximums of the bins
MeasurementType itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetMeasurement | ( | InstanceIdentifier | n, |
unsigned int | dimension | ||
) | const |
Get the measurement a bin along a specified dimension. This is the midpoint of the bin along that dimension.
|
override |
Get the measurement of an instance identifier. This is the centroid of the bin.
const MeasurementVectorType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetMeasurementVector | ( | const IndexType & | index | ) | const |
Get the measurement of an index. This is the centroid of the bin.
const BinMinContainerType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetMins | ( | ) | const |
Get the minimums of the bins
|
virtual |
Run-time type information (and related methods).
Reimplemented from itk::Statistics::Sample< Array< TMeasurement > >.
const SizeType& itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetSize | ( | ) | const |
Get the size (N-dimensional) of the histogram
SizeValueType itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::GetSize | ( | unsigned int | dimension | ) | const |
Get the size of histogram along a specified dimension
|
overridevirtual |
Get the total frequency in the histogram
Implements itk::Statistics::Sample< Array< TMeasurement > >.
|
overridevirtual |
Method to graft another histogram's output
Reimplemented from itk::DataObject.
bool itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::IncreaseFrequency | ( | InstanceIdentifier | id, |
AbsoluteFrequencyType | value | ||
) |
Increase the frequency of an instance identifier. Frequency is increased by the specified value. Returns false if the bin is out of bounds.
bool itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::IncreaseFrequencyOfIndex | ( | const IndexType & | index, |
AbsoluteFrequencyType | value | ||
) |
Increase the frequency of an index. Frequency is increased by the specified value. Returns false if the bin is out of bounds.
bool itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::IncreaseFrequencyOfMeasurement | ( | const MeasurementVectorType & | measurement, |
AbsoluteFrequencyType | value | ||
) |
Increase the frequency of a measurement. Frequency is increased by the specified value. Returns false if the measurement is outside the bounds of the histogram.
void itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::Initialize | ( | const SizeType & | size | ) |
Initialize the histogram, generating the offset table and preparing the frequency container. Subclasses should call this method in their Initialize() method.
void itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::Initialize | ( | const SizeType & | size, |
MeasurementVectorType & | lowerBound, | ||
MeasurementVectorType & | upperBound | ||
) |
Initialize the histogram using equal size bins. To assign bin's min and max values along each dimension use SetBinMin() and SetBinMax() functions.
|
inlineoverrideprivatevirtual |
Restore the data object to its initial state. This means releasing memory.
Reimplemented from itk::DataObject.
Definition at line 481 of file itkHistogram.h.
bool itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::IsIndexOutOfBounds | ( | const IndexType & | index | ) | const |
Returns true if the given index is out of bound meaning one of index is not between [0, last index]
double itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::Mean | ( | unsigned int | dimension | ) | const |
Get the mean value for a dimension
|
static |
standard New() method support
|
overrideprotectedvirtual |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from itk::DataObject.
double itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::Quantile | ( | unsigned int | dimension, |
double | p | ||
) | const |
Get the pth percentile value for a dimension.
Let assume n = the index of the bin where the p-th percentile value is, min = min value of the dimension of the bin, max = max value of the dimension of the bin, interval = max - min , pp = cumlated proportion until n-1 bin; and pb = frequency of the bin / total frequency of the dimension. If p is less than 0.5, the percentile value = min + ((p - pp ) / pb) * interval If p is greater than or equal to 0.5 the percentile value = max - ((pp - p) / pb) * interval
void itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SetBinMax | ( | unsigned int | dimension, |
InstanceIdentifier | nbin, | ||
MeasurementType | max | ||
) |
Set the maximum value of nth bin of dimension d
void itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SetBinMin | ( | unsigned int | dimension, |
InstanceIdentifier | nbin, | ||
MeasurementType | min | ||
) |
Set the minimum value of nth bin of dimension d
|
virtual |
Set to false to have the bins at edges of the histogram extend to +/- infinity.
void itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SetFrequency | ( | AbsoluteFrequencyType | value | ) |
Set all the bins in the histogram to a specified frequency
bool itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SetFrequency | ( | InstanceIdentifier | id, |
AbsoluteFrequencyType | value | ||
) |
Set the frequency of an instance identifier. Returns false if the bin is out of bounds.
bool itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SetFrequencyOfIndex | ( | const IndexType & | index, |
AbsoluteFrequencyType | value | ||
) |
Set the frequency of an index. Returns false if the bin is out of bounds.
bool itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SetFrequencyOfMeasurement | ( | const MeasurementVectorType & | measurement, |
AbsoluteFrequencyType | value | ||
) |
Set the frequency of a measurement. Returns false if the bin is out of bounds.
void itk::Statistics::Histogram< TMeasurement, TFrequencyContainer >::SetToZero | ( | ) |
Initialize the values of the histogram bins to zero
|
overridevirtual |
Returns the number of instances (bins or cells) in this container
Implements itk::Statistics::Sample< Array< TMeasurement > >.
|
private |
Definition at line 492 of file itkHistogram.h.
|
private |
Definition at line 476 of file itkHistogram.h.
|
private |
Definition at line 487 of file itkHistogram.h.
|
private |
Definition at line 484 of file itkHistogram.h.
|
private |
Definition at line 477 of file itkHistogram.h.
|
private |
Definition at line 475 of file itkHistogram.h.
|
protected |
Definition at line 471 of file itkHistogram.h.
|
mutableprivate |
Definition at line 490 of file itkHistogram.h.
|
mutableprivate |
Definition at line 489 of file itkHistogram.h.