Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkHotspotMaskGenerator.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 mitkHotspotMaskGenerator_h
14 #define mitkHotspotMaskGenerator_h
15 
16 #include <itkObject.h>
17 #include <mitkImage.h>
18 #include <itkImage.h>
19 #include <itkTimeStamp.h>
20 #include <stdexcept>
22 #include <mitkImageTimeSelector.h>
23 #include <mitkMaskGenerator.h>
24 
25 
26 namespace mitk
27 {
40  {
41  public:
47 
49  itkNewMacro(Self);
51 
52  unsigned int GetNumberOfMasks() const override;
53 
57  itkSetObjectMacro(Mask, MaskGenerator);
58 
62  itkGetConstMacro(HotspotRadiusInMM, double);
63  itkSetMacro(HotspotRadiusInMM, double);
64 
68  itkGetConstMacro(HotspotMustBeCompletelyInsideImage, bool);
69  itkSetMacro(HotspotMustBeCompletelyInsideImage, bool);
70 
74  itkSetMacro(Label, unsigned short);
75 
76  protected:
78 
80 
81  Image::ConstPointer DoGetMask(unsigned int) override;
82 
84  {
85  public:
86  bool Defined;
87  double Max;
88  double Min;
89  vnl_vector<int> MaxIndex;
90  vnl_vector<int> MinIndex;
91 
93  :Defined(false)
94  ,Max(itk::NumericTraits<double>::min())
95  ,Min(itk::NumericTraits<double>::max())
96  {
97  }
98  };
99 
100  private:
102  template <unsigned int VImageDimension>
103  itk::Size<VImageDimension>
104  CalculateConvolutionKernelSize(double spacing[VImageDimension], double radiusInMM);
105 
107  template <unsigned int VImageDimension>
109  GenerateHotspotSearchConvolutionKernel(double spacing[VImageDimension], double radiusInMM);
110 
112  template <typename TPixel, unsigned int VImageDimension>
114  GenerateConvolutionImage( const itk::Image<TPixel, VImageDimension>* inputImage );
115 
116 
118  template < typename TPixel, unsigned int VImageDimension>
119  void
120  FillHotspotMaskPixels( itk::Image<TPixel, VImageDimension>* maskImage,
121  itk::Point<double, VImageDimension> sphereCenter,
122  double sphereRadiusInMM);
123 
124 
126  template <typename TPixel, unsigned int VImageDimension>
127  void
128  CalculateHotspotMask(const itk::Image<TPixel, VImageDimension>* inputImage,
129  const itk::Image<unsigned short, VImageDimension>* maskImage,
130  unsigned int label);
131 
132 
133  template <typename TPixel, unsigned int VImageDimension >
134  ImageExtrema CalculateExtremaWorld( const itk::Image<TPixel, VImageDimension>* inputImage,
135  const itk::Image<unsigned short, VImageDimension>* maskImage,
136  double necessaryDistanceToImageBorderInMM,
137  unsigned int label);
138 
139  bool IsUpdateRequired() const;
140 
142  HotspotMaskGenerator & operator=(const HotspotMaskGenerator &);
143 
144  MaskGenerator::Pointer m_Mask;
145  mitk::Image::Pointer m_InternalMask;
146  itk::Image<unsigned short, 2>::ConstPointer m_internalMask2D;
147  itk::Image<unsigned short, 3>::ConstPointer m_internalMask3D;
148  double m_HotspotRadiusInMM;
149  bool m_HotspotMustBeCompletelyInsideImage;
150  unsigned short m_Label;
151  vnl_vector<int> m_ConvolutionImageMinIndex, m_ConvolutionImageMaxIndex;
152  unsigned long m_InternalMaskUpdateTime;
153  };
154 }
155 #endif
#define MITKIMAGESTATISTICS_EXPORT
The HotspotMaskGenerator class is used when a hotspot has to be found in an image....
itk::SmartPointer< const Self > ConstPointer
Image::ConstPointer DoGetMask(unsigned int) override
DoGetMask must be overridden by derived classes.
unsigned int GetNumberOfMasks() const override
itk::SmartPointer< Self > Pointer
A data structure describing a label.
Definition: mitkLabel.h:90
Base Class for all Mask Generators. Mask generators are classes that provide functionality for the cr...
Find image slices visible on a given plane.