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

Computes image statistics, optionally restricted by one or two masks. More...

#include <mitkImageStatisticsCalculator.h>

Inheritance diagram for mitk::ImageStatisticsCalculator:
Collaboration diagram for mitk::ImageStatisticsCalculator:

Public Types

typedef ImageStatisticsCalculator Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< Self > Pointer
 
typedef itk::SmartPointer< const Self > ConstPointer
 
typedef double statisticsValueType
 Type for individual statistics values. More...
 
typedef std::map< std::string, statisticsValueType > statisticsMapType
 Map type associating statistic names with their values. More...
 
typedef itk::Statistics::Histogram< double > HistogramType
 Histogram type used for pixel value distribution. More...
 
typedef unsigned short MaskPixelType
 Pixel type used for mask images. More...
 
using LabelIndex = ImageStatisticsContainer::LabelValueType
 Type used for label indexing in statistics containers. More...
 

Public Member Functions

virtual const char * GetClassName () const
 
void SetInputImage (const mitk::Image *image)
 Set the image for which statistics are to be computed. More...
 
void SetMask (mitk::MaskGenerator *mask)
 Set the primary mask generator for restricting statistics computation. More...
 
void SetSecondaryMask (mitk::MaskGenerator *mask)
 Set a secondary mask generator for additional region restriction. More...
 
void SetNBinsForHistogramStatistics (unsigned int nBins)
 Set the number of histogram bins for histogram statistics. More...
 
unsigned int GetNBinsForHistogramStatistics () const
 Get the number of histogram bins. More...
 
void SetBinSizeForHistogramStatistics (double binSize)
 Set the bin size for histogram statistics. More...
 
double GetBinSizeForHistogramStatistics () const
 Get the histogram bin size. More...
 
ImageStatisticsContainer * GetStatistics ()
 Get the computed statistics container. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 ImageStatisticsCalculator ()
 

Detailed Description

Computes image statistics, optionally restricted by one or two masks.

ImageStatisticsCalculator is the central class for computing pixel statistics on MITK images. It supports single images and time-series images, and can restrict computation to regions defined by one or two MaskGenerator instances (combined via pixel-wise AND).

Computed statistics include: mean, standard deviation, variance, minimum, maximum, RMS, skewness, kurtosis, MPP (mean of positive pixels), entropy, uniformity, UPP, median, and a configurable histogram.

Results are stored in an ImageStatisticsContainer that organizes statistics by label value and time step.

See also
ImageStatisticsContainer
MaskGenerator
HistogramStatisticsCalculator

Definition at line 42 of file mitkImageStatisticsCalculator.h.

Member Typedef Documentation

◆ ConstPointer

◆ HistogramType

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

Histogram type used for pixel value distribution.

Definition at line 60 of file mitkImageStatisticsCalculator.h.

◆ LabelIndex

Type used for label indexing in statistics containers.

Definition at line 64 of file mitkImageStatisticsCalculator.h.

◆ MaskPixelType

Pixel type used for mask images.

Definition at line 62 of file mitkImageStatisticsCalculator.h.

◆ Pointer

◆ Self

◆ statisticsMapType

Map type associating statistic names with their values.

Definition at line 58 of file mitkImageStatisticsCalculator.h.

◆ statisticsValueType

Type for individual statistics values.

Definition at line 56 of file mitkImageStatisticsCalculator.h.

◆ Superclass

Definition at line 47 of file mitkImageStatisticsCalculator.h.

Constructor & Destructor Documentation

◆ ImageStatisticsCalculator()

mitk::ImageStatisticsCalculator::ImageStatisticsCalculator ( )
inlineprotected

Definition at line 142 of file mitkImageStatisticsCalculator.h.

Member Function Documentation

◆ GetBinSizeForHistogramStatistics()

double mitk::ImageStatisticsCalculator::GetBinSizeForHistogramStatistics ( ) const

Get the histogram bin size.

Returns
The currently configured bin size. Note: this does not indicate whether NBins or BinSize is actually used; that depends on which was set last.

◆ GetClassName()

virtual const char* mitk::ImageStatisticsCalculator::GetClassName ( ) const
virtual

Runtime information support.

◆ GetNBinsForHistogramStatistics()

unsigned int mitk::ImageStatisticsCalculator::GetNBinsForHistogramStatistics ( ) const

Get the number of histogram bins.

Returns
The currently configured number of bins. Note: this does not indicate whether NBins or BinSize is actually used; that depends on which was set last.

◆ GetStatistics()

ImageStatisticsContainer* mitk::ImageStatisticsCalculator::GetStatistics ( )

Get the computed statistics container.

If statistics have not been computed yet or are out of date, this method triggers recomputation before returning the results.

Returns
Pointer to the ImageStatisticsContainer holding all results.

◆ New()

static Pointer mitk::ImageStatisticsCalculator::New ( )
static

Method for creation through the object factory.

◆ SetBinSizeForHistogramStatistics()

void mitk::ImageStatisticsCalculator::SetBinSizeForHistogramStatistics ( double  binSize)

Set the bin size for histogram statistics.

If SetNBinsForHistogramStatistics() is called after this method, number of bins will take precedence over bin size.

Parameters
[in]binSizeThe desired histogram bin width. Default is 10.0.

◆ SetInputImage()

void mitk::ImageStatisticsCalculator::SetInputImage ( const mitk::Image *  image)

Set the image for which statistics are to be computed.

Parameters
[in]imagePointer to the input MITK image.
Precondition
image must not be nullptr.

◆ SetMask()

void mitk::ImageStatisticsCalculator::SetMask ( mitk::MaskGenerator *  mask)

Set the primary mask generator for restricting statistics computation.

If no mask is desired, pass nullptr to clear the mask.

Parameters
[in]maskPointer to a MaskGenerator, or nullptr.

◆ SetNBinsForHistogramStatistics()

void mitk::ImageStatisticsCalculator::SetNBinsForHistogramStatistics ( unsigned int  nBins)

Set the number of histogram bins for histogram statistics.

If SetBinSizeForHistogramStatistics() is called after this method, bin size will take precedence over number of bins.

Parameters
[in]nBinsNumber of histogram bins. Default is 100.

◆ SetSecondaryMask()

void mitk::ImageStatisticsCalculator::SetSecondaryMask ( mitk::MaskGenerator *  mask)

Set a secondary mask generator for additional region restriction.

When set, the secondary mask is combined with the primary mask via pixel-wise AND operation. The secondary mask does not need to be the same size as the primary, but they must have some spatial overlap.

Parameters
[in]maskPointer to a secondary MaskGenerator, or nullptr.

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