ITK  5.2.0
Insight Toolkit
itkSignedDanielssonDistanceMapImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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
34  operator()(InputPixelType input) const
35  {
36  if (input)
37  {
39  }
40  else
41  {
43  }
44  }
45 };
46 } // namespace Functor
47 } // namespace itk
48 
49 namespace itk
50 {
93 template <typename TInputImage, typename TOutputImage, typename TVoronoiImage = TInputImage>
94 class ITK_TEMPLATE_EXPORT SignedDanielssonDistanceMapImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
95 {
96 public:
97  ITK_DISALLOW_COPY_AND_MOVE(SignedDanielssonDistanceMapImageFilter);
98 
104 
106  itkNewMacro(Self);
107 
110 
112  using InputImageType = TInputImage;
113 
116  using OutputImageType = TOutputImage;
117 
120 
123 
125  using OffsetType = typename InputImageType::OffsetType;
126 
128  using PixelType = typename InputImageType::PixelType;
129 
131  using SizeType = typename RegionType::SizeType;
132 
134  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
135 
138 
140  using InputImagePointer = typename InputImageType::ConstPointer;
141 
143  using OutputImagePointer = typename OutputImageType::Pointer;
144 
147 
148  using VoronoiImageType = TVoronoiImage;
149  using VoronoiImagePointer = typename VoronoiImageType::Pointer;
150  using VoronoiPixelType = typename VoronoiImageType::PixelType;
151 
154 
156  itkSetMacro(SquaredDistance, bool);
157 
159  itkGetConstReferenceMacro(SquaredDistance, bool);
160 
162  itkBooleanMacro(SquaredDistance);
163 
165  itkSetMacro(UseImageSpacing, bool);
166 
168  itkGetConstReferenceMacro(UseImageSpacing, bool);
169 
171  itkBooleanMacro(UseImageSpacing);
172 
175  itkSetMacro(InsideIsPositive, bool);
176 
179  itkGetConstReferenceMacro(InsideIsPositive, bool);
180 
184  itkBooleanMacro(InsideIsPositive);
185 
192  GetVoronoiMap();
193 
203  GetDistanceMap();
204 
207  GetVectorDistanceMap();
208 
211  using Superclass::MakeOutput;
213  MakeOutput(DataObjectPointerArraySizeType idx) override;
214 
215 #ifdef ITK_USE_CONCEPT_CHECKING
216  // Begin concept checking
217  itkConceptMacro(IntConvertibleToInputCheck, (Concept::Convertible<int, PixelType>));
218  itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<PixelType>));
219  itkConceptMacro(OutputImagePixelTypeIsFloatingPointCheck,
221  // End concept checking
222 #endif
223 
224 protected:
226  ~SignedDanielssonDistanceMapImageFilter() override = default;
227  void
228  PrintSelf(std::ostream & os, Indent indent) const override;
229 
231  void
232  GenerateData() override;
233 
234 private:
237  bool m_InsideIsPositive; // ON is treated as inside pixels
238 }; // end of SignedDanielssonDistanceMapImageFilter
239  // class
240 } // end namespace itk
241 
242 #ifndef ITK_MANUAL_INSTANTIATION
243 # include "itkSignedDanielssonDistanceMapImageFilter.hxx"
244 #endif
245 
246 #endif
itk::Functor::InvertIntensityFunctor
Definition: itkSignedDanielssonDistanceMapImageFilter.h:30
itk::SignedDanielssonDistanceMapImageFilter::VoronoiImagePointer
typename VoronoiImageType::Pointer VoronoiImagePointer
Definition: itkSignedDanielssonDistanceMapImageFilter.h:149
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:714
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::SignedDanielssonDistanceMapImageFilter::m_InsideIsPositive
bool m_InsideIsPositive
Definition: itkSignedDanielssonDistanceMapImageFilter.h:237
itk::SignedDanielssonDistanceMapImageFilter::OffsetType
typename InputImageType::OffsetType OffsetType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:125
itk::SignedDanielssonDistanceMapImageFilter::IndexType
typename RegionType::IndexType IndexType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:122
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:193
itk::SignedDanielssonDistanceMapImageFilter::m_UseImageSpacing
bool m_UseImageSpacing
Definition: itkSignedDanielssonDistanceMapImageFilter.h:236
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::SignedDanielssonDistanceMapImageFilter
This filter computes the signed distance map of the input image as an approximation with pixel accura...
Definition: itkSignedDanielssonDistanceMapImageFilter.h:94
itk::SignedDanielssonDistanceMapImageFilter::SizeType
typename RegionType::SizeType SizeType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:131
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::NumericTraits::OneValue
static T OneValue()
Definition: itkNumericTraits.h:156
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::SignedDanielssonDistanceMapImageFilter::VoronoiImageType
TVoronoiImage VoronoiImageType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:148
itk::SignedDanielssonDistanceMapImageFilter::PixelType
typename InputImageType::PixelType PixelType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:128
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:946
itk::SignedDanielssonDistanceMapImageFilter::VoronoiPixelType
typename VoronoiImageType::PixelType VoronoiPixelType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:150
itkSubtractImageFilter.h
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkDanielssonDistanceMapImageFilter.h
itk::NumericTraits::ZeroValue
static T ZeroValue()
Definition: itkNumericTraits.h:148
itk::ImageSource::DataObjectPointerArraySizeType
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: itkImageSource.h:84
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::SignedDanielssonDistanceMapImageFilter::m_SquaredDistance
bool m_SquaredDistance
Definition: itkSignedDanielssonDistanceMapImageFilter.h:235
itk::Functor::InvertIntensityFunctor::operator()
InputPixelType operator()(InputPixelType input) const
Definition: itkSignedDanielssonDistanceMapImageFilter.h:34
itk::SignedDanielssonDistanceMapImageFilter::VectorImagePointer
typename VectorImageType::Pointer VectorImagePointer
Definition: itkSignedDanielssonDistanceMapImageFilter.h:146
itk::SignedDanielssonDistanceMapImageFilter::RegionType
typename InputImageType::RegionType RegionType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:119
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90