Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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_v2, 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 
77  ImageStatisticsContainer* GetStatistics(LabelIndex label=1);
78 
79  protected:
81  m_nBinsForHistogramStatistics = 100;
82  m_binSizeForHistogramStatistics = 10;
83  m_UseBinSizeOverNBins = false;
84  };
85 
86 
87  private:
88  //Calculates statistics for each timestep for image
89  template < typename TPixel, unsigned int VImageDimension > void InternalCalculateStatisticsUnmasked(
90  typename itk::Image< TPixel, VImageDimension >* image, const TimeGeometry* timeGeometry, TimeStepType timeStep);
91 
92  template < typename TPixel, unsigned int VImageDimension > void InternalCalculateStatisticsMasked(
93  typename itk::Image< TPixel, VImageDimension >* image, const TimeGeometry* timeGeometry,
94  unsigned int timeStep);
95 
96  template < typename TPixel, unsigned int VImageDimension >
97  double GetVoxelVolume(typename itk::Image<TPixel, VImageDimension>* image) const;
98 
99  bool IsUpdateRequired(LabelIndex label) const;
100 
102  mitk::Image::Pointer m_ImageTimeSlice;
103  mitk::Image::ConstPointer m_InternalImageForStatistics;
104 
105  mitk::MaskGenerator::Pointer m_MaskGenerator;
106  mitk::Image::ConstPointer m_InternalMask;
107 
108  mitk::MaskGenerator::Pointer m_SecondaryMaskGenerator;
109  mitk::Image::ConstPointer m_SecondaryMask;
110 
111  unsigned int m_nBinsForHistogramStatistics;
112  double m_binSizeForHistogramStatistics;
113  bool m_UseBinSizeOverNBins;
114 
115  std::map<LabelIndex,ImageStatisticsContainer::Pointer> m_StatisticContainers;
116  };
117 
118 }
119 #endif
mitk::TimeGeometry
Definition: mitkTimeGeometry.h:43
mitkImage.h
mitk::ImageStatisticsCalculator::LabelIndex
ImageStatisticsContainer::LabelIndex LabelIndex
Definition: mitkImageStatisticsCalculator.h:40
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
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ImageStatisticsContainer
Container class for storing a StatisticsObject for each timestep.
Definition: mitkImageStatisticsContainer.h:33
mitkMaskGenerator.h
mitk::ImageStatisticsContainer::LabelIndex
unsigned int LabelIndex
Definition: mitkImageStatisticsContainer.h:42
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:80
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
mitkImageStatisticsContainer.h
mitk::ImageStatisticsCalculator::Superclass
itk::Object Superclass
Definition: mitkImageStatisticsCalculator.h:28