ITK  6.0.0
Insight Toolkit
itkSignedMaurerDistanceMapImageFilter.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 itkSignedMaurerDistanceMapImageFilter_h
19 #define itkSignedMaurerDistanceMapImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
66 template <typename TInputImage, typename TOutputImage>
67 class ITK_TEMPLATE_EXPORT SignedMaurerDistanceMapImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
68 {
69 public:
70  ITK_DISALLOW_COPY_AND_MOVE(SignedMaurerDistanceMapImageFilter);
71 
73  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
74  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
75  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
76 
78  using InputImageType = TInputImage;
80 
81  using OutputImageType = TOutputImage;
83 
87 
90 
92  itkNewMacro(Self);
93 
95  itkOverrideGetNameOfClassMacro(SignedMaurerDistanceMapImageFilter);
96 
99 
101  using InputPixelType = typename InputImageType::PixelType;
102  using OutputPixelType = typename OutputImageType::PixelType;
103 
108 
113 
114  using InputSpacingType = typename InputImageType::SpacingType;
115  using OutputSpacingType = typename OutputImageType::SpacingType;
117 
119  itkSetMacro(SquaredDistance, bool);
120 
122  itkGetConstReferenceMacro(SquaredDistance, bool);
123 
125  itkBooleanMacro(SquaredDistance);
126 
129  itkSetMacro(InsideIsPositive, bool);
130 
133  itkGetConstReferenceMacro(InsideIsPositive, bool);
134 
138  itkBooleanMacro(InsideIsPositive);
139 
141  itkSetMacro(UseImageSpacing, bool);
142 
144  itkGetConstReferenceMacro(UseImageSpacing, bool);
145 
147  itkBooleanMacro(UseImageSpacing);
148 
153  itkSetMacro(BackgroundValue, InputPixelType);
154  itkGetConstReferenceMacro(BackgroundValue, InputPixelType);
157 #ifdef ITK_USE_CONCEPT_CHECKING
158  // Begin concept checking
159  itkConceptMacro(IntConvertibleToInputCheck, (Concept::Convertible<int, InputPixelType>));
160  itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
161  itkConceptMacro(OutputImagePixelTypeIsFloatingPointCheck, (Concept::IsFloatingPoint<OutputPixelType>));
162  // End concept checking
163 #endif
164 
165 protected:
167  ~SignedMaurerDistanceMapImageFilter() override = default;
168 
169  void
170  PrintSelf(std::ostream & os, Indent indent) const override;
171 
172  void
173  GenerateData() override;
174 
175  unsigned int
176  SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType & splitRegion) override;
177 
178  void
179  ThreadedGenerateData(const OutputImageRegionType &, ThreadIdType) override;
180 
181  void
183  {
184  itkExceptionMacro("This class requires threadId so it must use classic multi-threading model");
185  }
186 
187 private:
188  void
189  Voronoi(unsigned int, OutputIndexType idx, OutputImageType * output);
190  bool Remove(OutputPixelType, OutputPixelType, OutputPixelType, OutputPixelType, OutputPixelType, OutputPixelType);
191 
192  InputPixelType m_BackgroundValue{};
193  InputSpacingType m_Spacing{};
194 
195  unsigned int m_CurrentDimension{ 0 };
196 
197  bool m_InsideIsPositive{ false };
198  bool m_UseImageSpacing{ true };
199  bool m_SquaredDistance{ false };
200 
201  const InputImageType * m_InputCache{};
202 };
203 } // end namespace itk
204 
205 #ifndef ITK_MANUAL_INSTANTIATION
206 # include "itkSignedMaurerDistanceMapImageFilter.hxx"
207 #endif
208 
209 #endif
itk::SignedMaurerDistanceMapImageFilter::InputRegionType
typename InputImageType::RegionType InputRegionType
Definition: itkSignedMaurerDistanceMapImageFilter.h:97
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::SignedMaurerDistanceMapImageFilter::InputImageType
TInputImage InputImageType
Definition: itkSignedMaurerDistanceMapImageFilter.h:78
itk::SignedMaurerDistanceMapImageFilter::DynamicThreadedGenerateData
void DynamicThreadedGenerateData(const OutputImageRegionType &) override
Definition: itkSignedMaurerDistanceMapImageFilter.h:182
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:716
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::SignedMaurerDistanceMapImageFilter::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkSignedMaurerDistanceMapImageFilter.h:101
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
itk::SignedMaurerDistanceMapImageFilter::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Definition: itkSignedMaurerDistanceMapImageFilter.h:102
itk::IndexValueType
long IndexValueType
Definition: itkIntTypes.h:93
itk::SignedMaurerDistanceMapImageFilter::OutputRegionType
typename OutputImageType::RegionType OutputRegionType
Definition: itkSignedMaurerDistanceMapImageFilter.h:98
itk::ThreadIdType
unsigned int ThreadIdType
Definition: itkIntTypes.h:102
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::SignedMaurerDistanceMapImageFilter::InputSizeType
typename InputImageType::SizeType InputSizeType
Definition: itkSignedMaurerDistanceMapImageFilter.h:104
itk::SignedMaurerDistanceMapImageFilter::OutputIndexValueType
typename OutputImageType::IndexValueType OutputIndexValueType
Definition: itkSignedMaurerDistanceMapImageFilter.h:112
itk::SignedMaurerDistanceMapImageFilter::OutputSizeType
typename OutputImageType::SizeType OutputSizeType
Definition: itkSignedMaurerDistanceMapImageFilter.h:106
itk::SignedMaurerDistanceMapImageFilter::InputSpacingType
typename InputImageType::SpacingType InputSpacingType
Definition: itkSignedMaurerDistanceMapImageFilter.h:114
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::SignedMaurerDistanceMapImageFilter::OutputIndexType
typename OutputImageType::IndexType OutputIndexType
Definition: itkSignedMaurerDistanceMapImageFilter.h:111
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:948
itk::SignedMaurerDistanceMapImageFilter::InputIndexType
typename InputImageType::IndexType InputIndexType
Definition: itkSignedMaurerDistanceMapImageFilter.h:109
itkImageToImageFilter.h
itk::SignedMaurerDistanceMapImageFilter::InputIndexValueType
typename InputImageType::IndexValueType InputIndexValueType
Definition: itkSignedMaurerDistanceMapImageFilter.h:110
itk::SignedMaurerDistanceMapImageFilter::InputSizeValueType
typename InputImageType::SizeValueType InputSizeValueType
Definition: itkSignedMaurerDistanceMapImageFilter.h:105
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
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
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::SignedMaurerDistanceMapImageFilter
This filter calculates the Euclidean distance transform of a binary image in linear time for arbitrar...
Definition: itkSignedMaurerDistanceMapImageFilter.h:67
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::SignedMaurerDistanceMapImageFilter::OutputSizeValueType
typename OutputImageType::SizeValueType OutputSizeValueType
Definition: itkSignedMaurerDistanceMapImageFilter.h:107
itk::SignedMaurerDistanceMapImageFilter::OutputSpacingType
typename OutputImageType::SpacingType OutputSpacingType
Definition: itkSignedMaurerDistanceMapImageFilter.h:115