Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkHotspotMaskGenerator.h
Go to the documentation of this file.
1 #ifndef MITKHOTSPOTCALCULATOR_H
2 #define MITKHOTSPOTCALCULATOR_H
3 
4 #include <itkObject.h>
5 #include <mitkImage.h>
6 #include <itkImage.h>
7 #include <itkTimeStamp.h>
8 #include <stdexcept>
10 #include <mitkImageTimeSelector.h>
11 #include <mitkMaskGenerator.h>
12 
13 
14 namespace mitk
15 {
26  {
27  public:
33 
35  itkNewMacro(Self)
36 
37 
38  itkTypeMacro(HotspotMaskGenerator, MaskGenerator)
39 
43  void SetInputImage(mitk::Image::Pointer inputImage);
44 
48  void SetMask(MaskGenerator::Pointer mask);
49 
53  void SetHotspotRadiusInMM(double radiusInMillimeter);
54 
55  const double& GetHotspotRadiusinMM() const;
56 
60  void SetHotspotMustBeCompletelyInsideImage(bool hotspotCompletelyInsideImage);
61 
62  bool GetHotspotMustBeCompletelyInsideImage() const;
63 
67  void SetLabel(unsigned short label);
68 
72  mitk::Image::Pointer GetMask();
73 
77  vnl_vector<int> GetHotspotIndex();
78 
82  vnl_vector<int> GetConvolutionImageMinIndex();
83 
88  void SetTimeStep(unsigned int timeStep);
89 
90  protected:
91  HotspotMaskGenerator();
92 
93  ~HotspotMaskGenerator();
94 
96  {
97  public:
98  bool Defined;
99  double Max;
100  double Min;
101  vnl_vector<int> MaxIndex;
102  vnl_vector<int> MinIndex;
103 
105  :Defined(false)
106  ,Max(itk::NumericTraits<double>::min())
107  ,Min(itk::NumericTraits<double>::max())
108  {
109  }
110  };
111 
112  private:
114  template <unsigned int VImageDimension>
115  itk::Size<VImageDimension>
116  CalculateConvolutionKernelSize(double spacing[VImageDimension], double radiusInMM);
117 
119  template <unsigned int VImageDimension>
121  GenerateHotspotSearchConvolutionKernel(double spacing[VImageDimension], double radiusInMM);
122 
124  template <typename TPixel, unsigned int VImageDimension>
126  GenerateConvolutionImage( const itk::Image<TPixel, VImageDimension>* inputImage );
127 
128 
130  template < typename TPixel, unsigned int VImageDimension>
131  void
132  FillHotspotMaskPixels( itk::Image<TPixel, VImageDimension>* maskImage,
133  itk::Point<double, VImageDimension> sphereCenter,
134  double sphereRadiusInMM);
135 
136 
138  template <typename TPixel, unsigned int VImageDimension>
139  void
140  CalculateHotspotMask(itk::Image<TPixel, VImageDimension>* inputImage,
142  unsigned int label);
143 
144 
145  template <typename TPixel, unsigned int VImageDimension >
146  ImageExtrema CalculateExtremaWorld( const itk::Image<TPixel, VImageDimension>* inputImage,
148  double neccessaryDistanceToImageBorderInMM,
149  unsigned int label);
150 
151  bool IsUpdateRequired() const;
152 
154  HotspotMaskGenerator & operator=(const HotspotMaskGenerator &);
155 
156  MaskGenerator::Pointer m_Mask;
157  mitk::Image::Pointer m_internalImage;
160  double m_HotspotRadiusinMM;
161  bool m_HotspotMustBeCompletelyInsideImage;
162  bool m_HotspotParamsChanged;
163  unsigned short m_Label;
164  vnl_vector<int> m_ConvolutionImageMinIndex, m_ConvolutionImageMaxIndex;
165  unsigned long m_InternalMaskUpdateTime;
166  };
167 }
168 #endif // MITKHOTSPOTCALCULATOR
169 
170 
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
Base Class for all Mask Generators. Mask generators are classes that provide functionality for the cr...
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKIMAGESTATISTICS_EXPORT
Image class for storing images.
Definition: mitkImage.h:76
itk::SmartPointer< Self > Pointer
static T max(T x, T y)
Definition: svm.cpp:70
static T min(T x, T y)
Definition: svm.cpp:67
The HotspotMaskGenerator class is used when a hotspot has to be found in an image. A hotspot is the region of the image where the mean intensity is maximal (=brightest spot). It is usually used in PET scans. The identification of the hotspot is done as follows: First a cubic (or circular, if image is 2d) mask of predefined size is generated. This mask is then convolved with the input image (in fourier domain). The maximum value of the convolved image then corresponds to the hotspot. If a maskGenerator is set, only the pixels of the convolved image where the corresponding mask is == label are searched for the maximum value.