Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::ImageStatisticsHolder Class Reference

Class holding the statistics information about a single mitk::Image. More...

#include <mitkImageStatisticsHolder.h>

Collaboration diagram for mitk::ImageStatisticsHolder:

Public Types

typedef itk::Statistics::Histogram< double > HistogramType
 

Public Member Functions

 ImageStatisticsHolder (mitk::Image *image)
 Constructor. More...
 
virtual ~ImageStatisticsHolder ()
 Destructor. More...
 
virtual const HistogramType * GetScalarHistogram (int t=0, unsigned int=0)
 Get the scalar histogram for the specified time step. More...
 
virtual ScalarType GetScalarValueMin (int t=0, unsigned int component=0)
 Get the minimum scalar value. Recomputation performed only when necessary. More...
 
virtual ScalarType GetScalarValueMax (int t=0, unsigned int component=0)
 Get the maximum scalar value. Recomputation performed only when necessary. More...
 
virtual ScalarType GetScalarValue2ndMin (int t=0, unsigned int component=0)
 Get the second smallest scalar value. Recomputation performed only when necessary. More...
 
virtual mitk::ScalarType GetScalarValueMinNoRecompute (unsigned int t=0) const
 Get the smallest scalar value without triggering recomputation. More...
 
virtual mitk::ScalarType GetScalarValue2ndMinNoRecompute (unsigned int t=0) const
 Get the second smallest scalar value without triggering recomputation. More...
 
virtual ScalarType GetScalarValue2ndMax (int t=0, unsigned int component=0)
 Get the second largest scalar value. Recomputation performed only when necessary. More...
 
virtual mitk::ScalarType GetScalarValueMaxNoRecompute (unsigned int t=0)
 Get the largest scalar value without triggering recomputation. More...
 
virtual mitk::ScalarType GetScalarValue2ndMaxNoRecompute (unsigned int t=0)
 Get the second largest scalar value without triggering recomputation. More...
 
mitk::ScalarType GetCountOfMinValuedVoxels (int t=0, unsigned int component=0)
 Get the count of voxels with the smallest scalar value. Recomputation performed only when necessary. More...
 
mitk::ScalarType GetCountOfMaxValuedVoxels (int t=0, unsigned int component=0)
 Get the count of voxels with the largest scalar value. Recomputation performed only when necessary. More...
 
virtual unsigned int GetCountOfMaxValuedVoxelsNoRecompute (unsigned int t=0)
 Get the count of voxels with the largest scalar value without triggering recomputation. More...
 
virtual unsigned int GetCountOfMinValuedVoxelsNoRecompute (unsigned int t=0) const
 Get the count of voxels with the smallest scalar value without triggering recomputation. More...
 
bool IsValidTimeStep (int t) const
 Check whether the given time step is valid for the associated image. More...
 

Protected Member Functions

virtual void ResetImageStatistics ()
 Reset all cached statistics values to their initial state. More...
 
virtual void ComputeImageStatistics (int t=0, unsigned int component=0)
 Compute image statistics for the specified time step and component. More...
 
virtual void Expand (unsigned int timeSteps)
 Expand internal statistics storage to accommodate the given number of time steps. More...
 
ImageTimeSelector::Pointer GetTimeSelector ()
 Get an ImageTimeSelector configured with the associated image as input. More...
 

Protected Attributes

mitk::Image * m_Image
 
itk::Object::Pointer m_HistogramGeneratorObject
 
itk::Object::Pointer m_TimeSelectorForExtremaObject
 
std::vector< unsigned int > m_CountOfMinValuedVoxels
 
std::vector< unsigned int > m_CountOfMaxValuedVoxels
 
std::vector< ScalarType > m_ScalarMin
 
std::vector< ScalarType > m_ScalarMax
 
std::vector< ScalarType > m_Scalar2ndMin
 
std::vector< ScalarType > m_Scalar2ndMax
 
itk::TimeStamp m_LastRecomputeTimeStamp
 

Detailed Description

Class holding the statistics information about a single mitk::Image.

This computation was previously directly included in the definition and implementation of the mitk::Image class but for having a clear interface, all statistics computation is moved to the ImageStatisticsHolder class.

Each mitk::Image holds a normal pointer to its StatisticsHolder object. To get access to the methods, use the GetStatistics() method in mitk::Image class.

Minimum or maximum might be infinite values. 2nd minimum and maximum are guaranteed to be finite values.

See also
Image
Image::GetStatistics()

Definition at line 39 of file mitkImageStatisticsHolder.h.

Member Typedef Documentation

◆ HistogramType

typedef itk::Statistics::Histogram<double> mitk::ImageStatisticsHolder::HistogramType

Definition at line 52 of file mitkImageStatisticsHolder.h.

Constructor & Destructor Documentation

◆ ImageStatisticsHolder()

