ITK  5.0.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:
94  ITK_DISALLOW_COPY_AND_ASSIGN(SignedDanielssonDistanceMapImageFilter);
95 
101 
103  itkNewMacro(Self);
104 
107 
109  using InputImageType = TInputImage;
110 
113  using OutputImageType = TOutputImage;
114 
117 
120 
122  using OffsetType = typename InputImageType::OffsetType;
123 
125  using PixelType = typename InputImageType::PixelType;
126 
128  using SizeType = typename RegionType::SizeType;
129 
131  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
132 
135  Self::InputImageDimension >;
136 
138  using InputImagePointer = typename InputImageType::ConstPointer;
139 
141  using OutputImagePointer = typename OutputImageType::Pointer;
142 
145 
146  using VoronoiImageType = TVoronoiImage;
147  using VoronoiImagePointer = typename VoronoiImageType::Pointer;
148  using VoronoiPixelType = typename VoronoiImageType::PixelType;
149 
152 
154  itkSetMacro(SquaredDistance, bool);
155 
157  itkGetConstReferenceMacro(SquaredDistance, bool);
158 
160  itkBooleanMacro(SquaredDistance);
161 
163  itkSetMacro(UseImageSpacing, bool);
164 
166  itkGetConstReferenceMacro(UseImageSpacing, bool);
167 
169  itkBooleanMacro(UseImageSpacing);
170 
173  itkSetMacro(InsideIsPositive, bool);
174 
177  itkGetConstReferenceMacro(InsideIsPositive, bool);
178 
182  itkBooleanMacro(InsideIsPositive);
183 
189  VoronoiImageType * GetVoronoiMap();
190 
199  OutputImageType * GetDistanceMap();
200 
202  VectorImageType * GetVectorDistanceMap();
203 
206  using Superclass::MakeOutput;
207  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
208 
209 #ifdef ITK_USE_CONCEPT_CHECKING
210  // Begin concept checking
211  itkConceptMacro( IntConvertibleToInputCheck,
213  itkConceptMacro( InputHasNumericTraitsCheck,
215  // End concept checking
216 #endif
217 
218 protected:
220  ~SignedDanielssonDistanceMapImageFilter() override = default;
221  void PrintSelf(std::ostream & os, Indent indent) const override;
222 
224  void GenerateData() override;
225 
226 private:
229  bool m_InsideIsPositive; // ON is treated as inside pixels
230 }; // end of SignedDanielssonDistanceMapImageFilter
231  // class
232 } //end namespace itk
233 
234 #ifndef ITK_MANUAL_INSTANTIATION
235 #include "itkSignedDanielssonDistanceMapImageFilter.hxx"
236 #endif
237 
238 #endif
typename OutputImageType::Pointer OutputImagePointer
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Define numeric traits for std::vector.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename InputImageType::Pointer InputImagePointer
InputPixelType operator()(InputPixelType input) const
TOutputImage OutputImageType
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
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75