ITK  6.0.0
Insight Toolkit
itkDirectedHausdorffDistanceImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkDirectedHausdorffDistanceImageFilter_h
19 #define itkDirectedHausdorffDistanceImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkNumericTraits.h"
23 #include "itkArray.h"
25 #include <mutex>
26 
27 namespace itk
28 {
73 template <typename TInputImage1, typename TInputImage2>
74 class ITK_TEMPLATE_EXPORT DirectedHausdorffDistanceImageFilter : public ImageToImageFilter<TInputImage1, TInputImage1>
75 {
76 public:
77  ITK_DISALLOW_COPY_AND_MOVE(DirectedHausdorffDistanceImageFilter);
78 
84 
86  itkNewMacro(Self);
87 
89  itkOverrideGetNameOfClassMacro(DirectedHausdorffDistanceImageFilter);
90 
92  using InputImage1Type = TInputImage1;
93  using InputImage2Type = TInputImage2;
98 
102 
103  using InputImage1PixelType = typename TInputImage1::PixelType;
104  using InputImage2PixelType = typename TInputImage2::PixelType;
105 
107  static constexpr unsigned int ImageDimension = TInputImage1::ImageDimension;
108 
111 
113  void
114  SetInput1(const InputImage1Type * image);
115 
117  void
118  SetInput2(const InputImage2Type * image);
119 
121  const InputImage1Type *
122  GetInput1();
123 
125  const InputImage2Type *
126  GetInput2();
127 
129  itkSetMacro(UseImageSpacing, bool);
130  itkGetConstMacro(UseImageSpacing, bool);
131  itkBooleanMacro(UseImageSpacing);
135  itkGetConstMacro(DirectedHausdorffDistance, RealType);
136  itkGetConstMacro(AverageHausdorffDistance, RealType);
139 #ifdef ITK_USE_CONCEPT_CHECKING
140  // Begin concept checking
142  // End concept checking
143 #endif
144 
145 protected:
147  ~DirectedHausdorffDistanceImageFilter() override = default;
148  void
149  PrintSelf(std::ostream & os, Indent indent) const override;
150 
153  void
154  AllocateOutputs() override;
155 
157  void
158  BeforeThreadedGenerateData() override;
159 
162  void
163  AfterThreadedGenerateData() override;
164 
166  void
167  DynamicThreadedGenerateData(const RegionType & outputRegionForThread) override;
168 
169 
170  // Override since the filter needs all the data for the algorithm
171  void
172  GenerateInputRequestedRegion() override;
173 
174  // Override since the filter produces all of its output
175  void
176  EnlargeOutputRequestedRegion(DataObject * data) override;
177 
178 private:
180 
183 
184  DistanceMapPointer m_DistanceMap{ nullptr };
185 
186  RealType m_MaxDistance{};
187  IdentifierType m_PixelCount{};
188 
190 
191  RealType m_DirectedHausdorffDistance{};
192  RealType m_AverageHausdorffDistance{};
193  bool m_UseImageSpacing{ true };
194 
195  std::mutex m_Mutex{};
196 }; // end of class
197 } // end namespace itk
198 
199 #ifndef ITK_MANUAL_INSTANTIATION
200 # include "itkDirectedHausdorffDistanceImageFilter.hxx"
201 #endif
202 
203 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::DirectedHausdorffDistanceImageFilter::InputImage2Type
TInputImage2 InputImage2Type
Definition: itkDirectedHausdorffDistanceImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::CompensatedSummation< RealType >
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:716
itk::DirectedHausdorffDistanceImageFilter::InputImage1Type
TInputImage1 InputImage1Type
Definition: itkDirectedHausdorffDistanceImageFilter.h:92
itk::DirectedHausdorffDistanceImageFilter::SizeType
typename TInputImage1::SizeType SizeType
Definition: itkDirectedHausdorffDistanceImageFilter.h:100
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkCompensatedSummation.h
itk::DirectedHausdorffDistanceImageFilter::DistanceMapPointer
typename DistanceMapType::Pointer DistanceMapPointer
Definition: itkDirectedHausdorffDistanceImageFilter.h:182
itk::DirectedHausdorffDistanceImageFilter::RegionType
typename TInputImage1::RegionType RegionType
Definition: itkDirectedHausdorffDistanceImageFilter.h:99
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::DirectedHausdorffDistanceImageFilter::InputImage2PixelType
typename TInputImage2::PixelType InputImage2PixelType
Definition: itkDirectedHausdorffDistanceImageFilter.h:104
itk::DirectedHausdorffDistanceImageFilter::InputImage2Pointer
typename TInputImage2::Pointer InputImage2Pointer
Definition: itkDirectedHausdorffDistanceImageFilter.h:95
itk::DirectedHausdorffDistanceImageFilter::InputImage2ConstPointer
typename TInputImage2::ConstPointer InputImage2ConstPointer
Definition: itkDirectedHausdorffDistanceImageFilter.h:97
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::DirectedHausdorffDistanceImageFilter
Computes the directed Hausdorff distance between the set of non-zero pixels of two images.
Definition: itkDirectedHausdorffDistanceImageFilter.h:74
itkImageToImageFilter.h
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itkArray.h
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itkNumericTraits.h
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::DirectedHausdorffDistanceImageFilter::IndexType
typename TInputImage1::IndexType IndexType
Definition: itkDirectedHausdorffDistanceImageFilter.h:101
itk::DirectedHausdorffDistanceImageFilter::InputImage1PixelType
typename TInputImage1::PixelType InputImage1PixelType
Definition: itkDirectedHausdorffDistanceImageFilter.h:103
itk::DirectedHausdorffDistanceImageFilter::InputImage1ConstPointer
typename TInputImage1::ConstPointer InputImage1ConstPointer
Definition: itkDirectedHausdorffDistanceImageFilter.h:96
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:90
itk::DirectedHausdorffDistanceImageFilter::RealType
typename NumericTraits< InputImage1PixelType >::RealType RealType
Definition: itkDirectedHausdorffDistanceImageFilter.h:110
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293
itk::DirectedHausdorffDistanceImageFilter::InputImage1Pointer
typename TInputImage1::Pointer InputImage1Pointer
Definition: itkDirectedHausdorffDistanceImageFilter.h:94