mitk::ImageStatisticsHolder::ImageStatisticsHolder ( mitk::Image *  image)

Constructor.

Parameters
imageThe image whose statistics this holder manages.

◆ ~ImageStatisticsHolder()

virtual mitk::ImageStatisticsHolder::~ImageStatisticsHolder ( )
virtual

Destructor.

Member Function Documentation

◆ ComputeImageStatistics()

virtual void mitk::ImageStatisticsHolder::ComputeImageStatistics ( int  t = 0,
unsigned int  component = 0 
)
protectedvirtual

Compute image statistics for the specified time step and component.

Parameters
tThe time step. Defaults to 0.
componentThe component index for vector images. Defaults to 0.

◆ Expand()

virtual void mitk::ImageStatisticsHolder::Expand ( unsigned int  timeSteps)
protectedvirtual

Expand internal statistics storage to accommodate the given number of time steps.

Parameters
timeStepsThe number of time steps to support.

◆ GetCountOfMaxValuedVoxels()

mitk::ScalarType mitk::ImageStatisticsHolder::GetCountOfMaxValuedVoxels ( int  t = 0,
unsigned int  component = 0 
)

Get the count of voxels with the largest scalar value. Recomputation performed only when necessary.

Parameters
tThe time step. Defaults to 0.
componentThe component index for vector images. Defaults to 0.
Returns
The number of voxels having the maximum scalar value.

◆ GetCountOfMaxValuedVoxelsNoRecompute()

virtual unsigned int mitk::ImageStatisticsHolder::GetCountOfMaxValuedVoxelsNoRecompute ( unsigned int  t = 0)
inlinevirtual

Get the count of voxels with the largest scalar value without triggering recomputation.

Parameters
tThe time step. Defaults to 0.
Returns
The cached count, or 0 if unavailable.

Definition at line 182 of file mitkImageStatisticsHolder.h.

◆ GetCountOfMinValuedVoxels()

mitk::ScalarType mitk::ImageStatisticsHolder::GetCountOfMinValuedVoxels ( int  t = 0,
unsigned int  component = 0 
)

Get the count of voxels with the smallest scalar value. Recomputation performed only when necessary.

Parameters
tThe time step. Defaults to 0.
componentThe component index for vector images. Defaults to 0.
Returns
The number of voxels having the minimum scalar value.

◆ GetCountOfMinValuedVoxelsNoRecompute()

virtual unsigned int mitk::ImageStatisticsHolder::GetCountOfMinValuedVoxelsNoRecompute ( unsigned int  t = 0) const
inlinevirtual

Get the count of voxels with the smallest scalar value without triggering recomputation.

Parameters
tThe time step. Defaults to 0.
Returns
The cached count, or 0 if unavailable.

Definition at line 196 of file mitkImageStatisticsHolder.h.

◆ GetScalarHistogram()

virtual const HistogramType* mitk::ImageStatisticsHolder::GetScalarHistogram ( int  t = 0,
unsigned int  = 0 
)
virtual

Get the scalar histogram for the specified time step.

Parameters
tThe time step. Defaults to 0.
Returns
Pointer to the histogram, or nullptr if unavailable.

◆ GetScalarValue2ndMax()

virtual ScalarType mitk::ImageStatisticsHolder::GetScalarValue2ndMax ( int  t = 0,
unsigned int  component = 0 
)
virtual

Get the second largest scalar value. Recomputation performed only when necessary.

Parameters
tThe time step. Defaults to 0.
componentThe component index for vector images. Defaults to 0.
Returns
The second largest scalar value at the given time step.
Postcondition
The returned value is always a finite value.

◆ GetScalarValue2ndMaxNoRecompute()

virtual mitk::ScalarType mitk::ImageStatisticsHolder::GetScalarValue2ndMaxNoRecompute ( unsigned int  t = 0)
inlinevirtual

Get the second largest scalar value without triggering recomputation.

Parameters
tThe time step. Defaults to 0.
Returns
The cached second maximum scalar value, or NonpositiveMin if unavailable.

Definition at line 150 of file mitkImageStatisticsHolder.h.

◆ GetScalarValue2ndMin()

virtual ScalarType mitk::ImageStatisticsHolder::GetScalarValue2ndMin ( int  t = 0,
unsigned int  component = 0 
)
virtual

Get the second smallest scalar value. Recomputation performed only when necessary.

Parameters
tThe time step. Defaults to 0.
componentThe component index for vector images. Defaults to 0.
Returns
The second smallest scalar value at the given time step.
Postcondition
The returned value is always a finite value.

◆ GetScalarValue2ndMinNoRecompute()

virtual mitk::ScalarType mitk::ImageStatisticsHolder::GetScalarValue2ndMinNoRecompute ( unsigned int  t = 0) const
inlinevirtual

Get the second smallest scalar value without triggering recomputation.

