ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkDanielssonDistanceMapImageFilter.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 itkDanielssonDistanceMapImageFilter_h
19 #define itkDanielssonDistanceMapImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
58 template< typename TInputImage,
59  typename TOutputImage,
60  typename TVoronoiImage = TInputImage >
61 class ITK_TEMPLATE_EXPORT DanielssonDistanceMapImageFilter:
62  public ImageToImageFilter< TInputImage, TOutputImage >
63 {
64 public:
65  ITK_DISALLOW_COPY_AND_ASSIGN(DanielssonDistanceMapImageFilter);
66 
72 
74 
76  itkNewMacro(Self);
77 
80 
82  using InputImageType = TInputImage;
83 
85  using InputPixelType = typename InputImageType::PixelType;
86 
89 
91  using IndexType = typename RegionType::IndexType;
92 
94  using OffsetType = typename InputImageType::OffsetType;
95 
97  using SpacingType = typename InputImageType::SpacingType;
98  using SpacingValueType = typename InputImageType::SpacingValueType;
99 
101  using SizeType = typename RegionType::SizeType;
102 
105 
108  using OutputImageType = TOutputImage;
109 
111  using OutputPixelType = typename OutputImageType::PixelType;
112 
113  using VoronoiImageType = TVoronoiImage;
114  using VoronoiImagePointer = typename VoronoiImageType::Pointer;
115  using VoronoiPixelType = typename VoronoiImageType::PixelType;
116 
118  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
119 
122  Self::InputImageDimension >;
123 
125  using InputImagePointer = typename InputImageType::ConstPointer;
126 
128  using OutputImagePointer = typename OutputImageType::Pointer;
129 
132 
134  itkSetMacro(SquaredDistance, bool);
135 
137  itkGetConstReferenceMacro(SquaredDistance, bool);
138 
140  itkBooleanMacro(SquaredDistance);
141 
147  itkSetMacro(InputIsBinary, bool);
148 
150  itkGetConstReferenceMacro(InputIsBinary, bool);
151 
153  itkBooleanMacro(InputIsBinary);
154 
156  itkSetMacro(UseImageSpacing, bool);
157 
159  itkGetConstReferenceMacro(UseImageSpacing, bool);
160 
162  itkBooleanMacro(UseImageSpacing);
163 
169  VoronoiImageType * GetVoronoiMap();
170 
179  OutputImageType * GetDistanceMap();
180 
182  VectorImageType * GetVectorDistanceMap();
183 
186  using Superclass::MakeOutput;
187  DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ) override;
188 
189 #ifdef ITK_USE_CONCEPT_CHECKING
190  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
191  static constexpr unsigned int VoronoiImageDimension = TVoronoiImage::ImageDimension;
192 
193  // Begin concept checking
194  itkConceptMacro( InputOutputSameDimensionCheck,
196  itkConceptMacro( InputVoronoiSameDimensionCheck,
198  itkConceptMacro( DoubleConvertibleToOutputCheck,
200  itkConceptMacro( InputConvertibleToOutputCheck,
202  OutputPixelType > ) );
203  // End concept checking
204 #endif
205 
206 protected:
208  ~DanielssonDistanceMapImageFilter() override = default;
209  void PrintSelf(std::ostream & os, Indent indent) const override;
210 
212  void GenerateData() override;
213 
215  void PrepareData();
216 
218  void ComputeVoronoiMap();
219 
221  void UpdateLocalDistance(VectorImageType *,
222  const IndexType &,
223  const OffsetType &);
224 
225 private:
229 
231 
232 }; // end of DanielssonDistanceMapImageFilter class
233 } //end namespace itk
234 
235 #ifndef ITK_MANUAL_INSTANTIATION
236 #include "itkDanielssonDistanceMapImageFilter.hxx"
237 #endif
238 
239 #endif
typename OutputImageType::Pointer OutputImagePointer
Light weight base class for most itk classes.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename InputImageType::Pointer InputImagePointer
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
This filter computes the distance map of the input image as an approximation with pixel accuracy to t...
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75