ITK  5.4.0
Insight Toolkit
itkDanielssonDistanceMapImageFilter.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 itkDanielssonDistanceMapImageFilter_h
19 #define itkDanielssonDistanceMapImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
58 template <typename TInputImage, typename TOutputImage, typename TVoronoiImage = TInputImage>
59 class ITK_TEMPLATE_EXPORT DanielssonDistanceMapImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
60 {
61 public:
62  ITK_DISALLOW_COPY_AND_MOVE(DanielssonDistanceMapImageFilter);
63 
69 
71 
73  itkNewMacro(Self);
74 
76  itkOverrideGetNameOfClassMacro(DanielssonDistanceMapImageFilter);
77 
79  using InputImageType = TInputImage;
80 
82  using InputPixelType = typename InputImageType::PixelType;
83 
86 
88  using IndexType = typename RegionType::IndexType;
89 
91  using OffsetType = typename InputImageType::OffsetType;
92 
94  using SpacingType = typename InputImageType::SpacingType;
95  using SpacingValueType = typename InputImageType::SpacingValueType;
96 
98  using SizeType = typename RegionType::SizeType;
99 
102 
105  using OutputImageType = TOutputImage;
106 
108  using OutputPixelType = typename OutputImageType::PixelType;
109 
110  using VoronoiImageType = TVoronoiImage;
112  using VoronoiPixelType = typename VoronoiImageType::PixelType;
113 
115  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
116 
119 
122 
125 
128 
130  itkSetMacro(SquaredDistance, bool);
131  itkGetConstReferenceMacro(SquaredDistance, bool);
132  itkBooleanMacro(SquaredDistance);
140  itkSetMacro(InputIsBinary, bool);
141  itkGetConstReferenceMacro(InputIsBinary, bool);
142  itkBooleanMacro(InputIsBinary);
146  itkSetMacro(UseImageSpacing, bool);
147  itkGetConstReferenceMacro(UseImageSpacing, bool);
148  itkBooleanMacro(UseImageSpacing);
157  GetVoronoiMap();
158 
168  GetDistanceMap();
169 
172  GetVectorDistanceMap();
173 
176  using Superclass::MakeOutput;
178  MakeOutput(DataObjectPointerArraySizeType idx) override;
179 
180 #ifdef ITK_USE_CONCEPT_CHECKING
181  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
182  static constexpr unsigned int VoronoiImageDimension = TVoronoiImage::ImageDimension;
183 
184  // Begin concept checking
187  itkConceptMacro(DoubleConvertibleToOutputCheck, (Concept::Convertible<double, OutputPixelType>));
189  // End concept checking
190 #endif
191 
192 protected:
194  ~DanielssonDistanceMapImageFilter() override = default;
195  void
196  PrintSelf(std::ostream & os, Indent indent) const override;
197 
199  void
200  GenerateData() override;
201 
203  void
204  PrepareData();
205 
207  void
208  ComputeVoronoiMap();
209 
211  void
212  UpdateLocalDistance(VectorImageType *, const IndexType &, const OffsetType &);
213 
214 private:
215  bool m_SquaredDistance{};
216  bool m_InputIsBinary{};
217  bool m_UseImageSpacing{ true };
218 
219  SpacingType m_InputSpacingCache{};
220 };
221 } // end namespace itk
222 
223 #ifndef ITK_MANUAL_INSTANTIATION
224 # include "itkDanielssonDistanceMapImageFilter.hxx"
225 #endif
226 
227 #endif
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::VoronoiImagePointer
typename VoronoiImageType::Pointer VoronoiImagePointer
Definition: itkDanielssonDistanceMapImageFilter.h:111
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::VectorImagePointer
typename VectorImageType::Pointer VectorImagePointer
Definition: itkDanielssonDistanceMapImageFilter.h:127
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::SpacingValueType
typename InputImageType::SpacingValueType SpacingValueType
Definition: itkDanielssonDistanceMapImageFilter.h:95
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::VoronoiPixelType
typename VoronoiImageType::PixelType VoronoiPixelType
Definition: itkDanielssonDistanceMapImageFilter.h:112
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::IndexType
typename RegionType::IndexType IndexType
Definition: itkDanielssonDistanceMapImageFilter.h:88
itk::ImageSource< ImageType >::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
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::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:194
itkImageRegionIteratorWithIndex.h
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Definition: itkDanielssonDistanceMapImageFilter.h:108
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
itk::DanielssonDistanceMapImageFilter
This filter computes the distance map of the input image as an approximation with pixel accuracy to t...
Definition: itkDanielssonDistanceMapImageFilter.h:59
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkDanielssonDistanceMapImageFilter.h:82
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::VoronoiImageType
ImageType VoronoiImageType
Definition: itkDanielssonDistanceMapImageFilter.h:110
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::ImageToImageFilter< ImageType, ImageType >::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter< ImageType, ImageType >::InputImageType
ImageType InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::OffsetType
typename InputImageType::OffsetType OffsetType
Definition: itkDanielssonDistanceMapImageFilter.h:91
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::SizeType
typename RegionType::SizeType SizeType
Definition: itkDanielssonDistanceMapImageFilter.h:98
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::DataObject::Pointer
SmartPointer< Self > Pointer
Definition: itkDataObject.h:301
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::SizeValueType
typename SizeType::SizeValueType SizeValueType
Definition: itkDanielssonDistanceMapImageFilter.h:101
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::SpacingType
typename InputImageType::SpacingType SpacingType
Definition: itkDanielssonDistanceMapImageFilter.h:94
itk::ImageSource< ImageType >::OutputImageType
ImageType OutputImageType
Definition: itkImageSource.h:90
itk::DanielssonDistanceMapImageFilter< ImageType, ImageType >::RegionType
typename InputImageType::RegionType RegionType
Definition: itkDanielssonDistanceMapImageFilter.h:85