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

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

#include <mitkPartialVolumeAnalysisHistogramCalculator.h>

Inheritance diagram for mitk::PartialVolumeAnalysisHistogramCalculator:
Collaboration diagram for mitk::PartialVolumeAnalysisHistogramCalculator:

Classes

struct  Statistics
 

Public Types

enum  { MASKING_MODE_NONE, MASKING_MODE_IMAGE, MASKING_MODE_PLANARFIGURE }
 
typedef mitk::Image::HistogramType HistogramType
 
typedef mitk::Image::HistogramType::ConstIterator HistogramConstIteratorType
 
typedef Statistics StatisticsType
 
typedef itk::TimeStamp TimeStampType
 
typedef bool BoolType
 
typedef itk::Image< unsigned char, 3 > MaskImage3DType
 
typedef itk::Image< unsigned char, 2 > MaskImage2DType
 
typedef itk::Image< float, 2 > InternalImage2DType
 

Public Member Functions

 mitkClassMacroItkParent (PartialVolumeAnalysisHistogramCalculator, itk::Object) static Pointer New()
 
Pointer Clone () const
 
void SetImage (const mitk::Image *image)
 Set image from which to compute statistics. More...
 
void SetImageMask (const mitk::Image *imageMask)
 Set binary image for masking. More...
 
void SetPlanarFigure (const mitk::PlanarFigure *planarFigure)
 Set planar figure for masking. More...
 
void AddAdditionalResamplingImage (const mitk::Image *image)
 Set image for which the same resampling will be applied. and available via GetAdditionalResampledImage() 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 SetNumberOfBins (unsigned int number)
 Set histogram number of bins. More...
 
unsigned int GetNumberOfBins ()
 Get histogram number of bins. More...
 
void SetUpsamplingFactor (float number)
 Set upsampling factor. More...
 
float GetUpsamplingFactor ()
 Get upsampling factor. More...
 
void SetGaussianSigma (float number)
 Set gaussian sigma. More...
 
unsigned int GetPlanarFigureThickness ()
 Get thickness of planar figure. More...
 
void SetPlanarFigureThickness (unsigned int number)
 Set thickness of planar figure. More...
 
float GetGaussianSigma ()
 Get histogram number of bins. More...
 
void SetModified ()
 
virtual bool ComputeStatistics ()
 Compute statistics (together with histogram) for the current masking mode. More...
 
const HistogramTypeGetHistogram () const
 Retrieve the histogram depending on the current masking mode. More...
 
const StatisticsGetStatistics () const
 Retrieve statistics depending on the current masking mode. More...
 
const Image::Pointer GetInternalImage ()
 
const Image::Pointer GetInternalAdditionalResampledImage (unsigned int i)
 
void SetForceUpdate (bool b)
 

Protected Member Functions

 PartialVolumeAnalysisHistogramCalculator ()
 
virtual ~PartialVolumeAnalysisHistogramCalculator ()
 
void ExtractImageAndMask ()
 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...
 
bool GetPrincipalAxis (const Geometry3D *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, Statistics &statistics, typename HistogramType::ConstPointer *histogram)
 
template<typename TPixel , unsigned int VImageDimension>
void InternalCalculateStatisticsMasked (const itk::Image< TPixel, VImageDimension > *image, itk::Image< unsigned char, VImageDimension > *maskImage, Statistics &statistics, typename HistogramType::ConstPointer *histogram)
 
template<typename TPixel , unsigned int VImageDimension>
void InternalCalculateMaskFromPlanarFigure (itk::Image< TPixel, VImageDimension > *image, unsigned int axis)
 
template<typename TPixel , unsigned int VImageDimension>
void InternalReorientImagePlane (const itk::Image< TPixel, VImageDimension > *image, mitk::BaseGeometry *imggeo, mitk::BaseGeometry *planegeo3D, int additionalIndex)
 
template<typename TPixel , unsigned int VImageDimension>
void InternalResampleImageFromMask (const itk::Image< TPixel, VImageDimension > *image, int additionalIndex)
 
