Medical Imaging Interaction Toolkit  2024.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 
24  template< typename TInputImage >
25  class ITK_TEMPLATE_EXPORT LocalIntensityFilter :
26  public ImageToImageFilter< TInputImage, TInputImage >
27  {
28  public:
31  typedef ImageToImageFilter< TInputImage, TInputImage > Superclass;
34 
36  itkNewMacro(Self);
37 
39  itkTypeMacro(LocalIntensityFilter, ImageToImageFilter);
40 
42  typedef typename TInputImage::Pointer InputImagePointer;
43 
44  typedef typename TInputImage::RegionType RegionType;
45  typedef typename TInputImage::SizeType SizeType;
46  typedef typename TInputImage::IndexType IndexType;
47  typedef typename TInputImage::PixelType PixelType;
48 
49  typedef Image<unsigned short, TInputImage::ImageDimension> MaskImageType;
50 
52  itkStaticConstMacro(ImageDimension, unsigned int,
53  TInputImage::ImageDimension);
54 
56  typedef typename NumericTraits< PixelType >::RealType RealType;
57 
59  typedef typename DataObject::Pointer DataObjectPointer;
60 
62  typedef SimpleDataObjectDecorator< RealType > RealObjectType;
63  typedef SimpleDataObjectDecorator< PixelType > PixelObjectType;
64 
67  {
68  return this->GetLocalPeakOutput()->Get();
69  }
70  RealObjectType * GetLocalPeakOutput();
71 
72  const RealObjectType * GetLocalPeakOutput() const;
73 
76  {
77  return this->GetGlobalPeakOutput()->Get();
78  }
79  RealObjectType * GetGlobalPeakOutput();
80 
81  const RealObjectType * GetGlobalPeakOutput() const;
82 
85  {
86  return this->GetLocalMaximumOutput()->Get();
87  }
88  RealObjectType * GetLocalMaximumOutput();
89 
90  const RealObjectType * GetLocalMaximumOutput() const;
91 
92  void SetMask(typename MaskImageType::Pointer mask)
93  {
94  m_Mask = mask;
95  }
96 
97  itkSetMacro(Range, double);
98  itkGetMacro(Range, double);
99  itkGetConstMacro(Range, double);
100 
103  typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
104  using Superclass::MakeOutput;
105  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE;
106 
107 #ifdef ITK_USE_CONCEPT_CHECKING
108  // Begin concept checking
109  itkConceptMacro(InputHasNumericTraitsCheck,
110  (Concept::HasNumericTraits< PixelType >));
111  // End concept checking
112 #endif
113 
114  protected:
116  ~LocalIntensityFilter() ITK_OVERRIDE {}
117  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
118 
122  void AllocateOutputs() ITK_OVERRIDE;
123 
125  void BeforeThreadedGenerateData() ITK_OVERRIDE;
126 
129  void AfterThreadedGenerateData() ITK_OVERRIDE;
130 
132  void ThreadedGenerateData(const RegionType &
133  outputRegionForThread,
134  ThreadIdType threadId) ITK_OVERRIDE;
135 
136  // Override since the filter needs all the data for the algorithm
137  void GenerateInputRequestedRegion() ITK_OVERRIDE;
138 
139  // Override since the filter produces all of its output
140  void EnlargeOutputRequestedRegion(DataObject *data) ITK_OVERRIDE;
141 
142  private:
143  ITK_DISALLOW_COPY_AND_ASSIGN(LocalIntensityFilter);
144 
145  Array< RealType > m_ThreadLocalMaximum;
146  Array< RealType > m_ThreadLocalPeakValue;
147  Array< RealType > m_ThreadGlobalPeakValue;
148  typename MaskImageType::Pointer m_Mask;
149  double m_Range;
150  }; // end of class
151 } // end namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "itkLocalIntensityFilter.hxx"
155 #endif
156 
157 #endif
158 
itk::LocalIntensityFilter::GetGlobalPeak
RealType GetGlobalPeak() const
Definition: itkLocalIntensityFilter.h:75
itk::LocalIntensityFilter::RegionType
TInputImage::RegionType RegionType
Definition: itkLocalIntensityFilter.h:44
itk::LocalIntensityFilter::GetLocalMaximum
RealType GetLocalMaximum() const
Definition: itkLocalIntensityFilter.h:84
itk::LocalIntensityFilter::RealType
NumericTraits< PixelType >::RealType RealType
Definition: itkLocalIntensityFilter.h:56
itk::LocalIntensityFilter::SetMask
void SetMask(typename MaskImageType::Pointer mask)
Definition: itkLocalIntensityFilter.h:92
itk::LocalIntensityFilter::SizeType
TInputImage::SizeType SizeType
Definition: itkLocalIntensityFilter.h:45
itk::SmartPointer< Self >
itk::LocalIntensityFilter::RealObjectType
SimpleDataObjectDecorator< RealType > RealObjectType
Definition: itkLocalIntensityFilter.h:62
itk::LocalIntensityFilter::~LocalIntensityFilter
~LocalIntensityFilter() ITK_OVERRIDE
Definition: itkLocalIntensityFilter.h:116
itk::LocalIntensityFilter::Self
LocalIntensityFilter Self
Definition: itkLocalIntensityFilter.h:30
itk::LocalIntensityFilter::Superclass
ImageToImageFilter< TInputImage, TInputImage > Superclass
Definition: itkLocalIntensityFilter.h:31
itk::LocalIntensityFilter::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkLocalIntensityFilter.h:33
itk::LocalIntensityFilter::DataObjectPointerArraySizeType
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: itkLocalIntensityFilter.h:99
itk::LocalIntensityFilter
Definition: itkLocalIntensityFilter.h:25
itk::LocalIntensityFilter::PixelObjectType
SimpleDataObjectDecorator< PixelType > PixelObjectType
Definition: itkLocalIntensityFilter.h:63
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
itk::LocalIntensityFilter::IndexType
TInputImage::IndexType IndexType
Definition: itkLocalIntensityFilter.h:46
itk::LocalIntensityFilter::DataObjectPointer
DataObject::Pointer DataObjectPointer
Definition: itkLocalIntensityFilter.h:59
itk::LocalIntensityFilter::PixelType
TInputImage::PixelType PixelType
Definition: itkLocalIntensityFilter.h:47
itk::LocalIntensityFilter::MaskImageType
Image< unsigned short, TInputImage::ImageDimension > MaskImageType
Definition: itkLocalIntensityFilter.h:49
itk::LocalIntensityFilter::Pointer
SmartPointer< Self > Pointer
Definition: itkLocalIntensityFilter.h:32
itk::LocalIntensityFilter::GetLocalPeak
RealType GetLocalPeak() const
Definition: itkLocalIntensityFilter.h:66
itk::LocalIntensityFilter::InputImagePointer
TInputImage::Pointer InputImagePointer
Definition: itkLocalIntensityFilter.h:39