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

Class for calculating statistics and histogram for an (optionally masked) image. More...

#include <mitkImageStatisticsCalculator.h>

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

Classes

class  ImageExtrema
 
class  Statistics
 Class for common statistics, includig hotspot properties. More...
 
class  StatisticsContainer
 Container class for storing the computed image statistics. More...
 

Public Types

enum  { MASKING_MODE_NONE, MASKING_MODE_IMAGE, MASKING_MODE_PLANARFIGURE }
 Enum for possible masking modi. More...
 
typedef ImageStatisticsCalculator Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef double statisticsValueType
 
typedef std::map< std::string, statisticsValueTypestatisticsMapType
 
typedef itk::Statistics::Histogram< double > HistogramType
 
typedef unsigned short MaskPixelType
 
typedef itk::Statistics::Histogram< double > HistogramType
 
typedef HistogramType::ConstIterator HistogramConstIteratorType
 
typedef std::vector< HistogramType::ConstPointer > HistogramContainer
 
typedef std::vector< StatisticsStatisticsContainer
 
typedef std::map< int, double > BinFrequencyType
 

Public Member Functions

virtual const char * GetClassName () const
 
void SetInputImage (mitk::Image::Pointer image)
 Set the image for which the statistics are to be computed. More...
 
void SetMask (mitk::MaskGenerator::Pointer mask)
 Set the mask generator that creates the mask which is to be used to calculate statistics. If no more mask is desired simply set. More...
 
void SetSecondaryMask (mitk::MaskGenerator::Pointer mask)
 Set this if more than one mask should be applied (for instance if a IgnorePixelValueMask were to be used alongside with a segmentation). Both masks are combined using pixel wise AND operation. The secondary mask does not have to be the same size than the primary but they need to have some overlap. More...
 
void SetNBinsForHistogramStatistics (unsigned int nBins)
 Set number of bins to be used for histogram statistics. If Bin size is set after number of bins, bin size will be used instead! More...
 
unsigned int GetNBinsForHistogramStatistics () const
 Retrieve the number of bins used for histogram statistics. Careful: The return value does not indicate whether NBins or BinSize is used. That solely depends on which parameter has been set last. More...
 
void SetBinSizeForHistogramStatistics (double binSize)
 Set bin size to be used for histogram statistics. If nbins is set after bin size, nbins will be used instead! More...
 
double GetBinSizeForHistogramStatistics () const
 Retrieve the bin size for histogram statistics. Careful: The return value does not indicate whether NBins or BinSize is used. That solely depends on which parameter has been set last. More...
 
StatisticsContainer::Pointer GetStatistics (unsigned int timeStep=0, unsigned int label=1)
 Returns the statistics for label label and timeStep timeStep. If these requested statistics are not computed yet the computation is done as well. For performance reasons, statistics for all labels in the image are computed at once. More...
 
 mitkClassMacroItkParent (ImageStatisticsCalculator, itk::Object)
 
Pointer Clone () const
 
void SetUseDefaultBinSize (bool useDefault)
 Automatically calculate bin size to obtain 200 bins. More...
 
void SetImage (const mitk::Image *image)
 Set image from which to compute statistics. More...
 
void SetImageMask (const mitk::Image *imageMask)
 Set image for masking. More...
 
void SetPlanarFigure (mitk::PlanarFigure *planarFigure)
 Set planar figure for masking. More...
 
void SetMaskingMode (unsigned int mode)
 Set/Get operation mode for masking. More...
 
virtual unsigned int GetMaskingMode ()
 Set/Get operation mode for masking. More...
 
void SetMaskingModeToNone ()
 Set/Get operation mode for masking. More...
 
void SetMaskingModeToImage ()
 Set/Get operation mode for masking. More...
 
void SetMaskingModeToPlanarFigure ()
 Set/Get operation mode for masking. More...
 
void SetIgnorePixelValue (double value)
 Set a pixel value for pixels that will be ignored in the statistics. More...
 
double GetIgnorePixelValue ()
 Get the pixel value for pixels that will be ignored in the statistics. More...
 
void SetDoIgnorePixelValue (bool doit)
 Set whether a pixel value should be ignored in the statistics. More...
 
bool GetDoIgnorePixelValue ()
 Get whether a pixel value will be ignored in the statistics. More...
 
void SetHistogramBinSize (double size)
 Set bin size for histogram resolution. More...
 
double GetHistogramBinSize ()
 Get bin size for histogram resolution. More...
 
void SetHotspotRadiusInMM (double hotspotRadiusInMM)
 Sets the radius for the hotspot. More...
 
double GetHotspotRadiusInMM ()
 Returns the radius of the hotspot. More...
 
void SetCalculateHotspot (bool calculateHotspot)
 Sets whether the hotspot should be calculated. More...
 
bool IsHotspotCalculated ()
 Returns true whether the hotspot should be calculated, otherwise false. More...
 
void SetHotspotMustBeCompletlyInsideImage (bool hotspotIsCompletlyInsideImage, bool warn=true)
 Sets flag whether hotspot is completly inside the image. Please note that if set to false it can be possible that statistics are calculated for which the whole hotspot is not inside the image! More...
 
bool GetHotspotMustBeCompletlyInsideImage () const
 Returns true if hotspot has to be completly inside the image. More...
 
virtual bool ComputeStatistics (unsigned int timeStep=0)
 Compute statistics (together with histogram) for the current masking mode. More...
 
const HistogramTypeGetHistogram (unsigned int timeStep=0, unsigned int label=0) const
 Retrieve the histogram depending on the current masking mode. More...
 
