ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkDirectedHausdorffDistanceImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 
26 namespace itk
27 {
71 template< typename TInputImage1, typename TInputImage2 >
72 class ITK_TEMPLATE_EXPORT DirectedHausdorffDistanceImageFilter:
73  public ImageToImageFilter< TInputImage1, TInputImage1 >
74 {
75 public:
81 
83  itkNewMacro(Self);
84 
87 
89  typedef TInputImage1 InputImage1Type;
90  typedef TInputImage2 InputImage2Type;
91  typedef typename TInputImage1::Pointer InputImage1Pointer;
92  typedef typename TInputImage2::Pointer InputImage2Pointer;
93  typedef typename TInputImage1::ConstPointer InputImage1ConstPointer;
94  typedef typename TInputImage2::ConstPointer InputImage2ConstPointer;
95 
96  typedef typename TInputImage1::RegionType RegionType;
97  typedef typename TInputImage1::SizeType SizeType;
99 
100  typedef typename TInputImage1::PixelType InputImage1PixelType;
101  typedef typename TInputImage2::PixelType InputImage2PixelType;
102 
104  itkStaticConstMacro(ImageDimension, unsigned int,
105  TInputImage1::ImageDimension);
106 
109 
111  void SetInput1(const InputImage1Type *image);
112 
114  void SetInput2(const InputImage2Type *image);
115 
117  const InputImage1Type * GetInput1();
118 
120  const InputImage2Type * GetInput2();
121 
123  itkSetMacro(UseImageSpacing, bool);
124  itkGetConstMacro( UseImageSpacing, bool );
126 
128  itkGetConstMacro(DirectedHausdorffDistance, RealType);
129  itkGetConstMacro(AverageHausdorffDistance, RealType);
131 
132 #ifdef ITK_USE_CONCEPT_CHECKING
133  // Begin concept checking
134  itkConceptMacro( InputHasNumericTraitsCheck,
136  // End concept checking
137 #endif
138 
139 protected:
142  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
143 
146  void AllocateOutputs() ITK_OVERRIDE;
147 
149  void BeforeThreadedGenerateData() ITK_OVERRIDE;
150 
153  void AfterThreadedGenerateData() ITK_OVERRIDE;
154 
156  void ThreadedGenerateData(const RegionType &
157  outputRegionForThread,
158  ThreadIdType threadId) ITK_OVERRIDE;
159 
160  // Override since the filter needs all the data for the algorithm
161  void GenerateInputRequestedRegion() ITK_OVERRIDE;
162 
163  // Override since the filter produces all of its output
164  void EnlargeOutputRequestedRegion(DataObject *data) ITK_OVERRIDE;
165 
166 private:
167  ITK_DISALLOW_COPY_AND_ASSIGN(DirectedHausdorffDistanceImageFilter);
168 
169  typedef Image< RealType, itkGetStaticConstMacro(ImageDimension) > DistanceMapType;
170  typedef typename DistanceMapType::Pointer DistanceMapPointer;
171 
172 
173  DistanceMapPointer m_DistanceMap;
174 
175  Array< RealType > m_MaxDistance;
176  Array< IdentifierType > m_PixelCount;
177 
179  std::vector< CompensatedSummationType > m_Sum;
180 
181  RealType m_DirectedHausdorffDistance;
182  RealType m_AverageHausdorffDistance;
183  bool m_UseImageSpacing;
184 }; // end of class
185 } // end namespace itk
186 
187 #ifndef ITK_MANUAL_INSTANTIATION
188 #include "itkDirectedHausdorffDistanceImageFilter.hxx"
189 #endif
190 
191 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
Light weight base class for most itk classes.
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
NumericTraits< InputImage1PixelType >::RealType RealType
Perform more precise accumulation of floating point numbers.
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Computes the directed Hausdorff distance between the set of non-zero pixels of two images...
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75
ImageToImageFilter< TInputImage1, TInputImage1 > Superclass