ITK  5.0.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  ITK_DISALLOW_COPY_AND_ASSIGN(SignedMaurerDistanceMapImageFilter);
67 
69  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
70  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
71  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
72 
74  using InputImageType = TInputImage;
75  using InputImageConstPointer = typename InputImageType::ConstPointer;
76 
77  using OutputImageType = TOutputImage;
78  using OutputImagePointer = typename OutputImageType::Pointer;
79 
85 
88 
90  itkNewMacro(Self);
91 
95 
98 
100  using InputPixelType = typename InputImageType::PixelType;
101  using OutputPixelType = typename OutputImageType::PixelType;
102 
107 
112 
113  using InputSpacingType = typename InputImageType::SpacingType;
114  using OutputSpacingType = typename OutputImageType::SpacingType;
116 
118  itkSetMacro(SquaredDistance, bool);
119 
121  itkGetConstReferenceMacro(SquaredDistance, bool);
122 
124  itkBooleanMacro(SquaredDistance);
125 
128  itkSetMacro(InsideIsPositive, bool);
129 
132  itkGetConstReferenceMacro(InsideIsPositive, bool);
133 
137  itkBooleanMacro(InsideIsPositive);
138 
140  itkSetMacro(UseImageSpacing, bool);
141 
143  itkGetConstReferenceMacro(UseImageSpacing, bool);
144 
146  itkBooleanMacro(UseImageSpacing);
147 
152  itkSetMacro(BackgroundValue, InputPixelType);
153  itkGetConstReferenceMacro(BackgroundValue, InputPixelType);
155 
156 protected:
158  ~SignedMaurerDistanceMapImageFilter() override = default;
159 
160  void PrintSelf(std::ostream & os, Indent indent) const override;
161 
162  void GenerateData() override;
163 
164  unsigned int SplitRequestedRegion(unsigned int i, unsigned int num,
165  OutputImageRegionType & splitRegion) override;
166 
167  void ThreadedGenerateData(const OutputImageRegionType &, ThreadIdType ) override;
168 
170  {
171  itkExceptionMacro("This class requires threadId so it must use classic multi-threading model");
172  }
173 
174 private:
175  void Voronoi(unsigned int, OutputIndexType idx, OutputImageType *output );
176  bool Remove(OutputPixelType, OutputPixelType, OutputPixelType,
177  OutputPixelType, OutputPixelType, OutputPixelType);
178 
181 
182  unsigned int m_CurrentDimension{0};
183 
184  bool m_InsideIsPositive{false};
185  bool m_UseImageSpacing{true};
186  bool m_SquaredDistance{false};
187 
189 };
190 } // end namespace itk
191 
192 #ifndef ITK_MANUAL_INSTANTIATION
193 #include "itkSignedMaurerDistanceMapImageFilter.hxx"
194 #endif
195 
196 #endif
typename OutputImageType::Pointer OutputImagePointer
typename InputImageType::SizeValueType InputSizeValueType
typename OutputImageType::SizeValueType OutputSizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
typename OutputImageType::IndexValueType OutputIndexValueType
Base class for all process objects that output image data.
This filter calculates the Euclidean distance transform of a binary image in linear time for arbitrar...
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
signed long IndexValueType
Definition: itkIntTypes.h:90
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
void DynamicThreadedGenerateData(const OutputImageRegionType &) override
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
typename InputImageType::IndexValueType InputIndexValueType
typename InputImageType::ConstPointer InputImageConstPointer