ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkSignedDanielssonDistanceMapImageFilter.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 __itkSignedDanielssonDistanceMapImageFilter_h
19 #define __itkSignedDanielssonDistanceMapImageFilter_h
20 
22 #include "itkSubtractImageFilter.h"
23 
24 //Simple functor to invert an image for Outside Danielsson distance map
25 namespace itk
26 {
27 namespace Functor
28 {
29 template< class InputPixelType >
31 {
32 public:
33  InputPixelType operator()(InputPixelType input) const
34  {
35  if ( input )
36  {
38  }
39  else
40  {
42  }
43  }
44 };
45 }
46 }
47 
48 namespace itk
49 {
87 template< class TInputImage,
88  class TOutputImage,
89  class TVoronoiImage = TInputImage >
91  public ImageToImageFilter< TInputImage, TOutputImage >
92 {
93 public:
99 
101  itkNewMacro(Self);
102 
105 
107  typedef TInputImage InputImageType;
108 
111  typedef TOutputImage OutputImageType;
112 
114  typedef typename InputImageType::RegionType RegionType;
115 
117  typedef typename RegionType::IndexType IndexType;
118 
120  typedef typename InputImageType::OffsetType OffsetType;
121 
123  typedef typename InputImageType::PixelType PixelType;
124 
126  typedef typename RegionType::SizeType SizeType;
127 
129  itkStaticConstMacro(InputImageDimension, unsigned int,
130  InputImageType::ImageDimension);
131 
133  typedef Image< OffsetType,
134  itkGetStaticConstMacro(InputImageDimension) > VectorImageType;
135 
137  typedef typename InputImageType::ConstPointer InputImagePointer;
138 
140  typedef typename OutputImageType::Pointer OutputImagePointer;
141 
144 
145  typedef TVoronoiImage VoronoiImageType;
146  typedef typename VoronoiImageType::Pointer VoronoiImagePointer;
147  typedef typename VoronoiImageType::PixelType VoronoiPixelType;
148 
151 
153  itkSetMacro(SquaredDistance, bool);
154 
156  itkGetConstReferenceMacro(SquaredDistance, bool);
157 
159  itkBooleanMacro(SquaredDistance);
160 
162  itkSetMacro(UseImageSpacing, bool);
163 
165  itkGetConstReferenceMacro(UseImageSpacing, bool);
166 
168  itkBooleanMacro(UseImageSpacing);
169 
172  itkSetMacro(InsideIsPositive, bool);
173 
176  itkGetConstReferenceMacro(InsideIsPositive, bool);
177 
181  itkBooleanMacro(InsideIsPositive);
182 
188  VoronoiImageType * GetVoronoiMap(void);
189 
198  OutputImageType * GetDistanceMap(void);
199 
201  VectorImageType * GetVectorDistanceMap(void);
202 
205  using Superclass::MakeOutput;
206  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
207 
208 #ifdef ITK_USE_CONCEPT_CHECKING
209 
210  itkConceptMacro( IntConvertibleToInputCheck,
212  itkConceptMacro( InputHasNumericTraitsCheck,
214 
216 #endif
217 
218 protected:
221  void PrintSelf(std::ostream & os, Indent indent) const;
222 
224  void GenerateData();
225 
226 private:
227  SignedDanielssonDistanceMapImageFilter(const Self &); //purposely not
228  // implemented
229  void operator=(const Self &); //purposely not
230 
231  // implemented
232 
235  bool m_InsideIsPositive; // ON is treated as inside pixels
236 }; // end of SignedDanielssonDistanceMapImageFilter
237  // class
238 } //end namespace itk
239 
240 #ifndef ITK_MANUAL_INSTANTIATION
241 #include "itkSignedDanielssonDistanceMapImageFilter.hxx"
242 #endif
243 
244 #endif
245