void InternalResampleImage (const MaskImage3DType *image)
 
template<typename TPixel , unsigned int VImageDimension>
void InternalCropAdditionalImage (itk::Image< TPixel, VImageDimension > *image, int additionalIndex)
 
void InternalMaskImage (mitk::Image *image)
 
template<typename ITK_Exporter , typename VTK_Importer >
void ConnectPipelines (ITK_Exporter exporter, VTK_Importer *importer)
 
template<typename VTK_Exporter , typename ITK_Importer >
void ConnectPipelines (VTK_Exporter *exporter, ITK_Importer importer)
 
void UnmaskedStatisticsProgressUpdate ()
 
void MaskedStatisticsProgressUpdate ()
 

Protected Attributes

mitk::Image::ConstPointer m_Image
 
mitk::Image::ConstPointer m_ImageMask
 
mitk::PlanarFigure::ConstPointer m_PlanarFigure
 
HistogramType::ConstPointer m_ImageHistogram
 
HistogramType::ConstPointer m_MaskedImageHistogram
 
HistogramType::ConstPointer m_PlanarFigureHistogram
 
HistogramType::Pointer m_EmptyHistogram
 
StatisticsType m_ImageStatistics
 
StatisticsType m_MaskedImageStatistics
 
StatisticsType m_PlanarFigureStatistics
 
Statistics m_EmptyStatistics
 
unsigned int m_MaskingMode
 
bool m_MaskingModeChanged
 
mitk::Image::Pointer m_InternalImage
 
MaskImage3DType::Pointer m_InternalImageMask3D
 
MaskImage2DType::Pointer m_InternalImageMask2D
 
itk::ImageRegion< 3 > m_InternalMask3D
 
std::vector< mitk::Image::ConstPointerm_AdditionalResamplingImages
 
std::vector< mitk::Image::Pointerm_InternalAdditionalResamplingImages
 
TimeStampType m_ImageStatisticsTimeStamp
 
TimeStampType m_MaskedImageStatisticsTimeStamp
 
TimeStampType m_PlanarFigureStatisticsTimeStamp
 
BoolType m_ImageStatisticsCalculationTriggerBool
 
BoolType m_MaskedImageStatisticsCalculationTriggerBool
 
BoolType m_PlanarFigureStatisticsCalculationTriggerBool
 
unsigned int m_NumberOfBins
 
float m_UpsamplingFactor
 
float m_GaussianSigma
 
itk::ImageRegion< 3 > m_CropRegion
 
bool m_ForceUpdate
 
unsigned int m_PlanarFigureThickness
 

Detailed Description

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

Images can be masked by either a (binary) 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.

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

Definition at line 57 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

Member Typedef Documentation

typedef mitk::Image::HistogramType::ConstIterator mitk::PartialVolumeAnalysisHistogramCalculator::HistogramConstIteratorType

Member Enumeration Documentation

anonymous enum
Enumerator
MASKING_MODE_NONE 
MASKING_MODE_IMAGE 
MASKING_MODE_PLANARFIGURE 

Definition at line 61 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

Constructor & Destructor Documentation

mitk::PartialVolumeAnalysisHistogramCalculator::PartialVolumeAnalysisHistogramCalculator ( )
protected
mitk::PartialVolumeAnalysisHistogramCalculator::~PartialVolumeAnalysisHistogramCalculator ( )
protectedvirtual

Member Function Documentation

void mitk::PartialVolumeAnalysisHistogramCalculator::AddAdditionalResamplingImage ( const mitk::Image image)

Set image for which the same resampling will be applied. and available via GetAdditionalResampledImage()

Definition at line 104 of file mitkPartialVolumeAnalysisHistogramCalculator.cpp.

References m_AdditionalResamplingImages, m_ImageStatisticsCalculationTriggerBool, and m_ImageStatisticsTimeStamp.

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

Connection from ITK to VTK

Definition at line 291 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

Referenced by InternalCalculateMaskFromPlanarFigure().

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

