ITK  5.4.0
Insight Toolkit
itkFastChamferDistanceImageFilter.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 itkFastChamferDistanceImageFilter_h
19 #define itkFastChamferDistanceImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 #include "itkNarrowBand.h"
24 
25 namespace itk
26 {
55 template <typename TInputImage, typename TOutputImage>
56 class ITK_TEMPLATE_EXPORT FastChamferDistanceImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
57 {
58 public:
59  ITK_DISALLOW_COPY_AND_MOVE(FastChamferDistanceImageFilter);
60 
66 
68  itkNewMacro(Self);
69 
71  itkOverrideGetNameOfClassMacro(FastChamferDistanceImageFilter);
72 
74  using InputImageType = TInputImage;
75 
77  using OutputImageType = TOutputImage;
78 
81 
83  using PixelType = typename InputImageType::PixelType;
84 
86  using IndexType = typename RegionType::IndexType;
87 
89  using OffsetType = typename InputImageType::OffsetType;
90 
92  using SizeType = typename RegionType::SizeType;
93 
95  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
96  static constexpr unsigned int OutputImageDimension = OutputImageType::ImageDimension;
97 
100 
105 
107 
109  itkSetMacro(Weights, WeightsType);
110  itkGetConstReferenceMacro(Weights, WeightsType);
114  itkSetMacro(MaximumDistance, float);
115  itkGetConstMacro(MaximumDistance, float);
119  void
120  SetRegionToProcess(const RegionType & r);
121 
122  RegionType
123  GetRegionToProcess() const;
124 
125  void
126  SetNarrowBand(NarrowBandType * ptr);
127 
129  GetNarrowBand() const;
130 
131 #ifdef ITK_USE_CONCEPT_CHECKING
132  // Begin concept checking
135  itkConceptMacro(FloatConvertibleToPixelTypeCheck, (Concept::Convertible<float, PixelType>));
136  itkConceptMacro(PixelTypeConvertibleToFloatCheck, (Concept::Convertible<PixelType, float>));
137  itkConceptMacro(PixelTypeGreaterThanFloatCheck, (Concept::GreaterThanComparable<PixelType, float>));
138  itkConceptMacro(PixelTypeLessThanFloatCheck, (Concept::LessThanComparable<PixelType, float>));
139  itkConceptMacro(PixelTypeFloatAdditiveOperatorsCheck, (Concept::AdditiveOperators<PixelType, float, float>));
140  itkConceptMacro(FloatGreaterThanPixelTypeCheck, (Concept::GreaterThanComparable<float, PixelType>));
141  itkConceptMacro(FloatLessThanPixelTypeCheck, (Concept::LessThanComparable<float, PixelType>));
142  // End concept checking
143 #endif
144 
145 protected:
147  ~FastChamferDistanceImageFilter() override = default;
148  void
149  PrintSelf(std::ostream & os, Indent indent) const override;
150 
153  void
154  GenerateDataND();
155 
158  void
159  GenerateData() override;
160 
161 private:
162  float m_MaximumDistance{};
163 
165  WeightsType m_Weights{};
166 
167  NarrowBandPointer m_NarrowBand{};
168 
170  RegionType m_RegionToProcess{};
171 }; // end of FastChamferDistanceImageFilter class
172 } // end namespace itk
173 
174 #ifndef ITK_MANUAL_INSTANTIATION
175 # include "itkFastChamferDistanceImageFilter.hxx"
176 #endif
177 
178 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::FastChamferDistanceImageFilter::RegionType
typename InputImageType::RegionType RegionType
Definition: itkFastChamferDistanceImageFilter.h:80
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::FastChamferDistanceImageFilter::IndexType
typename RegionType::IndexType IndexType
Definition: itkFastChamferDistanceImageFilter.h:86
itk::Concept::GreaterThanComparable
Definition: itkConceptChecking.h:284
itk::NarrowBand
Narrow Band class.
Definition: itkNarrowBand.h:51
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::FastChamferDistanceImageFilter::SizeType
typename RegionType::SizeType SizeType
Definition: itkFastChamferDistanceImageFilter.h:92
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkImageRegionIteratorWithIndex.h
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
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::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::FastChamferDistanceImageFilter::NarrowBandPointer
typename NarrowBandType::Pointer NarrowBandPointer
Definition: itkFastChamferDistanceImageFilter.h:104
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::FixedArray< float, ImageDimension >
itk::Concept::AdditiveOperators
Definition: itkConceptChecking.h:358
itk::FastChamferDistanceImageFilter::PixelType
typename InputImageType::PixelType PixelType
Definition: itkFastChamferDistanceImageFilter.h:83
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::Concept::SameType
Definition: itkConceptChecking.h:677
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::FastChamferDistanceImageFilter
This class compute the signed (positive and negative) chamfer distance in a narrow band.
Definition: itkFastChamferDistanceImageFilter.h:56
itk::BandNode
Definition: itkNarrowBand.h:35
itk::FastChamferDistanceImageFilter::OffsetType
typename InputImageType::OffsetType OffsetType
Definition: itkFastChamferDistanceImageFilter.h:89
itkNarrowBand.h
itk::Concept::LessThanComparable
Definition: itkConceptChecking.h:262
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90