ITK  4.2.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< class TInputImage,
59  class TOutputImage,
60  class TVoronoiImage = TInputImage >
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(void);
169 
178  OutputImageType * GetDistanceMap(void);
179 
181  VectorImageType * GetVectorDistanceMap(void);
182 
185  using Superclass::MakeOutput;
186  virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx );
187 
188 #ifdef ITK_USE_CONCEPT_CHECKING
189  itkStaticConstMacro(OutputImageDimension, unsigned int,
190  TOutputImage::ImageDimension);
191  itkStaticConstMacro(VoronoiImageDimension, unsigned int,
192  TVoronoiImage::ImageDimension);
193 
195  itkConceptMacro( InputOutputSameDimensionCheck,
197  itkConceptMacro( InputVoronoiSameDimensionCheck,
199  itkConceptMacro( DoubleConvertibleToOutputCheck,
201  itkConceptMacro( InputConvertibleToOutputCheck,
203  OutputPixelType > ) );
204 
206 #endif
207 protected:
210  void PrintSelf(std::ostream & os, Indent indent) const;
212 
214  void GenerateData();
215 
217  void PrepareData();
218 
220  void ComputeVoronoiMap();
221 
223  void UpdateLocalDistance(VectorImageType *,
224  const IndexType &,
225  const OffsetType &);
226 
227 private:
228  DanielssonDistanceMapImageFilter(const Self &); //purposely not implemented
229  void operator=(const Self &); //purposely not implemented
230 
234 }; // end of DanielssonDistanceMapImageFilter class
235 } //end namespace itk
236 
237 #ifndef ITK_MANUAL_INSTANTIATION
238 #include "itkDanielssonDistanceMapImageFilter.hxx"
239 #endif
240 
241 #endif
242