Connection from VTK to ITK

Definition at line 312 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

void mitk::PartialVolumeAnalysisHistogramCalculator::ExtractImageAndMask ( )
protected

Depending on the masking mode, the image and mask from which to calculate statistics is extracted from the original input image and mask data.

For example, a when using a PlanarFigure as mask, the 2D image slice corresponding to the PlanarFigure will be extracted from the original image. If masking is disabled, the original image is simply passed through.

Definition at line 403 of file mitkPartialVolumeAnalysisHistogramCalculator.cpp.

References AccessFixedDimensionByItk_1, AccessFixedDimensionByItk_3, mitk::BaseData::GetGeometry(), mitk::BaseData::GetUpdatedGeometry(), InternalCalculateMaskFromPlanarFigure(), InternalCropAdditionalImage(), InternalMaskImage(), InternalReorientImagePlane(), InternalResampleImage(), InternalResampleImageFromMask(), m_AdditionalResamplingImages, m_Image, m_ImageMask, m_InternalAdditionalResamplingImages, m_InternalImage, m_InternalImageMask2D, m_InternalImageMask3D, m_MaskingMode, m_PlanarFigure, m_UpsamplingFactor, MASKING_MODE_IMAGE, MASKING_MODE_NONE, MASKING_MODE_PLANARFIGURE, MITK_DEBUG, and mitk::ImageTimeSelector::New().

Referenced by ComputeStatistics().

float mitk::PartialVolumeAnalysisHistogramCalculator::GetGaussianSigma ( )
inline

Get histogram number of bins.

Definition at line 191 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

const PartialVolumeAnalysisHistogramCalculator::HistogramType * mitk::PartialVolumeAnalysisHistogramCalculator::GetHistogram ( ) const
const Image::Pointer mitk::PartialVolumeAnalysisHistogramCalculator::GetInternalAdditionalResampledImage ( unsigned int  i)
inline
const Image::Pointer mitk::PartialVolumeAnalysisHistogramCalculator::GetInternalImage ( )
inline
virtual unsigned int mitk::PartialVolumeAnalysisHistogramCalculator::GetMaskingMode ( )
virtual

Set/Get operation mode for masking.

unsigned int mitk::PartialVolumeAnalysisHistogramCalculator::GetNumberOfBins ( )
inline

Get histogram number of bins.

Definition at line 148 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

unsigned int mitk::PartialVolumeAnalysisHistogramCalculator::GetPlanarFigureThickness ( )
inline

Get thickness of planar figure.

Definition at line 176 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

