Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkImageStatisticsCalculator.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkImageStatisticsCalculator_h
14 #define mitkImageStatisticsCalculator_h
15 
17 #include <mitkImage.h>
18 #include <mitkMaskGenerator.h>
20 
21 namespace mitk
22 {
24  {
25  public:
28  typedef itk::Object Superclass;
31 
33  itkNewMacro(Self);
34  itkTypeMacro(ImageStatisticsCalculator, itk::Object);
35 
36  typedef double statisticsValueType;
37  typedef std::map<std::string, statisticsValueType> statisticsMapType;
38  typedef itk::Statistics::Histogram<double> HistogramType;
39  typedef unsigned short MaskPixelType;
41 
44  void SetInputImage(const mitk::Image* image);
45 
48  void SetMask(mitk::MaskGenerator* mask);
49 
53  void SetSecondaryMask(mitk::MaskGenerator* mask);
54 
57  void SetNBinsForHistogramStatistics(unsigned int nBins);
58 
62  unsigned int GetNBinsForHistogramStatistics() const;
63 
66  void SetBinSizeForHistogramStatistics(double binSize);
67 
71  double GetBinSizeForHistogramStatistics() const;
72 
76  ImageStatisticsContainer* GetStatistics();
77 
78  protected:
80  m_nBinsForHistogramStatistics = 100;
81  m_binSizeForHistogramStatistics = 10;
82  m_UseBinSizeOverNBins = false;
83  };
84 
85 
86  private:
87  //Calculates statistics for each timestep for image
88  template < typename TPixel, unsigned int VImageDimension >
89  void InternalCalculateStatisticsUnmasked(const itk::Image< TPixel, VImageDimension >* image, TimeStepType timeStep);
90 
91  template < typename TPixel, unsigned int VImageDimension >
92  void InternalCalculateStatisticsMasked(const itk::Image< TPixel, VImageDimension >* image, TimeStepType timeStep);
93 
94  template < typename TPixel, unsigned int VImageDimension >
95  double GetVoxelVolume(const itk::Image<TPixel, VImageDimension>* image) const;
96 
97  bool IsUpdateRequired() const;
98 
100  mitk::Image::ConstPointer m_ImageTimeSlice;
101  mitk::Image::ConstPointer m_InternalImageForStatistics;
102 
103  mitk::MaskGenerator::Pointer m_MaskGenerator;
104  mitk::Image::ConstPointer m_InternalMask;
105 
106  mitk::MaskGenerator::Pointer m_SecondaryMaskGenerator;
107  mitk::Image::ConstPointer m_SecondaryMask;
108 
109  unsigned int m_nBinsForHistogramStatistics;
110  double m_binSizeForHistogramStatistics;
111  bool m_UseBinSizeOverNBins;
112 
113  ImageStatisticsContainer::Pointer m_StatisticContainer;
114  };
115 
116 }
117 #endif
mitkImage.h
mitk::ImageStatisticsCalculator::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: mitkImageStatisticsCalculator.h:30
mitk::ImageStatisticsCalculator::Pointer
itk::SmartPointer< Self > Pointer
Definition: mitkImageStatisticsCalculator.h:29
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
itk::SmartPointer< Self >
mitk::ImageStatisticsCalculator
Definition: mitkImageStatisticsCalculator.h:23
mitk::ImageStatisticsContainer::LabelValueType
LabelSetImage::LabelValueType LabelValueType
Definition: mitkImageStatisticsContainer.h:42
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ImageStatisticsContainer
Container class for storing a StatisticsObject for each time step.
Definition: mitkImageStatisticsContainer.h:34
mitkMaskGenerator.h
MITKIMAGESTATISTICS_EXPORT
#define MITKIMAGESTATISTICS_EXPORT
Definition: MitkImageStatisticsExports.h:15
mitk::ImageStatisticsCalculator::HistogramType
itk::Statistics::Histogram< double > HistogramType
Definition: mitkImageStatisticsCalculator.h:38
mitk::TimeStepType
std::size_t TimeStepType
Definition: mitkTimeGeometry.h:27
mitk::ImageStatisticsCalculator::MaskPixelType
unsigned short MaskPixelType
Definition: mitkImageStatisticsCalculator.h:39
mitk::ImageStatisticsCalculator::statisticsMapType
std::map< std::string, statisticsValueType > statisticsMapType
Definition: mitkImageStatisticsCalculator.h:37
mitk::ImageStatisticsCalculator::ImageStatisticsCalculator
ImageStatisticsCalculator()
Definition: mitkImageStatisticsCalculator.h:79
mitk::ImageStatisticsCalculator::Self
ImageStatisticsCalculator Self
Definition: mitkImageStatisticsCalculator.h:27
MitkImageStatisticsExports.h
mitk::MaskGenerator
Base Class for all Mask Generators. Mask generators are classes that provide functionality for the cr...
Definition: mitkMaskGenerator.h:30
mitk::ImageStatisticsCalculator::statisticsValueType
double statisticsValueType
Definition: mitkImageStatisticsCalculator.h:34
mitk::ImageStatisticsCalculator::LabelIndex
ImageStatisticsContainer::LabelValueType LabelIndex
Definition: mitkImageStatisticsCalculator.h:40
mitkImageStatisticsContainer.h
mitk::ImageStatisticsCalculator::Superclass
itk::Object Superclass
Definition: mitkImageStatisticsCalculator.h:28