const HistogramContainerGetHistogramVector (unsigned int timeStep=0) const
 Retrieve the histogram depending on the current masking mode (for all image labels. More...
 
BinFrequencyType GetBinsAndFreuqencyForHistograms (unsigned int timeStep=0, unsigned int label=0) const
 
const StatisticsGetStatistics (unsigned int timeStep=0, unsigned int label=0) const
 Retrieve statistics depending on the current masking mode. More...
 
const StatisticsContainerGetStatisticsVector (unsigned int timeStep=0) const
 Retrieve statistics depending on the current masking mode (for all image labels). More...
 

Static Public Member Functions

static Pointer New ()
 
static Pointer New ()
 

Protected Types

typedef std::vector< HistogramContainerHistogramVector
 
typedef std::vector< StatisticsContainerStatisticsVector
 
typedef std::vector< itk::TimeStamp > TimeStampVectorType
 
typedef std::vector< bool > BoolVectorType
 
typedef itk::Image< unsigned short, 3 > MaskImage3DType
 
typedef itk::Image< unsigned short, 2 > MaskImage2DType
 

Protected Member Functions

 ImageStatisticsCalculator ()
 
 ImageStatisticsCalculator ()
 
virtual ~ImageStatisticsCalculator ()
 
void ExtractImageAndMask (unsigned int timeStep=0)
 Depending on the masking mode, the image and mask from which to calculate statistics is extracted from the original input image and mask data. More...
 
template<typename TPixel , unsigned int VImageDimension>
void GetMinAndMaxValue (double &minimum, double &maximum, int &counter, double &sigma, const itk::Image< TPixel, VImageDimension > *InputImage, itk::Image< unsigned short, VImageDimension > *MaskImageType)
 
bool GetPrincipalAxis (const BaseGeometry *geometry, Vector3D vector, unsigned int &axis)
 If the passed vector matches any of the three principal axes of the passed geometry, the ínteger value corresponding to the axis is set and true is returned. More...
 
template<typename TPixel , unsigned int VImageDimension>
void InternalCalculateStatisticsUnmasked (const itk::Image< TPixel, VImageDimension > *image, StatisticsContainer *statisticsContainer, HistogramContainer *histogramContainer)
 
template<typename TPixel , unsigned int VImageDimension>
void InternalCalculateStatisticsMasked (const itk::Image< TPixel, VImageDimension > *image, itk::Image< unsigned short, VImageDimension > *maskImage, StatisticsContainer *statisticsContainer, HistogramContainer *histogramContainer)
 
template<typename TPixel , unsigned int VImageDimension>
void InternalCalculateMaskFromPlanarFigure (const itk::Image< TPixel, VImageDimension > *image, unsigned int axis)
 
template<typename TPixel , unsigned int VImageDimension>
void InternalMaskIgnoredPixels (const itk::Image< TPixel, VImageDimension > *image, itk::Image< unsigned short, VImageDimension > *maskImage)
 
template<typename TPixel , unsigned int VImageDimension>
ImageExtrema CalculateExtremaWorld (const itk::Image< TPixel, VImageDimension > *inputImage, itk::Image< unsigned short, VImageDimension > *maskImage, double neccessaryDistanceToImageBorderInMM, unsigned int label)
 Calculates minimum, maximum, mean value and their corresponding indices in a given ROI. As input the function needs an image and a mask. Returns an ImageExtrema object. More...
 
template<typename TPixel , unsigned int VImageDimension>
Statistics CalculateHotspotStatistics (const itk::Image< TPixel, VImageDimension > *inputImage, itk::Image< unsigned short, VImageDimension > *maskImage, double radiusInMM, bool &isHotspotDefined, unsigned int label)
 Calculates the hotspot statistics depending on masking mode. Hotspot statistics are calculated for a hotspot which is completly located inside the image by default. More...
 
template<typename ITK_Exporter , typename VTK_Importer >
void ConnectPipelines (ITK_Exporter exporter, vtkSmartPointer< VTK_Importer > importer)
 
template<typename VTK_Exporter , typename ITK_Importer >
void ConnectPipelines (vtkSmartPointer< VTK_Exporter > exporter, ITK_Importer importer)
 
void UnmaskedStatisticsProgressUpdate ()
 
void MaskedStatisticsProgressUpdate ()
 
template<unsigned int VImageDimension>
itk::Size< VImageDimension > CalculateConvolutionKernelSize (double spacing[VImageDimension], double radiusInMM)
 Returns size of convolution kernel depending on spacing and radius. More...
 
template<unsigned int VImageDimension>
itk::SmartPointer< itk::Image< float, VImageDimension > > GenerateHotspotSearchConvolutionKernel (double spacing[VImageDimension], double radiusInMM)
 Generates image of kernel which is needed for convolution. More...
 
template<typename TPixel , unsigned int VImageDimension>
itk::SmartPointer< itk::Image< TPixel, VImageDimension > > GenerateConvolutionImage (const itk::Image< TPixel, VImageDimension > *inputImage)
 Convolves image with spherical kernel image. Used for hotspot calculation. More...
 
template<typename TPixel , unsigned int VImageDimension>
void FillHotspotMaskPixels (itk::Image< TPixel, VImageDimension > *maskImage, itk::Point< double, VImageDimension > sphereCenter, double sphereRadiusInMM)
 Fills pixels of the spherical hotspot mask. More...
 

Protected Attributes

mitk::Image::ConstPointer m_Image
 
mitk::Image::ConstPointer m_ImageMask
 
mitk::PlanarFigure::Pointer m_PlanarFigure
 
HistogramVector m_ImageHistogramVector
 
HistogramVector m_MaskedImageHistogramVector
 
HistogramVector m_PlanarFigureHistogramVector
 
HistogramType::Pointer m_EmptyHistogram
 
HistogramContainer m_EmptyHistogramContainer
 
StatisticsVector m_ImageStatisticsVector
 
StatisticsVector m_MaskedImageStatisticsVector
 
StatisticsVector m_PlanarFigureStatisticsVector
 
StatisticsVector m_MaskedImageHotspotStatisticsVector
 
Statistics m_EmptyStatistics
 
StatisticsContainer m_EmptyStatisticsContainer
 
unsigned int m_MaskingMode
 
bool m_MaskingModeChanged
 
mitk::Image::ConstPointer m_InternalImage
 
MaskImage3DType::Pointer m_InternalImageMask3D
 
MaskImage2DType::Pointer m_InternalImageMask2D
 
TimeStampVectorType m_ImageStatisticsTimeStampVector
 
TimeStampVectorType m_MaskedImageStatisticsTimeStampVector
 
TimeStampVectorType m_PlanarFigureStatisticsTimeStampVector
 
BoolVectorType m_ImageStatisticsCalculationTriggerVector
 
BoolVectorType m_MaskedImageStatisticsCalculationTriggerVector
 
BoolVectorType m_PlanarFigureStatisticsCalculationTriggerVector
 
double m_IgnorePixelValue
 
bool m_DoIgnorePixelValue
 
bool m_IgnorePixelValueChanged
 
unsigned int m_PlanarFigureAxis
 
unsigned int m_PlanarFigureSlice
 
int m_PlanarFigureCoordinate0
 
int m_PlanarFigureCoordinate1
 
double m_HistogramBinSize
 
bool m_UseDefaultBinSize
 Bin size for histogram resoluion. More...
 
bool m_UseBinSizeBasedOnVOIRegion
 
double m_HotspotRadiusInMM
 
bool m_CalculateHotspot
 
bool m_HotspotRadiusInMMChanged
 
bool m_HotspotMustBeCompletelyInsideImage
 

Detailed Description

Class for calculating statistics and histogram for an (optionally masked) image.

Images can be masked by either a label image (of the same dimensions as the original image) or by a closed mitk::PlanarFigure, e.g. a circle or polygon. When masking with a planar figure, the slice corresponding to the plane containing the figure is extracted and then clipped with contour defined by the figure. Planar figures need to be aligned along the main axes of the image (axial, sagittal, coronal). Planar figures on arbitrary rotated planes are not supported.

For each operating mode (no masking, masking by image, masking by planar figure), the calculated statistics and histogram are cached so that, when switching back and forth between operation modes without modifying mask or image, the information doesn't need to be recalculated.

The class also has the possibility to calculate the location and separate statistics for a region called "hotspot". The hotspot is a sphere of user-defined size and its location is chosen in a way that the average pixel value within the sphere is maximized.

Warning
Hotspot calculation does not work in case of 2D-images!

Note: currently time-resolved and multi-channel pictures are not properly supported.

Calculation of hotspot statistics

Since calculation of hotspot location and statistics is not straight-forward, the following paragraphs will describe it in more detail.

Note: Calculation of hotspot statistics is optional and set to off by default. Multilabel-masks are supported.

Hotspot Definition

The hotspot of an image is motivated from PET readings. It is defined as a spherical region of fixed size which maximizes the average pixel value within the region. The following image illustrates the concept: the colored areas are different image intensities and the hotspot is located in the hottest region of the image.

Note: Only hotspots are calculated for which the whole hotspot-sphere is inside the image by default. This behaviour can be changed by by calling SetHotspotMustBeCompletlyInsideImage().

Warning
Note that SetHotspotMustBeCompletlyInsideImage(false) may overrate "hot" regions at image borders, because they have a stronger influence on the mean value! Think clearly about this fact and make sure this is what you want/need in your application, before calling SetHotspotMustBeCompletlyInsideImage(false)!
hotspotexample.JPG

Hotspot Calculation

Since only the size of the hotspot is known initially, we need to calculate two aspects (both implemented in CalculateHotspotStatistics() ):

  • the hotspot location
  • statistics of the pixels within the hotspot.

Finding the hotspot location requires to calculate the average value at each position. This is done by convolution of the image with a sperical kernel image which reflects partial volumes (important in the case of low-resolution PET images).

Once the hotspot location is known, calculating the actual statistics is a simple task which is implemented in CalculateHotspotStatistics() using a second instance of the ImageStatisticsCalculator.

Step 1: Finding the hotspot by image convolution

As described above, we use image convolution with a rasterized sphere to average the image at each position. To handle coarse resolutions, which would normally force us to decide for partially contained voxels whether to count them or not, we supersample the kernel image and use non-integer kernel values (see GenerateHotspotSearchConvolutionKernel()), which reflect the volume part that is contained in the sphere. For example, if three subvoxels are inside the sphere, the corresponding kernel voxel gets a value of 0.75 (3 out of 4 subvoxels, see 2D example below).

convolutionkernelsupersampling.jpg

Convolution itself is done by means of the itkFFTConvolutionImageFilter. To find the hotspot location, we simply iterate the averaged image and find a maximum location (see CalculateExtremaWorld()). In case of images with multiple maxima the method returns value and corresponding index of the extrema that is found by the iterator first.

Step 2: Computation of hotspot statistics

Once the hotspot location is found, statistics for the region are calculated by simply iterating the input image and regarding all pixel centers inside the hotspot-sphere for statistics.

Warning
Index positions of maximum/minimum are not provided, because they are not necessarily unique

Tests

To check the correctness of the hotspot calculation, a special class (mitkImageStatisticsHotspotTest) has been created, which generates images with known hotspot location and statistics. A number of unit tests use this class to first generate an image of known properites and then verify that ImageStatisticsCalculator is able to reproduce the known statistics.

Definition at line 14 of file mitkImageStatisticsCalculator.h.

Member Typedef Documentation

Definition at line 359 of file old/mitkImageStatisticsCalculator.h.

typedef std::vector< bool > mitk::ImageStatisticsCalculator::BoolVectorType
protected

Definition at line 382 of file old/mitkImageStatisticsCalculator.h.

Definition at line 172 of file old/mitkImageStatisticsCalculator.h.

typedef std::vector< HistogramType::ConstPointer > mitk::ImageStatisticsCalculator::HistogramContainer

Definition at line 267 of file old/mitkImageStatisticsCalculator.h.

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

Definition at line 31 of file mitkImageStatisticsCalculator.h.

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

Definition at line 171 of file old/mitkImageStatisticsCalculator.h.

typedef itk::Image< unsigned short, 2 > mitk::ImageStatisticsCalculator::MaskImage2DType
protected

Definition at line 385 of file old/mitkImageStatisticsCalculator.h.

typedef itk::Image< unsigned short, 3 > mitk::ImageStatisticsCalculator::MaskImage3DType
protected

Definition at line 384 of file old/mitkImageStatisticsCalculator.h.

Definition at line 32 of file mitkImageStatisticsCalculator.h.

Definition at line 19 of file mitkImageStatisticsCalculator.h.

typedef std::vector< itk::TimeStamp > mitk::ImageStatisticsCalculator::TimeStampVectorType
protected

Definition at line 381 of file old/mitkImageStatisticsCalculator.h.

Member Enumeration Documentation

anonymous enum

Enum for possible masking modi.

Enumerator
MASKING_MODE_NONE 
MASKING_MODE_IMAGE 
MASKING_MODE_PLANARFIGURE 

Definition at line 164 of file old/mitkImageStatisticsCalculator.h.

Constructor & Destructor Documentation

mitk::ImageStatisticsCalculator::ImageStatisticsCalculator ( )
inlineprotected

Definition at line 366 of file mitkImageStatisticsCalculator.h.

mitk::ImageStatisticsCalculator::ImageStatisticsCalculator ( )
protected
mitk::ImageStatisticsCalculator::~ImageStatisticsCalculator ( )
protectedvirtual

Definition at line 105 of file old/mitkImageStatisticsCalculator.cpp.

Member Function Documentation

template<unsigned int VImageDimension>
itk::Size< VImageDimension > mitk::ImageStatisticsCalculator::CalculateConvolutionKernelSize ( double  spacing[VImageDimension],
double  radiusInMM 
)
protected

Returns size of convolution kernel depending on spacing and radius.

Definition at line 1759 of file old/mitkImageStatisticsCalculator.cpp.

template<typename TPixel , unsigned int VImageDimension>
ImageStatisticsCalculator::ImageExtrema mitk::ImageStatisticsCalculator::CalculateExtremaWorld ( const itk::Image< TPixel, VImageDimension > *  inputImage,
itk::Image< unsigned short, VImageDimension > *  maskImage,
double  neccessaryDistanceToImageBorderInMM,
unsigned int  label 
)
protected
template<typename TPixel , unsigned int VImageDimension>
ImageStatisticsCalculator::Statistics mitk::ImageStatisticsCalculator::CalculateHotspotStatistics ( const itk::Image< TPixel, VImageDimension > *  inputImage,
itk::Image< unsigned short, VImageDimension > *  maskImage,
double  radiusInMM,
bool &  isHotspotDefined,
unsigned int  label 
)
protected

Calculates the hotspot statistics depending on masking mode. Hotspot statistics are calculated for a hotspot which is completly located inside the image by default.

Definition at line 1946 of file old/mitkImageStatisticsCalculator.cpp.

References CalculateExtremaWorld(), mitk::ImageStatisticsCalculator::ImageExtrema::Defined, FillHotspotMaskPixels(), GenerateConvolutionImage(), mitk::ImageStatisticsCalculator::Statistics::GetMax(), mitk::ImageStatisticsCalculator::Statistics::GetMean(), mitk::ImageStatisticsCalculator::Statistics::GetMin(), mitk::ImageStatisticsCalculator::Statistics::GetSigma(), m_EmptyStatistics, m_HotspotMustBeCompletelyInsideImage, m_HotspotRadiusInMM, mitk::ImageStatisticsCalculator::ImageExtrema::Max, mitk::ImageStatisticsCalculator::ImageExtrema::MaxIndex, MITK_DEBUG, MITK_ERROR, mitk::New(), mitk::ImageStatisticsCalculator::Statistics::Reset(), mitk::ImageStatisticsCalculator::Statistics::SetHotspotIndex(), mitk::ImageStatisticsCalculator::Statistics::SetLabel(), mitk::ImageStatisticsCalculator::Statistics::SetMax(), mitk::ImageStatisticsCalculator::Statistics::SetMean(), mitk::ImageStatisticsCalculator::Statistics::SetMedian(), mitk::ImageStatisticsCalculator::Statistics::SetMin(), mitk::ImageStatisticsCalculator::Statistics::SetN(), mitk::ImageStatisticsCalculator::Statistics::SetRMS(), mitk::ImageStatisticsCalculator::Statistics::SetSigma(), and mitk::ImageStatisticsCalculator::Statistics::SetVariance().

Referenced by InternalCalculateStatisticsMasked(), and InternalCalculateStatisticsUnmasked().

Pointer mitk::ImageStatisticsCalculator::Clone ( ) const
template<typename ITK_Exporter , typename VTK_Importer >
void mitk::ImageStatisticsCalculator::ConnectPipelines ( ITK_Exporter  exporter,
vtkSmartPointer< VTK_Importer >  importer 
)
inlineprotected

Connection from ITK to VTK

Definition at line 476 of file old/mitkImageStatisticsCalculator.h.

Referenced by InternalCalculateMaskFromPlanarFigure().

template<typename VTK_Exporter , typename ITK_Importer >
void mitk::ImageStatisticsCalculator::ConnectPipelines ( vtkSmartPointer< VTK_Exporter >  exporter,
ITK_Importer  importer 
)
inlineprotected

Connection from VTK to ITK

Definition at line 497 of file old/mitkImageStatisticsCalculator.h.

void mitk::ImageStatisticsCalculator::ExtractImageAndMask ( unsigned int  timeStep = 0)
protected
template<typename TPixel , unsigned int VImageDimension>
void mitk::ImageStatisticsCalculator::FillHotspotMaskPixels ( itk::Image< TPixel, VImageDimension > *  maskImage,
itk::Point< double, VImageDimension >  sphereCenter,
double  sphereRadiusInMM 
)
protected

Fills pixels of the spherical hotspot mask.

Definition at line 1924 of file old/mitkImageStatisticsCalculator.cpp.

Referenced by CalculateHotspotStatistics().

template<typename TPixel , unsigned int VImageDimension>
itk::SmartPointer< itk::Image< TPixel, VImageDimension > > mitk::ImageStatisticsCalculator::GenerateConvolutionImage ( const itk::Image< TPixel, VImageDimension > *  inputImage)
protected

Convolves image with spherical kernel image. Used for hotspot calculation.

Definition at line 1878 of file old/mitkImageStatisticsCalculator.cpp.

References GetHotspotMustBeCompletlyInsideImage(), m_HotspotRadiusInMM, m_HotspotRadiusInMMChanged, MITK_DEBUG, and mitk::New().

Referenced by CalculateHotspotStatistics().

template<unsigned int VImageDimension>
itk::SmartPointer< itk::Image< float, VImageDimension > > mitk::ImageStatisticsCalculator::GenerateHotspotSearchConvolutionKernel ( double  spacing[VImageDimension],
double  radiusInMM 
)
protected

Generates image of kernel which is needed for convolution.

Definition at line 1781 of file old/mitkImageStatisticsCalculator.cpp.

References MITK_DEBUG, and mitk::New().

ImageStatisticsCalculator::BinFrequencyType mitk::ImageStatisticsCalculator::GetBinsAndFreuqencyForHistograms ( unsigned int  timeStep = 0,
unsigned int  label = 0 
) const

Definition at line 763 of file old/mitkImageStatisticsCalculator.cpp.

References GetHistogram().

double mitk::ImageStatisticsCalculator::GetBinSizeForHistogramStatistics ( ) const

Retrieve the bin size for histogram statistics. Careful: The return value does not indicate whether NBins or BinSize is used. That solely depends on which parameter has been set last.

Documentation

Definition at line 108 of file mitkImageStatisticsCalculator.cpp.

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

Runtime information support.

bool mitk::ImageStatisticsCalculator::GetDoIgnorePixelValue ( )

Get whether a pixel value will be ignored in the statistics.

Definition at line 460 of file old/mitkImageStatisticsCalculator.cpp.

References m_DoIgnorePixelValue.

const ImageStatisticsCalculator::HistogramType * mitk::ImageStatisticsCalculator::GetHistogram ( unsigned int  timeStep = 0,
unsigned int  label = 0 
) const

Retrieve the histogram depending on the current masking mode.

Parameters
labelThe label for which to retrieve the histogram in multi-label situations (ascending order).

Definition at line 784 of file old/mitkImageStatisticsCalculator.cpp.

References m_DoIgnorePixelValue, m_ImageHistogramVector, m_MaskedImageHistogramVector, m_MaskingMode, m_PlanarFigureHistogramVector, MASKING_MODE_IMAGE, MASKING_MODE_NONE, and MASKING_MODE_PLANARFIGURE.

Referenced by GetBinsAndFreuqencyForHistograms().

double mitk::ImageStatisticsCalculator::GetHistogramBinSize ( )

Get bin size for histogram resolution.

Definition at line 469 of file old/mitkImageStatisticsCalculator.cpp.

References m_HistogramBinSize.

const ImageStatisticsCalculator::HistogramContainer & mitk::ImageStatisticsCalculator::GetHistogramVector ( unsigned int  timeStep = 0) const
bool mitk::ImageStatisticsCalculator::GetHotspotMustBeCompletlyInsideImage ( ) const

Returns true if hotspot has to be completly inside the image.

Definition at line 518 of file old/mitkImageStatisticsCalculator.cpp.

References m_HotspotMustBeCompletelyInsideImage.

Referenced by GenerateConvolutionImage().

double mitk::ImageStatisticsCalculator::GetHotspotRadiusInMM ( )

Returns the radius of the hotspot.

Definition at line 488 of file old/mitkImageStatisticsCalculator.cpp.

References m_HotspotRadiusInMM.

Referenced by InternalCalculateStatisticsMasked().

double mitk::ImageStatisticsCalculator::GetIgnorePixelValue ( )

Get the pixel value for pixels that will be ignored in the statistics.

Definition at line 445 of file old/mitkImageStatisticsCalculator.cpp.

References m_IgnorePixelValue.

virtual unsigned int mitk::ImageStatisticsCalculator::GetMaskingMode ( )
virtual

Set/Get operation mode for masking.

template<typename TPixel , unsigned int VImageDimension>
void mitk::ImageStatisticsCalculator::GetMinAndMaxValue ( double &  minimum,
double &  maximum,
int &  counter,
double &  sigma,
const itk::Image< TPixel, VImageDimension > *  InputImage,
itk::Image< unsigned short, VImageDimension > *  MaskImageType 
)
protected
unsigned int mitk::ImageStatisticsCalculator::GetNBinsForHistogramStatistics ( ) const

Retrieve the number of bins used for histogram statistics. Careful: The return value does not indicate whether NBins or BinSize is used. That solely depends on which parameter has been set last.

Documentation

Definition at line 88 of file mitkImageStatisticsCalculator.cpp.

bool mitk::ImageStatisticsCalculator::GetPrincipalAxis ( const BaseGeometry geometry,
Vector3D  vector,
unsigned int &  axis 
)
protected

If the passed vector matches any of the three principal axes of the passed geometry, the ínteger value corresponding to the axis is set and true is returned.

Definition at line 1068 of file old/mitkImageStatisticsCalculator.cpp.

References mitk::eps, and mitk::BaseGeometry::GetAxisVector().

Referenced by ExtractImageAndMask().

ImageStatisticsCalculator::StatisticsContainer::Pointer mitk::ImageStatisticsCalculator::GetStatistics ( unsigned int  timeStep = 0,
unsigned int  label = 1 
)

Returns the statistics for label label and timeStep timeStep. If these requested statistics are not computed yet the computation is done as well. For performance reasons, statistics for all labels in the image are computed at once.

Documentation

Definition at line 113 of file mitkImageStatisticsCalculator.cpp.

References AccessByItk_1, MITK_WARN, mitkThrow, mitk::ImageTimeSelector::New(), and mitk::ImageStatisticsCalculator::StatisticsContainer::New().

const ImageStatisticsCalculator::Statistics & mitk::ImageStatisticsCalculator::GetStatistics ( unsigned int  timeStep = 0,
unsigned int  label = 0 
) const

Retrieve statistics depending on the current masking mode.

Parameters
labelThe label for which to retrieve the statistics in multi-label situations (ascending order).

Definition at line 839 of file old/mitkImageStatisticsCalculator.cpp.

References m_DoIgnorePixelValue, m_EmptyStatistics, m_ImageStatisticsVector, m_MaskedImageStatisticsVector, m_MaskingMode, m_PlanarFigureStatisticsVector, MASKING_MODE_IMAGE, MASKING_MODE_NONE, and MASKING_MODE_PLANARFIGURE.

const ImageStatisticsCalculator::StatisticsContainer & mitk::ImageStatisticsCalculator::GetStatisticsVector ( unsigned int  timeStep = 0) const
template<typename TPixel , unsigned int VImageDimension>
void mitk::ImageStatisticsCalculator::InternalCalculateMaskFromPlanarFigure ( const itk::Image< TPixel, VImageDimension > *  image,
unsigned int  axis 
)
protected
template<typename TPixel , unsigned int VImageDimension>
void mitk::ImageStatisticsCalculator::InternalCalculateStatisticsMasked ( const itk::Image< TPixel, VImageDimension > *  image,
itk::Image< unsigned short, VImageDimension > *  maskImage,
StatisticsContainer statisticsContainer,
HistogramContainer histogramContainer 
)
protected

Definition at line 1275 of file old/mitkImageStatisticsCalculator.cpp.

References CalculateHotspotStatistics(), mitk::eps, mitk::ImageStatisticsCalculator::Statistics::GetHotspotIndex(), GetHotspotRadiusInMM(), mitk::ImageStatisticsCalculator::Statistics::GetHotspotStatistics(), mitk::ImageStatisticsCalculator::Statistics::GetMax(), mitk::ImageStatisticsCalculator::Statistics::GetMean(), mitk::ImageStatisticsCalculator::Statistics::GetMin(), GetMinAndMaxValue(), mitk::ImageStatisticsCalculator::Statistics::GetSigma(), mitk::ImageStatisticsCalculator::Statistics::HasHotspotStatistics(), IsHotspotCalculated(), m_EmptyHistogram, m_HistogramBinSize, m_MaskingMode, m_PlanarFigureAxis, m_PlanarFigureCoordinate0, m_PlanarFigureCoordinate1, m_PlanarFigureSlice, m_UseBinSizeBasedOnVOIRegion, m_UseDefaultBinSize, MaskedStatisticsProgressUpdate(), MASKING_MODE_PLANARFIGURE, MITK_DEBUG, MITK_ERROR, mitkThrow, mitk::New(), offset, mitk::ImageStatisticsCalculator::Statistics::SetEntropy(), mitk::ImageStatisticsCalculator::Statistics::SetHotspotIndex(), mitk::ImageStatisticsCalculator::Statistics::SetKurtosis(), mitk::ImageStatisticsCalculator::Statistics::SetLabel(), mitk::ImageStatisticsCalculator::Statistics::SetMax(), mitk::ImageStatisticsCalculator::Statistics::SetMaxIndex(), mitk::ImageStatisticsCalculator::Statistics::SetMean(), mitk::ImageStatisticsCalculator::Statistics::SetMedian(), mitk::ImageStatisticsCalculator::Statistics::SetMin(), mitk::ImageStatisticsCalculator::Statistics::SetMinIndex(), mitk::ImageStatisticsCalculator::Statistics::SetMPP(), mitk::ImageStatisticsCalculator::Statistics::SetN(), mitk::ImageStatisticsCalculator::Statistics::SetRMS(), mitk::ImageStatisticsCalculator::Statistics::SetSigma(), mitk::ImageStatisticsCalculator::Statistics::SetSkewness(), mitk::ImageStatisticsCalculator::Statistics::SetUniformity(), mitk::ImageStatisticsCalculator::Statistics::SetUPP(), and mitk::ImageStatisticsCalculator::Statistics::SetVariance().

template<typename TPixel , unsigned int VImageDimension>
void mitk::ImageStatisticsCalculator::InternalCalculateStatisticsUnmasked ( const itk::Image< TPixel, VImageDimension > *  image,
StatisticsContainer statisticsContainer,
HistogramContainer histogramContainer 
)
protected

Definition at line 1096 of file old/mitkImageStatisticsCalculator.cpp.

References CalculateHotspotStatistics(), mitk::ImageStatisticsCalculator::Statistics::GetHotspotIndex(), mitk::ImageStatisticsCalculator::Statistics::GetHotspotStatistics(), mitk::ImageStatisticsCalculator::Statistics::GetMax(), mitk::ImageStatisticsCalculator::Statistics::GetMaxIndex(), mitk::ImageStatisticsCalculator::Statistics::GetMean(), mitk::ImageStatisticsCalculator::Statistics::GetMin(), mitk::ImageStatisticsCalculator::Statistics::GetMinIndex(), mitk::ImageStatisticsCalculator::Statistics::GetSigma(), mitk::ImageStatisticsCalculator::Statistics::HasHotspotStatistics(), IsHotspotCalculated(), m_HistogramBinSize, m_HotspotRadiusInMM, m_UseDefaultBinSize, MITK_DEBUG, MITK_ERROR, mitkThrow, mitk::New(), mitk::ImageStatisticsCalculator::Statistics::Reset(), mitk::ImageStatisticsCalculator::Statistics::SetEntropy(), mitk::ImageStatisticsCalculator::Statistics::SetHasHotspotStatistics(), mitk::ImageStatisticsCalculator::Statistics::SetHotspotIndex(), mitk::ImageStatisticsCalculator::Statistics::SetKurtosis(), mitk::ImageStatisticsCalculator::Statistics::SetLabel(), mitk::ImageStatisticsCalculator::Statistics::SetMax(), mitk::ImageStatisticsCalculator::Statistics::SetMean(), mitk::ImageStatisticsCalculator::Statistics::SetMedian(), mitk::ImageStatisticsCalculator::Statistics::SetMin(), mitk::ImageStatisticsCalculator::Statistics::SetMinIndex(), mitk::ImageStatisticsCalculator::Statistics::SetMPP(), mitk::ImageStatisticsCalculator::Statistics::SetN(), mitk::ImageStatisticsCalculator::Statistics::SetRMS(), mitk::ImageStatisticsCalculator::Statistics::SetSigma(), mitk::ImageStatisticsCalculator::Statistics::SetSkewness(), mitk::ImageStatisticsCalculator::Statistics::SetUniformity(), mitk::ImageStatisticsCalculator::Statistics::SetUPP(), mitk::ImageStatisticsCalculator::Statistics::SetVariance(), and UnmaskedStatisticsProgressUpdate().

template<typename TPixel , unsigned int VImageDimension>
void mitk::ImageStatisticsCalculator::InternalMaskIgnoredPixels ( const itk::Image< TPixel, VImageDimension > *  image,
itk::Image< unsigned short, VImageDimension > *  maskImage 
)
protected

Definition at line 1247 of file old/mitkImageStatisticsCalculator.cpp.

References m_IgnorePixelValue.

Referenced by ExtractImageAndMask().

bool mitk::ImageStatisticsCalculator::IsHotspotCalculated ( )

Returns true whether the hotspot should be calculated, otherwise false.

Definition at line 504 of file old/mitkImageStatisticsCalculator.cpp.

References m_CalculateHotspot.

Referenced by InternalCalculateStatisticsMasked(), and InternalCalculateStatisticsUnmasked().

void mitk::ImageStatisticsCalculator::MaskedStatisticsProgressUpdate ( )
protected
mitk::ImageStatisticsCalculator::mitkClassMacroItkParent ( ImageStatisticsCalculator  ,
itk::Object   
)
static Pointer mitk::ImageStatisticsCalculator::New ( )
static

Method for creation through the object factory.

Referenced by compute_statistics(), ExtractImageStatistics(), mitk::FeatureBasedEdgeDetectionFilter::GenerateData(), and main().

static Pointer mitk::ImageStatisticsCalculator::New ( )
static
void mitk::ImageStatisticsCalculator::SetBinSizeForHistogramStatistics ( double  binSize)

Set bin size to be used for histogram statistics. If nbins is set after bin size, nbins will be used instead!

Documentation

Definition at line 93 of file mitkImageStatisticsCalculator.cpp.

void mitk::ImageStatisticsCalculator::SetCalculateHotspot ( bool  calculateHotspot)

Sets whether the hotspot should be calculated.

Definition at line 493 of file old/mitkImageStatisticsCalculator.cpp.

References m_CalculateHotspot, and m_HotspotRadiusInMMChanged.

void mitk::ImageStatisticsCalculator::SetDoIgnorePixelValue ( bool  doit)

Set whether a pixel value should be ignored in the statistics.

Definition at line 450 of file old/mitkImageStatisticsCalculator.cpp.

References m_DoIgnorePixelValue, and m_IgnorePixelValueChanged.

void mitk::ImageStatisticsCalculator::SetHistogramBinSize ( double  size)

Set bin size for histogram resolution.

Definition at line 465 of file old/mitkImageStatisticsCalculator.cpp.

References m_HistogramBinSize.

void mitk::ImageStatisticsCalculator::SetHotspotMustBeCompletlyInsideImage ( bool  hotspotIsCompletlyInsideImage,
bool  warn = true 
)

Sets flag whether hotspot is completly inside the image. Please note that if set to false it can be possible that statistics are calculated for which the whole hotspot is not inside the image!

Warning
regarding positions at the image centers may produce unexpected hotspot locations, please see Hotspot Definition

Definition at line 509 of file old/mitkImageStatisticsCalculator.cpp.

References m_HotspotMustBeCompletelyInsideImage, and MITK_WARN.

void mitk::ImageStatisticsCalculator::SetHotspotRadiusInMM ( double  hotspotRadiusInMM)

Sets the radius for the hotspot.

Definition at line 474 of file old/mitkImageStatisticsCalculator.cpp.

References m_CalculateHotspot, m_HotspotRadiusInMM, and m_HotspotRadiusInMMChanged.

void mitk::ImageStatisticsCalculator::SetIgnorePixelValue ( double  value)

Set a pixel value for pixels that will be ignored in the statistics.

Definition at line 432 of file old/mitkImageStatisticsCalculator.cpp.

References m_DoIgnorePixelValue, m_IgnorePixelValue, and m_IgnorePixelValueChanged.

void mitk::ImageStatisticsCalculator::SetImageMask ( const mitk::Image imageMask)
void mitk::ImageStatisticsCalculator::SetInputImage ( mitk::Image::Pointer  image)

Set the image for which the statistics are to be computed.

Documentation

Definition at line 38 of file mitkImageStatisticsCalculator.cpp.

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

Set the mask generator that creates the mask which is to be used to calculate statistics. If no more mask is desired simply set.

Documentation

Parameters
maskto nullptr

Definition at line 50 of file mitkImageStatisticsCalculator.cpp.

void mitk::ImageStatisticsCalculator::SetMaskingMode ( unsigned int  mode)

Set/Get operation mode for masking.

Definition at line 389 of file old/mitkImageStatisticsCalculator.cpp.

References m_MaskingMode, and m_MaskingModeChanged.

void mitk::ImageStatisticsCalculator::SetMaskingModeToImage ( )

Set/Get operation mode for masking.

Definition at line 411 of file old/mitkImageStatisticsCalculator.cpp.

References m_MaskingMode, m_MaskingModeChanged, and MASKING_MODE_IMAGE.

void mitk::ImageStatisticsCalculator::SetMaskingModeToNone ( )

Set/Get operation mode for masking.

Definition at line 400 of file old/mitkImageStatisticsCalculator.cpp.

References m_MaskingMode, m_MaskingModeChanged, and MASKING_MODE_NONE.

void mitk::ImageStatisticsCalculator::SetMaskingModeToPlanarFigure ( )

Set/Get operation mode for masking.

Definition at line 422 of file old/mitkImageStatisticsCalculator.cpp.

References m_MaskingMode, m_MaskingModeChanged, and MASKING_MODE_PLANARFIGURE.

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

Set number of bins to be used for histogram statistics. If Bin size is set after number of bins, bin size will be used instead!

Documentation

Definition at line 73 of file mitkImageStatisticsCalculator.cpp.

void mitk::ImageStatisticsCalculator::SetPlanarFigure ( mitk::PlanarFigure planarFigure)
void mitk::ImageStatisticsCalculator::SetSecondaryMask ( mitk::MaskGenerator::Pointer  mask)

Set this if more than one mask should be applied (for instance if a IgnorePixelValueMask were to be used alongside with a segmentation). Both masks are combined using pixel wise AND operation. The secondary mask does not have to be the same size than the primary but they need to have some overlap.

Documentation

Definition at line 61 of file mitkImageStatisticsCalculator.cpp.

void mitk::ImageStatisticsCalculator::SetUseDefaultBinSize ( bool  useDefault)

Automatically calculate bin size to obtain 200 bins.

Definition at line 110 of file old/mitkImageStatisticsCalculator.cpp.

References m_UseDefaultBinSize.

void mitk::ImageStatisticsCalculator::UnmaskedStatisticsProgressUpdate ( )
protected

Member Data Documentation

bool mitk::ImageStatisticsCalculator::m_CalculateHotspot
protected
HistogramType::Pointer mitk::ImageStatisticsCalculator::m_EmptyHistogram
protected
HistogramContainer mitk::ImageStatisticsCalculator::m_EmptyHistogramContainer
protected

Definition at line 555 of file old/mitkImageStatisticsCalculator.h.

Referenced by GetHistogramVector().

Statistics mitk::ImageStatisticsCalculator::m_EmptyStatistics
protected
StatisticsContainer mitk::ImageStatisticsCalculator::m_EmptyStatisticsContainer
protected

Definition at line 564 of file old/mitkImageStatisticsCalculator.h.

Referenced by GetStatisticsVector().

double mitk::ImageStatisticsCalculator::m_HistogramBinSize
protected
bool mitk::ImageStatisticsCalculator::m_HotspotMustBeCompletelyInsideImage
protected
double mitk::ImageStatisticsCalculator::m_HotspotRadiusInMM
protected
bool mitk::ImageStatisticsCalculator::m_HotspotRadiusInMMChanged
protected
double mitk::ImageStatisticsCalculator::m_IgnorePixelValue
protected
bool mitk::ImageStatisticsCalculator::m_IgnorePixelValueChanged
protected
mitk::Image::ConstPointer mitk::ImageStatisticsCalculator::m_Image
protected

m_Image contains the input image (e.g. 2D, 3D, 3D+t)

Definition at line 544 of file old/mitkImageStatisticsCalculator.h.

HistogramVector mitk::ImageStatisticsCalculator::m_ImageHistogramVector
protected
mitk::Image::ConstPointer mitk::ImageStatisticsCalculator::m_ImageMask
protected
BoolVectorType mitk::ImageStatisticsCalculator::m_ImageStatisticsCalculationTriggerVector
protected

Definition at line 578 of file old/mitkImageStatisticsCalculator.h.

Referenced by ComputeStatistics(), and SetImage().

TimeStampVectorType mitk::ImageStatisticsCalculator::m_ImageStatisticsTimeStampVector
protected

Definition at line 574 of file old/mitkImageStatisticsCalculator.h.

Referenced by ComputeStatistics(), and SetImage().

StatisticsVector mitk::ImageStatisticsCalculator::m_ImageStatisticsVector
protected
mitk::Image::ConstPointer mitk::ImageStatisticsCalculator::m_InternalImage
protected

m_InternalImage contains a image volume at one time step (e.g. 2D, 3D)

Definition at line 570 of file old/mitkImageStatisticsCalculator.h.

Referenced by ComputeStatistics(), and ExtractImageAndMask().

MaskImage2DType::Pointer mitk::ImageStatisticsCalculator::m_InternalImageMask2D
protected
MaskImage3DType::Pointer mitk::ImageStatisticsCalculator::m_InternalImageMask3D
protected

Definition at line 571 of file old/mitkImageStatisticsCalculator.h.

Referenced by ComputeStatistics(), and ExtractImageAndMask().

HistogramVector mitk::ImageStatisticsCalculator::m_MaskedImageHistogramVector
protected
StatisticsVector mitk::ImageStatisticsCalculator::m_MaskedImageHotspotStatisticsVector
protected

Definition at line 561 of file old/mitkImageStatisticsCalculator.h.

BoolVectorType mitk::ImageStatisticsCalculator::m_MaskedImageStatisticsCalculationTriggerVector
protected

Definition at line 579 of file old/mitkImageStatisticsCalculator.h.

Referenced by ComputeStatistics(), SetImage(), and SetImageMask().

TimeStampVectorType mitk::ImageStatisticsCalculator::m_MaskedImageStatisticsTimeStampVector
protected

Definition at line 575 of file old/mitkImageStatisticsCalculator.h.

Referenced by ComputeStatistics(), SetImage(), and SetImageMask().

StatisticsVector mitk::ImageStatisticsCalculator::m_MaskedImageStatisticsVector
protected
bool mitk::ImageStatisticsCalculator::m_MaskingModeChanged
protected
mitk::PlanarFigure::Pointer mitk::ImageStatisticsCalculator::m_PlanarFigure
protected
unsigned int mitk::ImageStatisticsCalculator::m_PlanarFigureAxis
protected
int mitk::ImageStatisticsCalculator::m_PlanarFigureCoordinate0
protected
int mitk::ImageStatisticsCalculator::m_PlanarFigureCoordinate1
protected
HistogramVector mitk::ImageStatisticsCalculator::m_PlanarFigureHistogramVector
protected
unsigned int mitk::ImageStatisticsCalculator::m_PlanarFigureSlice
protected
BoolVectorType mitk::ImageStatisticsCalculator::m_PlanarFigureStatisticsCalculationTriggerVector
protected
TimeStampVectorType mitk::ImageStatisticsCalculator::m_PlanarFigureStatisticsTimeStampVector
protected
StatisticsVector mitk::ImageStatisticsCalculator::m_PlanarFigureStatisticsVector
protected
bool mitk::ImageStatisticsCalculator::m_UseBinSizeBasedOnVOIRegion
protected
bool mitk::ImageStatisticsCalculator::m_UseDefaultBinSize
protected

Bin size for histogram resoluion.

Definition at line 592 of file old/mitkImageStatisticsCalculator.h.

Referenced by InternalCalculateStatisticsMasked(), InternalCalculateStatisticsUnmasked(), and SetUseDefaultBinSize().


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