template<typename TImageType, typename THistogramFrequencyContainer = DenseFrequencyContainer2>
class itk::Statistics::ScalarImageToRunLengthMatrixFilter< TImageType, THistogramFrequencyContainer >
This class computes a run length matrix (histogram) from a given image and a mask image if provided. Run length matrices are used for image texture description.
This filters creates a grey-level run length matrix from a N-D scalar image. This is another possible texture description. See the following references. M. M. Galloway. Texture analysis using gray level run lengths. Computer Graphics and Image Processing, 4:172-179, 1975.
A. Chu, C. M. Sehgal, and J. F. Greenleaf. Use of gray value distribution of run lengths for texture analysis. Pattern Recognition Letters, 11:415-420, 1990.
B. R. Dasarathy and E. B. Holder. Image characterizations based on joint gray-level run-length distributions. Pattern Recognition Letters, 12:490-502, 1991.
The basic idea is as follows: Given an image and an offset (e.g. (1, -1) for a 2-d image), each element in the joint histogram describes the frequency for a particular distance/ intensity pair within a given image. This distance/intensity pair can be described as follows: we start at a given voxel which has some intensity. We then "jump" to neighboring pixels in increments provided by the offset(s) as long as the pixel to which we are jumping is within the same intensity bin as the original voxel. The distance component is given by the distance from the original to the final voxel satisfying our jumping criteria.
The offset (or offsets) along which the co-occurrences are calculated can be set by the user. Traditionally, only one offset is used per histogram, and offset components in the range [-1, 1] are used. For rotation-invariant features averages of features computed over several histograms with different offsets are generally used, instead of computing features from one histogram create with several offsets. Additionally, instead of using offsets of two or more pixels in any direction, multi-resolution techniques (e.g. image pyramids) are generally used to deal with texture at different spatial resolutions.
This class calculates a 2-d histogram of all the intensity/distance pairs in the given image's requested region, for a given set of offsets. That is, if a given offset falls outside of the requested region (or outside the mask) at a particular point, that distance/intensity pair will not be added to the matrix.
The number of histogram bins on each axis can be set (defaults to 256). Also, by default the histogram min and max corresponds to the largest and smallest possible pixel value of that pixel type. To customize the histogram bounds for a given image, the max and min pixel values that will be placed in the histogram can be set manually. NB: The min and max are INCLUSIVE.
Further, the type of histogram frequency container used is an optional template parameter. By default, a dense container is used, but for images with little texture or in cases where the user wants more histogram bins, a sparse container can be used for the histogram instead.
WARNING: This probably won't work for pixels of double or long-double type unless you set the histogram min and max manually. This is because the largest histogram bin by default has max value of the largest possible pixel value plus 1. For double and long-double types, whose "RealType" as defined by the NumericTraits class is the same, and thus cannot hold any larger values, this would cause a float overflow.
IJ article: https://doi.org/10.54294/ex0itu
- See also
- ScalarImageToRunLengthFeaturesFilter
-
HistogramToRunLengthFeaturesFilter
- Author
- : Nick Tustison
Definition at line 106 of file itkScalarImageToRunLengthMatrixFilter.h.
|
void | GenerateData () override |
|
DataObjectPointer | MakeOutput (DataObjectPointerArraySizeType idx) override |
|
void | NormalizeOffsetDirection (OffsetType &offset) |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
| ScalarImageToRunLengthMatrixFilter () |
|
| ~ScalarImageToRunLengthMatrixFilter () override=default |
|
virtual void | AddInput (DataObject *input) |
|
void | AddOptionalInputName (const DataObjectIdentifierType &) |
|
void | AddOptionalInputName (const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx) |
|
virtual void | AddOutput (DataObject *output) |
|
bool | AddRequiredInputName (const DataObjectIdentifierType &) |
|
bool | AddRequiredInputName (const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx) |
|
virtual void | CacheInputReleaseDataFlags () |
|
virtual void | GenerateData () |
|
virtual void | GenerateInputRequestedRegion () |
|
virtual void | GenerateOutputInformation () |
|
virtual void | GenerateOutputRequestedRegion (DataObject *output) |
|
DataObject * | GetInput (const DataObjectIdentifierType &key) |
|
const DataObject * | GetInput (const DataObjectIdentifierType &key) const |
|
virtual const DataObjectPointerArraySizeType & | GetNumberOfRequiredInputs () const |
|
virtual const DataObjectPointerArraySizeType & | GetNumberOfRequiredOutputs () const |
|
bool | IsIndexedInputName (const DataObjectIdentifierType &) const |
|
bool | IsIndexedOutputName (const DataObjectIdentifierType &) const |
|
bool | IsRequiredInputName (const DataObjectIdentifierType &) const |
|
DataObjectPointerArraySizeType | MakeIndexFromInputName (const DataObjectIdentifierType &name) const |
|
DataObjectPointerArraySizeType | MakeIndexFromOutputName (const DataObjectIdentifierType &name) const |
|
DataObjectIdentifierType | MakeNameFromInputIndex (DataObjectPointerArraySizeType idx) const |
|
DataObjectIdentifierType | MakeNameFromOutputIndex (DataObjectPointerArraySizeType idx) const |
|
virtual void | PopBackInput () |
|
virtual void | PopFrontInput () |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
| ProcessObject () |
|
virtual void | PropagateResetPipeline () |
|
virtual void | PushBackInput (const DataObject *input) |
|
virtual void | PushFrontInput (const DataObject *input) |
|
virtual void | ReleaseInputs () |
|
virtual void | RemoveInput (const DataObjectIdentifierType &key) |
|
virtual void | RemoveInput (DataObjectPointerArraySizeType) |
|
virtual void | RemoveOutput (const DataObjectIdentifierType &key) |
|
virtual void | RemoveOutput (DataObjectPointerArraySizeType idx) |
|
bool | RemoveRequiredInputName (const DataObjectIdentifierType &) |
|
virtual void | RestoreInputReleaseDataFlags () |
|
virtual void | SetInput (const DataObjectIdentifierType &key, DataObject *input) |
|
virtual void | SetNthInput (DataObjectPointerArraySizeType idx, DataObject *input) |
|
virtual void | SetNthOutput (DataObjectPointerArraySizeType idx, DataObject *output) |
|
void | SetNumberOfIndexedInputs (DataObjectPointerArraySizeType num) |
|
void | SetNumberOfIndexedOutputs (DataObjectPointerArraySizeType num) |
|
virtual void | SetNumberOfRequiredInputs (DataObjectPointerArraySizeType) |
|
virtual void | SetNumberOfRequiredOutputs (DataObjectPointerArraySizeType _arg) |
|
virtual void | SetOutput (const DataObjectIdentifierType &name, DataObject *output) |
|
virtual void | SetPrimaryInput (DataObject *object) |
|
virtual void | SetPrimaryOutput (DataObject *object) |
|
void | SetRequiredInputNames (const NameArray &) |
|
virtual void | VerifyInputInformation () const |
|
virtual void | VerifyPreconditions () const |
|
| ~ProcessObject () override |
|
DataObject * | GetInput (DataObjectPointerArraySizeType idx) |
|
const DataObject * | GetInput (DataObjectPointerArraySizeType idx) const |
|
DataObject * | GetPrimaryInput () |
|
const DataObject * | GetPrimaryInput () const |
|
virtual void | SetPrimaryInputName (const DataObjectIdentifierType &key) |
|
virtual const char * | GetPrimaryInputName () const |
|
DataObject * | GetOutput (const DataObjectIdentifierType &key) |
|
const DataObject * | GetOutput (const DataObjectIdentifierType &key) const |
|
virtual void | SetPrimaryOutputName (const DataObjectIdentifierType &key) |
|
virtual const char * | GetPrimaryOutputName () const |
|
DataObject * | GetOutput (DataObjectPointerArraySizeType i) |
|
const DataObject * | GetOutput (DataObjectPointerArraySizeType i) const |
|
DataObject * | GetPrimaryOutput () |
|
const DataObject * | GetPrimaryOutput () const |
|
virtual bool | GetThreaderUpdateProgress () const |
|
virtual void | ThreaderUpdateProgressOn () |
|
virtual void | SetThreaderUpdateProgress (bool arg) |
|
| Object () |
|
bool | PrintObservers (std::ostream &os, Indent indent) const |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
|
| ~Object () override |
|
virtual LightObject::Pointer | InternalClone () const |
|
| LightObject () |
|
virtual void | PrintHeader (std::ostream &os, Indent indent) const |
|
virtual void | PrintSelf (std::ostream &os, Indent indent) const |
|
virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
|
virtual | ~LightObject () |
|