ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkSignedMaurerDistanceMapImageFilter.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 itkSignedMaurerDistanceMapImageFilter_h
19 #define itkSignedMaurerDistanceMapImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
61 template< typename TInputImage, typename TOutputImage >
62 class ITK_TEMPLATE_EXPORT SignedMaurerDistanceMapImageFilter:
63  public ImageToImageFilter< TInputImage, TOutputImage >
64 {
65 public:
66 
68  itkStaticConstMacro(InputImageDimension, unsigned int,
69  TInputImage::ImageDimension);
70  itkStaticConstMacro(OutputImageDimension, unsigned int,
71  TOutputImage::ImageDimension);
72  itkStaticConstMacro(ImageDimension, unsigned int,
73  TOutputImage::ImageDimension);
75 
77  typedef TInputImage InputImageType;
78  typedef typename InputImageType::ConstPointer InputImageConstPointer;
79 
80  typedef TOutputImage OutputImageType;
81  typedef typename OutputImageType::Pointer OutputImagePointer;
82 
85  typedef ImageToImageFilter<
88 
91 
93  itkNewMacro(Self);
94 
98 
99  typedef typename InputImageType::RegionType InputRegionType;
100  typedef typename OutputImageType::RegionType OutputRegionType;
101 
103  typedef typename InputImageType::PixelType InputPixelType;
104  typedef typename OutputImageType::PixelType OutputPixelType;
105 
110 
115 
116  typedef typename InputImageType::SpacingType InputSpacingType;
117  typedef typename OutputImageType::SpacingType OutputSpacingType;
118  typedef typename OutputImageType::RegionType OutputImageRegionType;
119 
121  itkSetMacro(SquaredDistance, bool);
122 
124  itkGetConstReferenceMacro(SquaredDistance, bool);
125 
127  itkBooleanMacro(SquaredDistance);
128 
131  itkSetMacro(InsideIsPositive, bool);
132 
135  itkGetConstReferenceMacro(InsideIsPositive, bool);
136 
140  itkBooleanMacro(InsideIsPositive);
141 
143  itkSetMacro(UseImageSpacing, bool);
144 
146  itkGetConstReferenceMacro(UseImageSpacing, bool);
147 
149  itkBooleanMacro(UseImageSpacing);
150 
155  itkSetMacro(BackgroundValue, InputPixelType);
156  itkGetConstReferenceMacro(BackgroundValue, InputPixelType);
158 
159 protected:
161  virtual ~SignedMaurerDistanceMapImageFilter() ITK_OVERRIDE;
162 
163  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
164 
165  virtual void GenerateData() ITK_OVERRIDE;
166 
167  virtual unsigned int SplitRequestedRegion(unsigned int i, unsigned int num,
168  OutputImageRegionType & splitRegion) ITK_OVERRIDE;
169 
170  virtual void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
171  ThreadIdType threadId) ITK_OVERRIDE;
172 
173 private:
174  ITK_DISALLOW_COPY_AND_ASSIGN(SignedMaurerDistanceMapImageFilter);
175 
176  void Voronoi(unsigned int, OutputIndexType idx, OutputImageType *output );
177  bool Remove(OutputPixelType, OutputPixelType, OutputPixelType,
178  OutputPixelType, OutputPixelType, OutputPixelType);
179 
180  InputPixelType m_BackgroundValue;
181  InputSpacingType m_Spacing;
182 
183  unsigned int m_CurrentDimension;
184 
185  bool m_InsideIsPositive;
186  bool m_UseImageSpacing;
187  bool m_SquaredDistance;
188 
189  const InputImageType *m_InputCache;
190 };
191 } // end namespace itk
192 
193 #ifndef ITK_MANUAL_INSTANTIATION
194 #include "itkSignedMaurerDistanceMapImageFilter.hxx"
195 #endif
196 
197 #endif
signed long IndexValueType
Definition: itkIntTypes.h:150
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
This filter calculates the Euclidean distance transform of a binary image in linear time for arbitrar...
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Base class for filters that take an image as input and produce an image as output.
ImageToImageFilter< InputImageType, OutputImageType > Superclass
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TOutputImage OutputImageType