Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitk::GIFCooccurenceMatrix2 Class Reference

Calculates features based on the co-occurrence matrix. More...

#include <mitkGIFCooccurenceMatrix2.h>

Inheritance diagram for mitk::GIFCooccurenceMatrix2:
Collaboration diagram for mitk::GIFCooccurenceMatrix2:

Public Member Functions

 mitkClassMacro (GIFCooccurenceMatrix2, AbstractGlobalImageFeature)
 
Pointer Clone () const
 
 GIFCooccurenceMatrix2 ()
 
FeatureListType CalculateFeatures (const Image *image, const Image *mask, const Image *maskNoNAN) override
 
virtual std::vector< double > GetRanges () const
 
void SetRanges (std::vector< double > ranges)
 
void SetRange (double range)
 
void AddArguments (mitkCommandLineParser &parser) const override
 
- Public Member Functions inherited from mitk::AbstractGlobalImageFeature
 mitkClassMacro (AbstractGlobalImageFeature, BaseData)
 
FeatureListType CalculateFeatures (const Image *image, const Image *mask)
 Calculates the feature of this abstract interface. Does not necessarily considers the parameter settings. More...
 
FeatureListType CalculateFeaturesSlicewise (const Image::Pointer &image, const Image::Pointer &mask, int sliceID)
 Calculates the given feature Slice-wise. Might not be available for an individual filter! More...
 
virtual void CalculateAndAppendFeaturesSliceWise (const Image::Pointer &image, const Image::Pointer &mask, int sliceID, FeatureListType &featureList, bool checkParameterActivation=true)
 Calculates the feature of this abstract interface. Does not necessarily considers the parameter settings. More...
 
void CalculateAndAppendFeatures (const Image *image, const Image *mask, const Image *maskNoNaN, FeatureListType &featureList, bool checkParameterActivation=true)
 Calculates the feature of this abstract interface. Does not necessarily considers the parameter settings. More...
 
virtual void SetPrefix (std::string _arg)
 
virtual void SetShortName (std::string _arg)
 
virtual void SetLongName (std::string _arg)
 
virtual void SetFeatureClassName (std::string _arg)
 
virtual void SetDirection (int _arg)
 
void SetParameters (ParametersType param)
 
virtual std::string GetPrefix () const
 
virtual std::string GetShortName () const
 
virtual std::string GetLongName () const
 
virtual std::string GetFeatureClassName () const
 
virtual ParametersType GetParameters () const
 
virtual IntensityQuantifier::Pointer GetQuantifier ()
 
virtual int GetDirection () const
 
virtual void SetMinimumIntensity (double _arg)
 
virtual void SetUseMinimumIntensity (bool _arg)
 
virtual void SetMaximumIntensity (double _arg)
 
virtual void SetUseMaximumIntensity (bool _arg)
 
virtual double GetMinimumIntensity () const
 
virtual bool GetUseMinimumIntensity () const
 
virtual double GetMaximumIntensity () const
 
virtual bool GetUseMaximumIntensity () const
 
virtual void SetBinsize (double _arg)
 
virtual void SetUseBinsize (bool _arg)
 
virtual double GetBinsize () const
 
virtual bool GetUseBinsize () const
 
virtual void SetMorphMask (mitk::Image::Pointer _arg)
 
virtual mitk::Image::Pointer GetMorphMask () const
 
virtual void SetBins (int _arg)
 
virtual void SetUseBins (bool _arg)
 
virtual bool GetUseBins () const
 
virtual int GetBins () const
 
virtual void SetIgnoreMask (bool _arg)
 
virtual bool GetIgnoreMask () const
 
virtual void SetEncodeParametersInFeaturePrefix (bool _arg)
 
virtual bool GetEncodeParametersInFeaturePrefix () const
 
virtual void EncodeParametersInFeaturePrefixOn ()
 
virtual void EncodeParametersInFeaturePrefixOff ()
 
std::string GetOptionPrefix () const
 