bool mitk::PartialVolumeAnalysisHistogramCalculator::GetPrincipalAxis ( const Geometry3D 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 538 of file mitkPartialVolumeAnalysisHistogramCalculator.cpp.

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

const PartialVolumeAnalysisHistogramCalculator::Statistics & mitk::PartialVolumeAnalysisHistogramCalculator::GetStatistics ( ) const
float mitk::PartialVolumeAnalysisHistogramCalculator::GetUpsamplingFactor ( )
inline

Get upsampling factor.

Definition at line 162 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

template<typename TPixel , unsigned int VImageDimension>
void mitk::PartialVolumeAnalysisHistogramCalculator::InternalCalculateMaskFromPlanarFigure ( itk::Image< TPixel, VImageDimension > *  image,
unsigned int  axis 
)
protected
template<typename TPixel , unsigned int VImageDimension>
void mitk::PartialVolumeAnalysisHistogramCalculator::InternalCalculateStatisticsMasked ( const itk::Image< TPixel, VImageDimension > *  image,
itk::Image< unsigned char, VImageDimension > *  maskImage,
Statistics statistics,
typename HistogramType::ConstPointer *  histogram 
)
protected
template<typename TPixel , unsigned int VImageDimension>
void mitk::PartialVolumeAnalysisHistogramCalculator::InternalCropAdditionalImage ( itk::Image< TPixel, VImageDimension > *  image,
int  additionalIndex 
)
protected
void mitk::PartialVolumeAnalysisHistogramCalculator::InternalMaskImage ( mitk::Image image)
protected
template<typename TPixel , unsigned int VImageDimension>
void mitk::PartialVolumeAnalysisHistogramCalculator::InternalReorientImagePlane ( const itk::Image< TPixel, VImageDimension > *  image,
mitk::BaseGeometry imggeo,
mitk::BaseGeometry planegeo3D,
int  additionalIndex 
)
protected
void mitk::PartialVolumeAnalysisHistogramCalculator::InternalResampleImage ( const MaskImage3DType image)
protected
template<typename TPixel , unsigned int VImageDimension>
void mitk::PartialVolumeAnalysisHistogramCalculator::InternalResampleImageFromMask ( const itk::Image< TPixel, VImageDimension > *  image,
int  additionalIndex 
)
protected
void mitk::PartialVolumeAnalysisHistogramCalculator::MaskedStatisticsProgressUpdate ( )
protected
mitk::PartialVolumeAnalysisHistogramCalculator::mitkClassMacroItkParent ( PartialVolumeAnalysisHistogramCalculator  ,
itk::Object   
)
void mitk::PartialVolumeAnalysisHistogramCalculator::SetForceUpdate ( bool  b)
inline
void mitk::PartialVolumeAnalysisHistogramCalculator::SetGaussianSigma ( float  number)
inline

Set gaussian sigma.

Definition at line 166 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

void mitk::PartialVolumeAnalysisHistogramCalculator::SetImage ( const mitk::Image image)

Set image from which to compute statistics.

Definition at line 92 of file mitkPartialVolumeAnalysisHistogramCalculator.cpp.

References m_Image, m_ImageStatisticsCalculationTriggerBool, and m_ImageStatisticsTimeStamp.

void mitk::PartialVolumeAnalysisHistogramCalculator::SetImageMask ( const mitk::Image imageMask)
void mitk::PartialVolumeAnalysisHistogramCalculator::SetMaskingMode ( unsigned int  mode)

Set/Get operation mode for masking.

Definition at line 164 of file mitkPartialVolumeAnalysisHistogramCalculator.cpp.

References m_MaskingMode, and m_MaskingModeChanged.

void mitk::PartialVolumeAnalysisHistogramCalculator::SetMaskingModeToImage ( )

Set/Get operation mode for masking.

Definition at line 186 of file mitkPartialVolumeAnalysisHistogramCalculator.cpp.

References m_MaskingMode, m_MaskingModeChanged, and MASKING_MODE_IMAGE.

void mitk::PartialVolumeAnalysisHistogramCalculator::SetMaskingModeToNone ( )

Set/Get operation mode for masking.

Definition at line 175 of file mitkPartialVolumeAnalysisHistogramCalculator.cpp.

References m_MaskingMode, m_MaskingModeChanged, and MASKING_MODE_NONE.

void mitk::PartialVolumeAnalysisHistogramCalculator::SetMaskingModeToPlanarFigure ( )

Set/Get operation mode for masking.

Definition at line 197 of file mitkPartialVolumeAnalysisHistogramCalculator.cpp.

References m_MaskingMode, m_MaskingModeChanged, and MASKING_MODE_PLANARFIGURE.

void mitk::PartialVolumeAnalysisHistogramCalculator::SetNumberOfBins ( unsigned int  number)
inline

Set histogram number of bins.

Definition at line 138 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

void mitk::PartialVolumeAnalysisHistogramCalculator::SetPlanarFigure ( const mitk::PlanarFigure planarFigure)
void mitk::PartialVolumeAnalysisHistogramCalculator::SetPlanarFigureThickness ( unsigned int  number)
inline

Set thickness of planar figure.

Definition at line 181 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

void mitk::PartialVolumeAnalysisHistogramCalculator::SetUpsamplingFactor ( float  number)
inline

Set upsampling factor.

Definition at line 152 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

void mitk::PartialVolumeAnalysisHistogramCalculator::UnmaskedStatisticsProgressUpdate ( )
protected

Member Data Documentation

std::vector<mitk::Image::ConstPointer> mitk::PartialVolumeAnalysisHistogramCalculator::m_AdditionalResamplingImages
protected
itk::ImageRegion<3> mitk::PartialVolumeAnalysisHistogramCalculator::m_CropRegion
protected
HistogramType::Pointer mitk::PartialVolumeAnalysisHistogramCalculator::m_EmptyHistogram
protected
Statistics mitk::PartialVolumeAnalysisHistogramCalculator::m_EmptyStatistics
protected
bool mitk::PartialVolumeAnalysisHistogramCalculator::m_ForceUpdate
protected

Definition at line 376 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

Referenced by ComputeStatistics().

float mitk::PartialVolumeAnalysisHistogramCalculator::m_GaussianSigma
protected
mitk::Image::ConstPointer mitk::PartialVolumeAnalysisHistogramCalculator::m_Image
protected
HistogramType::ConstPointer mitk::PartialVolumeAnalysisHistogramCalculator::m_ImageHistogram
protected
mitk::Image::ConstPointer mitk::PartialVolumeAnalysisHistogramCalculator::m_ImageMask
protected
StatisticsType mitk::PartialVolumeAnalysisHistogramCalculator::m_ImageStatistics
protected
BoolType mitk::PartialVolumeAnalysisHistogramCalculator::m_ImageStatisticsCalculationTriggerBool
protected
TimeStampType mitk::PartialVolumeAnalysisHistogramCalculator::m_ImageStatisticsTimeStamp
protected
std::vector<mitk::Image::Pointer> mitk::PartialVolumeAnalysisHistogramCalculator::m_InternalAdditionalResamplingImages
protected
MaskImage2DType::Pointer mitk::PartialVolumeAnalysisHistogramCalculator::m_InternalImageMask2D
protected
MaskImage3DType::Pointer mitk::PartialVolumeAnalysisHistogramCalculator::m_InternalImageMask3D
protected
itk::ImageRegion<3> mitk::PartialVolumeAnalysisHistogramCalculator::m_InternalMask3D
protected

Definition at line 356 of file mitkPartialVolumeAnalysisHistogramCalculator.h.

Referenced by InternalMaskImage().

HistogramType::ConstPointer mitk::PartialVolumeAnalysisHistogramCalculator::m_MaskedImageHistogram
protected
StatisticsType mitk::PartialVolumeAnalysisHistogramCalculator::m_MaskedImageStatistics
protected
BoolType mitk::PartialVolumeAnalysisHistogramCalculator::m_MaskedImageStatisticsCalculationTriggerBool
protected
TimeStampType mitk::PartialVolumeAnalysisHistogramCalculator::m_MaskedImageStatisticsTimeStamp
protected
unsigned int mitk::PartialVolumeAnalysisHistogramCalculator::m_MaskingMode
protected
bool mitk::PartialVolumeAnalysisHistogramCalculator::m_MaskingModeChanged
protected
unsigned int mitk::PartialVolumeAnalysisHistogramCalculator::m_NumberOfBins
protected
mitk::PlanarFigure::ConstPointer mitk::PartialVolumeAnalysisHistogramCalculator::m_PlanarFigure
protected
HistogramType::ConstPointer mitk::PartialVolumeAnalysisHistogramCalculator::m_PlanarFigureHistogram
protected
StatisticsType mitk::PartialVolumeAnalysisHistogramCalculator::m_PlanarFigureStatistics
protected
BoolType mitk::PartialVolumeAnalysisHistogramCalculator::m_PlanarFigureStatisticsCalculationTriggerBool
protected
TimeStampType mitk::PartialVolumeAnalysisHistogramCalculator::m_PlanarFigureStatisticsTimeStamp
protected
unsigned int mitk::PartialVolumeAnalysisHistogramCalculator::m_PlanarFigureThickness
protected
float mitk::PartialVolumeAnalysisHistogramCalculator::m_UpsamplingFactor
protected

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