ITK  4.13.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< typename InputPixelType >
30 class ITK_TEMPLATE_EXPORT InvertIntensityFunctor
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< typename TInputImage,
88  typename TOutputImage,
89  typename TVoronoiImage = TInputImage >
90 class ITK_TEMPLATE_EXPORT SignedDanielssonDistanceMapImageFilter:
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 
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();
189 
198  OutputImageType * GetDistanceMap();
199 
201  VectorImageType * GetVectorDistanceMap();
202 
205  using Superclass::MakeOutput;
206  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE;
207 
208 #ifdef ITK_USE_CONCEPT_CHECKING
209  // Begin concept checking
210  itkConceptMacro( IntConvertibleToInputCheck,
212  itkConceptMacro( InputHasNumericTraitsCheck,
214  // End concept checking
215 #endif
216 
217 protected:
219  virtual ~SignedDanielssonDistanceMapImageFilter() ITK_OVERRIDE {}
220  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
221 
223  void GenerateData() ITK_OVERRIDE;
224 
225 private:
226  ITK_DISALLOW_COPY_AND_ASSIGN(SignedDanielssonDistanceMapImageFilter);
227 
228  bool m_SquaredDistance;
229  bool m_UseImageSpacing;
230  bool m_InsideIsPositive; // ON is treated as inside pixels
231 }; // end of SignedDanielssonDistanceMapImageFilter
232  // class
233 } //end namespace itk
234 
235 #ifndef ITK_MANUAL_INSTANTIATION
236 #include "itkSignedDanielssonDistanceMapImageFilter.hxx"
237 #endif
238 
239 #endif
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Image< OffsetType, itkGetStaticConstMacro(InputImageDimension) > VectorImageType
Base class for all process objects that output image data.
InputPixelType operator()(InputPixelType input) const
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
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
TOutputImage OutputImageType
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75
ImageToImageFilter< TInputImage, TOutputImage > Superclass