Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
itkLocalIntensityFilter.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 itkLocalIntensityFilter_h
14 #define itkLocalIntensityFilter_h
15 
16 #include <itkImageToImageFilter.h>
17 #include <itkNumericTraits.h>
18 #include <itkArray.h>
19 #include <itkSimpleDataObjectDecorator.h>
20 
21 namespace itk
22 {
23 
34  template< typename TInputImage >
35  class ITK_TEMPLATE_EXPORT LocalIntensityFilter :
36  public ImageToImageFilter< TInputImage, TInputImage >
37  {
38  public:
41  typedef ImageToImageFilter< TInputImage, TInputImage > Superclass;
44 
46  itkNewMacro(Self);
47 
49  itkTypeMacro(LocalIntensityFilter, ImageToImageFilter);
50 
52  typedef typename TInputImage::Pointer InputImagePointer;
53 
54  typedef typename TInputImage::RegionType RegionType;
55  typedef typename TInputImage::SizeType SizeType;
56  typedef typename TInputImage::IndexType IndexType;
57  typedef typename TInputImage::PixelType PixelType;
58 
59  typedef Image<unsigned short, TInputImage::ImageDimension> MaskImageType;
60 
62  itkStaticConstMacro(ImageDimension, unsigned int,
63  TInputImage::ImageDimension);
64 
66  typedef typename NumericTraits< PixelType >::RealType RealType;
67 
69  typedef typename DataObject::Pointer DataObjectPointer;
70 
72  typedef SimpleDataObjectDecorator< RealType > RealObjectType;
73  typedef SimpleDataObjectDecorator< PixelType > PixelObjectType;
74 
77  {
78  return this->GetLocalPeakOutput()->Get();
79  }
81 
83 
86  {
87  return this->GetGlobalPeakOutput()->Get();
88  }
90 
92 
95  {
96  return this->GetLocalMaximumOutput()->Get();
97  }
99 
101 
102  void SetMask(typename MaskImageType::Pointer mask)
103  {
104  m_Mask = mask;
105  }
106 
107  itkSetMacro(Range, double);
108  itkGetMacro(Range, double);
109  itkGetConstMacro(Range, double);
110 
113  typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
114  using Superclass::MakeOutput;
116 
117 #ifdef ITK_USE_CONCEPT_CHECKING
118  // Begin concept checking
119  itkConceptMacro(InputHasNumericTraitsCheck,
120  (Concept::HasNumericTraits< PixelType >));
121  // End concept checking
122 #endif
123 
124  protected:
126  ~LocalIntensityFilter() ITK_OVERRIDE {}
127  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
128 
132  void AllocateOutputs() ITK_OVERRIDE;
133 
135  void BeforeThreadedGenerateData() ITK_OVERRIDE;
136 
139  void AfterThreadedGenerateData() ITK_OVERRIDE;
140 
142  void ThreadedGenerateData(const RegionType &
143  outputRegionForThread,
144  ThreadIdType threadId) ITK_OVERRIDE;
145 
146  // Override since the filter needs all the data for the algorithm
147  void GenerateInputRequestedRegion() ITK_OVERRIDE;
148 
149  // Override since the filter produces all of its output
150  void EnlargeOutputRequestedRegion(DataObject *data) ITK_OVERRIDE;
151 
152  private:
153  ITK_DISALLOW_COPY_AND_ASSIGN(LocalIntensityFilter);
154 
155  Array< RealType > m_ThreadLocalMaximum;
156  Array< RealType > m_ThreadLocalPeakValue;
157  Array< RealType > m_ThreadGlobalPeakValue;
158  typename MaskImageType::Pointer m_Mask;
159  double m_Range;
160  }; // end of class
161 } // end namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 #include <itkLocalIntensityFilter.tpp>
165 #endif
166 
167 #endif
168 
Computes local and global intensity peak features within a spherical neighbourhood.
TInputImage::SizeType SizeType
TInputImage::RegionType RegionType
DataObject::Pointer DataObjectPointer
TInputImage::PixelType PixelType
TInputImage::Pointer InputImagePointer
ImageToImageFilter< TInputImage, TInputImage > Superclass
SmartPointer< const Self > ConstPointer
const RealObjectType * GetLocalMaximumOutput() const
const RealObjectType * GetGlobalPeakOutput() const
RealObjectType * GetGlobalPeakOutput()
Image< unsigned short, TInputImage::ImageDimension > MaskImageType
void SetMask(typename MaskImageType::Pointer mask)
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE
itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension)
NumericTraits< PixelType >::RealType RealType
TInputImage::IndexType IndexType
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
SimpleDataObjectDecorator< RealType > RealObjectType
void AllocateOutputs() ITK_OVERRIDE
SimpleDataObjectDecorator< PixelType > PixelObjectType
RealObjectType * GetLocalMaximumOutput()
const RealObjectType * GetLocalPeakOutput() const
RealObjectType * GetLocalPeakOutput()
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType