Medical Imaging Interaction Toolkit  2026.06.00
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 {
51  {
52  public:
58 
60  itkNewMacro(Self);
62 
67  unsigned int GetNumberOfMasks() const override;
68 
73  itkSetObjectMacro(Mask, MaskGenerator);
74 
78  itkGetConstMacro(HotspotRadiusInMM, double);
79  itkSetMacro(HotspotRadiusInMM, double);
80 
87  itkGetConstMacro(HotspotMustBeCompletelyInsideImage, bool);
88  itkSetMacro(HotspotMustBeCompletelyInsideImage, bool);
89 
98  itkSetMacro(Label, unsigned short);
99 
100  protected:
102 
104 
105  Image::ConstPointer DoGetMask(unsigned int) override;
106 
108  {
109  public:
110  bool Defined;
111  double Max;
112  double Min;
113  vnl_vector<int> MaxIndex;
114  vnl_vector<int> MinIndex;
115 
117  :Defined(false)
118  ,Max(itk::NumericTraits<double>::min())
119  ,Min(itk::NumericTraits<double>::max())
120  {
121  }
122  };
123 
124  private:
126  template <unsigned int VImageDimension>
127  itk::Size<VImageDimension>
128  CalculateConvolutionKernelSize(double spacing[VImageDimension], double radiusInMM);
129 
131  template <unsigned int VImageDimension>
133  GenerateHotspotSearchConvolutionKernel(double spacing[VImageDimension], double radiusInMM);
134 
136  template <typename TPixel, unsigned int VImageDimension>
138  GenerateConvolutionImage( const itk::Image<TPixel, VImageDimension>* inputImage );
139 
140 
142  template < typename TPixel, unsigned int VImageDimension>
143  void
144  FillHotspotMaskPixels( itk::Image<TPixel, VImageDimension>* maskImage,
145  itk::Point<double, VImageDimension> sphereCenter,
146  double sphereRadiusInMM);
147 
148 
150  template <typename TPixel, unsigned int VImageDimension>
151  void
152  CalculateHotspotMask(const itk::Image<TPixel, VImageDimension>* inputImage,
153  const itk::Image<unsigned short, VImageDimension>* maskImage,
154  unsigned int label);
155 
156 
157  template <typename TPixel, unsigned int VImageDimension >
158  ImageExtrema CalculateExtremaWorld( const itk::Image<TPixel, VImageDimension>* inputImage,
159  const itk::Image<unsigned short, VImageDimension>* maskImage,
160  double necessaryDistanceToImageBorderInMM,
161  unsigned int label);
162 
163  bool IsUpdateRequired() const;
164 
166  HotspotMaskGenerator & operator=(const HotspotMaskGenerator &);
167 
168  MaskGenerator::Pointer m_Mask;
169  mitk::Image::Pointer m_InternalMask;
170  itk::Image<unsigned short, 2>::ConstPointer m_internalMask2D;
171  itk::Image<unsigned short, 3>::ConstPointer m_internalMask3D;
172  double m_HotspotRadiusInMM;
173  bool m_HotspotMustBeCompletelyInsideImage;
174  unsigned short m_Label;
175  vnl_vector<int> m_ConvolutionImageMinIndex, m_ConvolutionImageMaxIndex;
176  unsigned long m_InternalMaskUpdateTime;
177  };
178 }
179 #endif
#define MITKIMAGESTATISTICS_EXPORT
Generates a spherical mask centered on the hotspot (brightest region) of an image.
itk::SmartPointer< const Self > ConstPointer
Image::ConstPointer DoGetMask(unsigned int) override
Must be overridden by derived classes to generate the requested mask.
unsigned int GetNumberOfMasks() const override
Returns the number of masks this generator provides.
itk::SmartPointer< Self > Pointer
A data structure describing a label in a multi-label segmentation.
Definition: mitkLabel.h:101
Abstract base class for all mask generators used in image statistics.
Find image slices visible on a given plane.