void SetRequestedRegionToLargestPossibleRegion () override
 Set the RequestedRegion to the LargestPossibleRegion. More...
 
bool RequestedRegionIsOutsideOfTheBufferedRegion () override
 Determine whether the RequestedRegion is outside of the BufferedRegion. More...
 
bool VerifyRequestedRegion () override
 Verify that the RequestedRegion is within the LargestPossibleRegion. More...
 
void SetRequestedRegion (const itk::DataObject *) override
 Set the requested region from this data object to match the requested region of the data object passed in as a parameter. More...
 
bool IsEmpty () const override
 Check whether object contains data (at least at one point in time), e.g., a set of points may be empty. More...
 
- Public Member Functions inherited from mitk::BaseData
virtual std::vector< std::string > GetClassHierarchy () const
 
virtual const char * GetClassName () const
 
BaseProperty::ConstPointer GetConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
 Get property by its key. More...
 
std::vector< std::string > GetPropertyKeys (const std::string &contextName="", bool includeDefaultContext=false) const override
 Query keys of existing properties. More...
 
std::vector< std::string > GetPropertyContextNames () const override
 Query names of existing contexts. More...
 
BasePropertyGetNonConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
 Get property by its key. More...
 
void SetProperty (const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Add new or change existent property. More...
 
void RemoveProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Removes a property. If the property does not exist, nothing will be done. More...
 
const mitk::TimeGeometryGetTimeGeometry () const
 Return the TimeGeometry of the data as const pointer. More...
 
mitk::TimeGeometryGetTimeGeometry ()
 Return the TimeGeometry of the data as pointer. More...
 
const mitk::TimeGeometryGetUpdatedTimeGeometry ()
 Return the TimeGeometry of the data. More...
 
virtual void Expand (unsigned int timeSteps)
 Expands the TimeGeometry to a number of TimeSteps. More...
 
const mitk::BaseGeometryGetUpdatedGeometry (int t=0)
 Return the BaseGeometry of the data at time t. More...
 
mitk::BaseGeometryGetGeometry (int t=0) const
 Return the geometry, which is a TimeGeometry, of the data as non-const pointer. More...
 
void UpdateOutputInformation () override
 Update the information for this BaseData (the geometry in particular) so that it can be used as an output of a BaseProcess. More...
 
void CopyInformation (const itk::DataObject *data) override
 Copy information from the specified data set. More...
 
virtual bool IsInitialized () const
 Check whether the data has been initialized, i.e., at least the Geometry and other header data has been set. More...
 
virtual void Clear ()
 Calls ClearData() and InitializeEmpty();. More...
 
virtual bool IsEmptyTimeStep (unsigned int t) const
 Check whether object contains data (at a specified time), e.g., a set of points may be empty. More...
 
void ExecuteOperation (Operation *operation) override
 overwrite if the Data can be called by an Interactor (StateMachine). More...
 
virtual void SetGeometry (BaseGeometry *aGeometry3D)
 Set the BaseGeometry of the data, which will be referenced (not copied!). Assumes the data object has only 1 time step ( is a 3D object ) and creates a new TimeGeometry which saves the given BaseGeometry. If an TimeGeometry has already been set for the object, it will be replaced after calling this function. More...
 
virtual void SetTimeGeometry (TimeGeometry *geometry)
 Set the TimeGeometry of the data, which will be referenced (not copied!). More...
 
virtual void SetClonedGeometry (const BaseGeometry *aGeometry3D)
 Set a clone of the provided Geometry as Geometry of the data. Assumes the data object has only 1 time step ( is a 3D object ) and creates a new TimeGeometry. If an TimeGeometry has already been set for the object, it will be replaced after calling this function. More...
 
virtual void SetClonedTimeGeometry (const TimeGeometry *geometry)
 Set a clone of the provided TimeGeometry as TimeGeometry of the data. More...
 
virtual void SetClonedGeometry (const BaseGeometry *aGeometry3D, unsigned int time)
 Set a clone of the provided geometry as BaseGeometry of a given time step. More...
 
mitk::PropertyList::Pointer GetPropertyList () const
 Get the data's property list. More...
 
void SetPropertyList (PropertyList *propertyList)
 Set the data's property list. More...
 
mitk::BaseProperty::Pointer GetProperty (const char *propertyKey) const
 Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;. More...
 
void SetProperty (const char *propertyKey, BaseProperty *property)
 
virtual void SetOrigin (const Point3D &origin)
 Convenience method for setting the origin of the BaseGeometry instances of all time steps. More...
 
itk::SmartPointer< mitk::BaseDataSourceGetSource () const
 Get the process object that generated this data object. More...
 
unsigned int GetTimeSteps () const
 Get the number of time steps from the TimeGeometry As the base data has not a data vector given by itself, the number of time steps is defined over the time sliced geometry. In sub classes, a better implementation could be over the length of the data vector. More...
 
itk::ModifiedTimeType GetMTime () const override
 Get the modified time of the last change of the contents this data object or its geometry. More...
 
void Graft (const DataObject *) override
 
- Public Member Functions inherited from mitk::OperationActor
 itkTypeMacroNoParent (OperationActor) virtual ~OperationActor()
 
- Public Member Functions inherited from mitk::Identifiable
 Identifiable ()
 
 Identifiable (const UIDType &uid)
 
 Identifiable (const Identifiable &)=delete
 
 Identifiable (Identifiable &&) noexcept
 
virtual ~Identifiable ()
 
Identifiableoperator= (const Identifiable &)=delete
 
Identifiableoperator= (Identifiable &&other) noexcept
 
virtual UIDType GetUID () const
 Get unique ID of an object. More...
 
- Public Member Functions inherited from mitk::IPropertyOwner
 ~IPropertyOwner () override
 
- Public Member Functions inherited from mitk::IPropertyProvider
virtual ~IPropertyProvider ()
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from mitk::AbstractGlobalImageFeature
static std::string GenerateLegacyFeatureNameWOEncoding (const FeatureID &id)
 
- Static Public Member Functions inherited from mitk::BaseData
static const char * GetStaticNameOfClass ()
 

Protected Member Functions

std::string GenerateLegacyFeatureEncoding (const FeatureID &id) const override
 
FeatureListType DoCalculateFeatures (const Image *image, const Image *mask) override
 
void ConfigureSettingsByParameters (const ParametersType &parameters) override
 
- Protected Member Functions inherited from mitk::AbstractGlobalImageFeature
std::vector< double > SplitDouble (std::string str, char delimiter)
 
void AddQuantifierArguments (mitkCommandLineParser &parser) const
 
void ConfigureQuantifierSettingsByParameters ()
 
void InitializeQuantifier (const Image *image, const Image *mask, unsigned int defaultBins=256)
 
std::string QuantifierParameterString () const
 
FeatureID CreateTemplateFeatureID (std::string settingsSuffix="", FeatureID::ParametersType additionalParams={})
 
virtual std::string GenerateLegacyFeatureName (const FeatureID &id) const
 
virtual std::string GenerateLegacyFeatureNamePart (const FeatureID &id) const
 
- Protected Member Functions inherited from mitk::BaseData
 BaseData ()
 
 BaseData (const BaseData &other)
 
 ~BaseData () override
 
virtual void InitializeTimeGeometry (unsigned int timeSteps=1)
 Initialize the TimeGeometry for a number of time steps. The TimeGeometry is initialized empty and evenly timed. In many cases it will be necessary to overwrite this in sub-classes. More...
 
virtual void ClearData ()
 reset to non-initialized state, release memory More...
 
virtual void InitializeEmpty ()
 Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeGeometry() to ensure an existing valid geometry. More...
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
- Protected Member Functions inherited from mitk::Identifiable
virtual void SetUID (const UIDType &uid)
 

Additional Inherited Members

- Public Types inherited from mitk::AbstractGlobalImageFeature
typedef std::vector< std::pair< FeatureID, double > > FeatureListType
 
using ParametersType = FeatureID::ParametersType
 
- Public Types inherited from mitk::BaseData
typedef BaseData Self
 
typedef itk::DataObject Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
- Public Types inherited from mitk::Identifiable
using UIDType = std::string
 
- Protected Attributes inherited from mitk::BaseData
bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion
 
unsigned int m_SourceOutputIndexDuplicate
 
bool m_Initialized
 

Detailed Description

Calculates features based on the co-occurrence matrix.

The co-occurrence matrix describes the relations between voxels in a specific direction. The elements \(m_{i,k} \) of the matrix count how often a voxel with the intensity \(i \) has a neighbour in a certain direction with the intensity \( k \). The direction for each matrix is given by a directed vector \( \overrightarrow{d} \).

It is important to calculate the matrices for all possible directions in order to obtain a rotation invariant feature. For the 3D case, this means that there are 26 possible directions. Using the symmetrical properties of the co-occurrence matrix, it is then possible to calculate the features in all directions looking at 13 different directions.

The standard length of the vector is 1, e.g. looking at direct neighbours. It is possible to look at more distance neighbours. This is achieved using the parameter range which defines the distance between two neighbouring voxels in number of voxels. The default value for this is 1. It can be changes using the Method SetRange() or by passing the option cooc2::range.

There are two possible ways of combining the information obtained from the multiple directions. The first option is to calculate a common matrix for all directions and then use this matrix to calculate the describing features. The second method is to calculate a matrix for each direction, obtain the features and then report the mean and standard value of these features. Both methods are calculated by this filters and reported, distinguisehd by either an "Overall" if a single matrix is used, a "Mean" for the mean Value, or an "Std.Dev." for the standard deviation.

The connected areas are based on the binned image, the binning parameters can be set via the default parameters as described in AbstractGlobalImageFeature. The intensity used for the calculation is always equal to the bin number. It is also possible to determine the dimensionality of the neighbourhood using direction-related commands as described in AbstractGlobalImageFeature. No other options are possible beside these two options.

This feature calculator is activated by the option -cooccurence2 or -cooc2.

The features are calculated based on a mask. It is assumed that the mask is of the type of an unsigned short image. All voxels with the value 1 are treated as masked.

The following features are defined. We always give the notation for the overall matrix feature although those for the mean and std.dev. are basically equal. In the name, <Range> is replace by the distance of the neighbours. For the definitions of the feature, the probability of each intensity pair (i,k) \( p_{i,k} = \frac{m_{i,k}}{\sum_i \sum_k m_{i,k}} \).

In addition, the marginal sum \( p_{i,\cdot} = p_{\cdot,k=i} = \sum_k p_{i,k} \), which is identical for both axis due to the symmetrical nature of the matrix. Furthermore, the diagonal and cross diagonal features are used:

\[ p_{i-k}(l) = \sum_i \sum_k p_{i,k} \delta(l - \| i -k \| ) \enspace \enspace l = 0, \dots, N_g -1 \]

\[ p_{i+k}(l) = \sum_i \sum_k p_{i,k} \delta(l - ( i + k ) ) \enspace \enspace l = 2, \dots, 2 N_g \]

Here, \( \delta(x) \) is the dirac function, which is one for \(x=0 \) and zero otherwise.

  • Co-occurenced Based Features (<Range>)::Overall Joint Maximum:

    \[ \textup{Joint Maximum}= \textup{max}(p_{i,k}) \]

  • Co-occurenced Based Features (<Range>)::Overall Joint Average:

    \[ \textup{Joint Average} = \mu_{ja} = \sum_i \sum_k i p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Joint Variance:

    \[ \textup{Joint Variance} = \sum_i \sum_k (i - \mu_{ja})^2 p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Joint Entropy:

    \[ \textup{Joint Entropy} = e_j = - \sum_i \sum_k p_{i,k} \textup{log}_2 p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Row Maximum:

    \[ \textup{Row Maximum}= \textup{max}(p_{i,\cdot}) \]

  • Co-occurenced Based Features (<Range>)::Overall Row Average:

    \[ \textup{Row Average} = \mu_{ra} = \sum_i i p_{i,\cdot} \]

  • Co-occurenced Based Features (<Range>)::Overall Row Variance:

    \[ \textup{Row Variance} = \sigma^2_{i, \cdot} = \sum_i (i - \mu_{ra})^2 p_{i,\cdot} \]

  • Co-occurenced Based Features (<Range>)::Overall Row Entropy:

    \[ \textup{Row Entropy} = e_r = - \sum_i p_{i,\cdot} \textup{log}_2 p_{i,\cdot} \]

  • Co-occurenced Based Features (<Range>)::Overall First Row-Column Entropy:

    \[ \textup{First Row-Column Entropy} = e_1 = - \sum_i \sum_k p_{i,k} \textup{log}_2 ( p_{i,\cdot} p_{\cdot,k}) \]

  • Co-occurenced Based Features (<Range>)::Overall Second Row-Column Entropy:

    \[ \textup{Second Row-Column Entropy} = e_2 = - \sum_i \sum_k p_{i,\cdot} p_{\cdot,k} \textup{log}_2 ( p_{i,\cdot} p_{\cdot,k}) \]

  • Co-occurenced Based Features (<Range>)::Overall Difference Average:

    \[ \textup{Difference Average} = \mu_{da} = \sum_l l p_{i-k}(l) \]

  • Co-occurenced Based Features (<Range>)::Overall Difference Variance:

    \[ \textup{Difference Variance} = \sum_l (i - \mu_{da})^2 p_{i-k}(l) \]

  • Co-occurenced Based Features (<Range>)::Overall Difference Entropy:

    \[ \textup{Difference Entropy} = - \sum_l p_{i-k}(l) \textup{log}_2 p_{i-k}(l) \]

  • Co-occurenced Based Features (<Range>)::Overall Sum Average:

    \[ \textup{Sum Average} = \mu_{sa} = \sum_l l p_{i+k}(l) \]

  • Co-occurenced Based Features (<Range>)::Overall Sum Variance:

    \[ \textup{Sum Variance} = \sum_l (i - \mu_{sa})^2 p_{i+k}(l) \]

  • Co-occurenced Based Features (<Range>)::Overall Sum Entropy:

    \[ \textup{Sum Entropy} = - \sum_l p_{i+k}(l) \textup{log}_2 p_{i+k}(l) \]

  • Co-occurenced Based Features (<Range>)::Overall Angular Second Moment:

    \[ \textup{Angular Second Moment} = \sum_i \sum_k p^2_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Contrast:

    \[ \textup{Contrast} = \sum_i \sum_k (i-k)^2 p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Dissimilarity:

    \[ \textup{Dissimilarity} = \sum_i \sum_k \| i-k\| p^2_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Inverse Difference:

    \[ \textup{Inverse Difference} = \sum_i \sum_k \frac{p_{i,k}}{1+\| i-k\|} \]

  • Co-occurenced Based Features (<Range>)::Overall Inverse Difference Normalized:

    \[ \textup{Inverse Difference Normalized} = \sum_i \sum_k \frac{p_{i,k}}{1+\frac{\| i-k\|}{N_g}} \]

  • Co-occurenced Based Features (<Range>)::Overall Inverse Difference Moment:

    \[ \textup{Inverse Difference Moment} = \sum_i \sum_k \frac{p_{i,k}}{1+ ( i-k )^2} \]

  • Co-occurenced Based Features (<Range>)::Overall Inverse Difference Moment Normalized:

    \[ \textup{Inverse Difference Moment Normalized} = \sum_i \sum_k \frac{p_{i,k}}{1+\frac{( i-k ) ^2}{N_g}} \]

  • Co-occurenced Based Features (<Range>)::Overall Inverse Variance:

    \[ \textup{Inverse Difference Moment Normalized} = \sum_i \sum_k \frac{p_{i,k}}{(i-k)^2} \]

  • Co-occurenced Based Features (<Range>)::Overall Correlation:

    \[ \textup{Correlation} = \frac{1}{\sigma^2_{i,\cdot}} \sum_i \sum_k (i - \mu_{ra})(k - \mu_{ra}) p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Autocorrelation:

    \[ \textup{Autocorrelation} = \sum_i \sum_k i k p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Cluster Tendency:

    \[ \textup{Cluster Tendency} = \sum_i \sum_k (i + k - 2\mu_{ra})^2 p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Cluster Shade:

    \[ \textup{Cluster Shade} = \sum_i \sum_k (i + k - 2\mu_{ra})^3 p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall Cluster Prominence:

    \[ \textup{Cluster Prominence} = \sum_i \sum_k (i + k - 2\mu_{ra})^4 p_{i,k} \]

  • Co-occurenced Based Features (<Range>)::Overall First Measure of Information Correlation:

    \[ \textup{First Measure of Information Correlation} = \frac{ e_j- e_1}{e_r} \]

  • Co-occurenced Based Features (<Range>)::Overall Second Measure of Information Correlation:

    \[ \textup{Second Measure of Information Correlation} = \sqrt{1- \exp(-2 (e_2 - e_j)} \]

Definition at line 132 of file mitkGIFCooccurenceMatrix2.h.

Constructor & Destructor Documentation

◆ GIFCooccurenceMatrix2()

mitk::GIFCooccurenceMatrix2::GIFCooccurenceMatrix2 ( )

Member Function Documentation

◆ AddArguments()

void mitk::GIFCooccurenceMatrix2::AddArguments ( mitkCommandLineParser parser) const
overridevirtual

Can be called to add all relevant argument for configuring the feature instance to the passed parser instance. Must be implemented be derived classes. For adding the quantifier arguments use AddQuantifierArguments(...) as helper function.

Implements mitk::AbstractGlobalImageFeature.

◆ CalculateFeatures()

FeatureListType mitk::GIFCooccurenceMatrix2::CalculateFeatures ( const Image image,
const Image mask,
const Image maskNoNAN 
)
overridevirtual

◆ Clone()

Pointer mitk::GIFCooccurenceMatrix2::Clone ( ) const

◆ ConfigureSettingsByParameters()

void mitk::GIFCooccurenceMatrix2::ConfigureSettingsByParameters ( const ParametersType parameters)
overrideprotectedvirtual

Ensures that the instance is configured according to the information given in the passed parameters. This method will be called by SetParameters(...) after ConfigureQuantifierSettingsByParameters() was called.

Reimplemented from mitk::AbstractGlobalImageFeature.

◆ DoCalculateFeatures()

FeatureListType mitk::GIFCooccurenceMatrix2::DoCalculateFeatures ( const Image image,
const Image mask 
)
overrideprotectedvirtual

◆ GenerateLegacyFeatureEncoding()

std::string mitk::GIFCooccurenceMatrix2::GenerateLegacyFeatureEncoding ( const FeatureID id) const
overrideprotectedvirtual

Reimplemented from mitk::AbstractGlobalImageFeature.

◆ GetRanges()

virtual std::vector<double> mitk::GIFCooccurenceMatrix2::GetRanges ( ) const
virtual

◆ mitkClassMacro()

mitk::GIFCooccurenceMatrix2::mitkClassMacro ( GIFCooccurenceMatrix2  ,
AbstractGlobalImageFeature   
)

◆ New()

static Pointer mitk::GIFCooccurenceMatrix2::New ( )
static

◆ SetRange()

void mitk::GIFCooccurenceMatrix2::SetRange ( double  range)

◆ SetRanges()

void mitk::GIFCooccurenceMatrix2::SetRanges ( std::vector< double >  ranges)

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