ITK  4.13.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:
70 
72 
74  itkNewMacro(Self);
75 
78 
80  typedef TInputImage InputImageType;
81 
83  typedef typename InputImageType::PixelType InputPixelType;
84 
86  typedef typename InputImageType::RegionType RegionType;
87 
89  typedef typename RegionType::IndexType IndexType;
90 
92  typedef typename InputImageType::OffsetType OffsetType;
93 
95  typedef typename InputImageType::SpacingType SpacingType;
96  typedef typename InputImageType::SpacingValueType SpacingValueType;
97 
99  typedef typename RegionType::SizeType SizeType;
100 
103 
106  typedef TOutputImage OutputImageType;
107 
109  typedef typename OutputImageType::PixelType OutputPixelType;
110 
111  typedef TVoronoiImage VoronoiImageType;
112  typedef typename VoronoiImageType::Pointer VoronoiImagePointer;
113  typedef typename VoronoiImageType::PixelType VoronoiPixelType;
114 
116  itkStaticConstMacro(InputImageDimension, unsigned int,
117  InputImageType::ImageDimension);
118 
120  typedef Image< OffsetType,
121  itkGetStaticConstMacro(InputImageDimension) > VectorImageType;
122 
124  typedef typename InputImageType::ConstPointer InputImagePointer;
125 
127  typedef typename OutputImageType::Pointer OutputImagePointer;
128 
131 
133  itkSetMacro(SquaredDistance, bool);
134 
136  itkGetConstReferenceMacro(SquaredDistance, bool);
137 
139  itkBooleanMacro(SquaredDistance);
140 
146  itkSetMacro(InputIsBinary, bool);
147 
149  itkGetConstReferenceMacro(InputIsBinary, bool);
150 
152  itkBooleanMacro(InputIsBinary);
153 
155  itkSetMacro(UseImageSpacing, bool);
156 
158  itkGetConstReferenceMacro(UseImageSpacing, bool);
159 
161  itkBooleanMacro(UseImageSpacing);
162 
168  VoronoiImageType * GetVoronoiMap();
169 
178  OutputImageType * GetDistanceMap();
179 
181  VectorImageType * GetVectorDistanceMap();
182 
185  using Superclass::MakeOutput;
186  virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ) ITK_OVERRIDE;
187 
188 #ifdef ITK_USE_CONCEPT_CHECKING
189  itkStaticConstMacro(OutputImageDimension, unsigned int,
190  TOutputImage::ImageDimension);
191  itkStaticConstMacro(VoronoiImageDimension, unsigned int,
192  TVoronoiImage::ImageDimension);
193 
194  // Begin concept checking
195  itkConceptMacro( InputOutputSameDimensionCheck,
197  itkConceptMacro( InputVoronoiSameDimensionCheck,
199  itkConceptMacro( DoubleConvertibleToOutputCheck,
201  itkConceptMacro( InputConvertibleToOutputCheck,
203  OutputPixelType > ) );
204  // End concept checking
205 #endif
206 
207 protected:
209  virtual ~DanielssonDistanceMapImageFilter() ITK_OVERRIDE {}
210  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
211 
213  void GenerateData() ITK_OVERRIDE;
214 
216  void PrepareData();
217 
219  void ComputeVoronoiMap();
220 
222  void UpdateLocalDistance(VectorImageType *,
223  const IndexType &,
224  const OffsetType &);
225 
226 private:
227  ITK_DISALLOW_COPY_AND_ASSIGN(DanielssonDistanceMapImageFilter);
228 
229  bool m_SquaredDistance;
230  bool m_InputIsBinary;
231  bool m_UseImageSpacing;
232 
233  SpacingType m_InputSpacingCache;
234 
235 }; // end of DanielssonDistanceMapImageFilter class
236 } //end namespace itk
237 
238 #ifndef ITK_MANUAL_INSTANTIATION
239 #include "itkDanielssonDistanceMapImageFilter.hxx"
240 #endif
241 
242 #endif
Light weight base class for most itk classes.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Base class for filters that take an image as input and produce an image as output.
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Image< OffsetType, itkGetStaticConstMacro(InputImageDimension) > VectorImageType
This filter computes the distance map of the input image as an approximation with pixel accuracy to t...
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75