Parameters
tThe time step. Defaults to 0.
Returns
The cached second minimum scalar value, or max numeric limit if unavailable.
Postcondition
The returned value is always a finite value.

Definition at line 111 of file mitkImageStatisticsHolder.h.

◆ GetScalarValueMax()

virtual ScalarType mitk::ImageStatisticsHolder::GetScalarValueMax ( int  t = 0,
unsigned int  component = 0 
)
virtual

Get the maximum scalar value. Recomputation performed only when necessary.

Parameters
tThe time step. Defaults to 0.
componentThe component index for vector images. Defaults to 0.
Returns
The maximum scalar value at the given time step.

◆ GetScalarValueMaxNoRecompute()

virtual mitk::ScalarType mitk::ImageStatisticsHolder::GetScalarValueMaxNoRecompute ( unsigned int  t = 0)
inlinevirtual

Get the largest scalar value without triggering recomputation.

Parameters
tThe time step. Defaults to 0.
Returns
The cached maximum scalar value, or NonpositiveMin if unavailable.
Postcondition
The returned value is always a finite value.

Definition at line 136 of file mitkImageStatisticsHolder.h.

◆ GetScalarValueMin()

virtual ScalarType mitk::ImageStatisticsHolder::GetScalarValueMin ( int  t = 0,
unsigned int  component = 0 
)
virtual

Get the minimum scalar value. Recomputation performed only when necessary.

Parameters
tThe time step. Defaults to 0.
componentThe component index for vector images. Defaults to 0.
Returns
The minimum scalar value at the given time step.

◆ GetScalarValueMinNoRecompute()

virtual mitk::ScalarType mitk::ImageStatisticsHolder::GetScalarValueMinNoRecompute ( unsigned int  t = 0) const
inlinevirtual

Get the smallest scalar value without triggering recomputation.

Parameters
tThe time step. Defaults to 0.
Returns
The cached minimum scalar value, or max numeric limit if unavailable.

Definition at line 96 of file mitkImageStatisticsHolder.h.

◆ GetTimeSelector()

ImageTimeSelector::Pointer mitk::ImageStatisticsHolder::GetTimeSelector ( )
protected

Get an ImageTimeSelector configured with the associated image as input.

Returns
A new ImageTimeSelector instance.

◆ IsValidTimeStep()

bool mitk::ImageStatisticsHolder::IsValidTimeStep ( int  t) const

Check whether the given time step is valid for the associated image.

Parameters
tThe time step to check.
Returns
True if the time step is valid.

◆ ResetImageStatistics()

virtual void mitk::ImageStatisticsHolder::ResetImageStatistics ( )
protectedvirtual

Reset all cached statistics values to their initial state.

Member Data Documentation

◆ m_CountOfMaxValuedVoxels

std::vector<unsigned int> mitk::ImageStatisticsHolder::m_CountOfMaxValuedVoxels
mutableprotected

Definition at line 255 of file mitkImageStatisticsHolder.h.

◆ m_CountOfMinValuedVoxels

std::vector<unsigned int> mitk::ImageStatisticsHolder::m_CountOfMinValuedVoxels
mutableprotected

Definition at line 254 of file mitkImageStatisticsHolder.h.

◆ m_HistogramGeneratorObject

itk::Object::Pointer mitk::ImageStatisticsHolder::m_HistogramGeneratorObject
mutableprotected

Definition at line 251 of file mitkImageStatisticsHolder.h.

◆ m_Image

mitk::Image* mitk::ImageStatisticsHolder::m_Image
protected

Definition at line 249 of file mitkImageStatisticsHolder.h.

◆ m_LastRecomputeTimeStamp

itk::TimeStamp mitk::ImageStatisticsHolder::m_LastRecomputeTimeStamp
protected

Definition at line 261 of file mitkImageStatisticsHolder.h.

◆ m_Scalar2ndMax

std::vector<ScalarType> mitk::ImageStatisticsHolder::m_Scalar2ndMax
mutableprotected

Definition at line 259 of file mitkImageStatisticsHolder.h.

◆ m_Scalar2ndMin

std::vector<ScalarType> mitk::ImageStatisticsHolder::m_Scalar2ndMin
mutableprotected

Definition at line 258 of file mitkImageStatisticsHolder.h.

◆ m_ScalarMax

std::vector<ScalarType> mitk::ImageStatisticsHolder::m_ScalarMax
mutableprotected

Definition at line 257 of file mitkImageStatisticsHolder.h.

◆ m_ScalarMin

std::vector<ScalarType> mitk::ImageStatisticsHolder::m_ScalarMin
mutableprotected

Definition at line 256 of file mitkImageStatisticsHolder.h.

◆ m_TimeSelectorForExtremaObject

itk::Object::Pointer mitk::ImageStatisticsHolder::m_TimeSelectorForExtremaObject
mutableprotected

Definition at line 253 of file mitkImageStatisticsHolder.h.


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