ITK  6.0.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  * https://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{ public: InputPixelType operator()(InputPixelType input)
31  const { if (input){ return InputPixelType {};
32 }
33 
35 } // namespace itk
36 }
37 ;
38 } // namespace Functor
39 } // namespace itk
40 
41 namespace itk
42 {
85 template <typename TInputImage, typename TOutputImage, typename TVoronoiImage = TInputImage>
86 class ITK_TEMPLATE_EXPORT SignedDanielssonDistanceMapImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
87 {
88 public:
89  ITK_DISALLOW_COPY_AND_MOVE(SignedDanielssonDistanceMapImageFilter);
90 
96 
98  itkNewMacro(Self);
99 
101  itkOverrideGetNameOfClassMacro(SignedDanielssonDistanceMapImageFilter);
102 
104  using InputImageType = TInputImage;
105 
108  using OutputImageType = TOutputImage;
109 
112 
115 
117  using OffsetType = typename InputImageType::OffsetType;
118 
120  using PixelType = typename InputImageType::PixelType;
121 
123  using SizeType = typename RegionType::SizeType;
124 
126  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
127 
130 
133 
136 
139 
140  using VoronoiImageType = TVoronoiImage;
142  using VoronoiPixelType = typename VoronoiImageType::PixelType;
143 
145  using typename Superclass::DataObjectPointer;
146 
148  itkSetMacro(SquaredDistance, bool);
149 
151  itkGetConstReferenceMacro(SquaredDistance, bool);
152 
154  itkBooleanMacro(SquaredDistance);
155 
157  itkSetMacro(UseImageSpacing, bool);
158 
160  itkGetConstReferenceMacro(UseImageSpacing, bool);
161 
163  itkBooleanMacro(UseImageSpacing);
164 
167  itkSetMacro(InsideIsPositive, bool);
168 
171  itkGetConstReferenceMacro(InsideIsPositive, bool);
172 
176  itkBooleanMacro(InsideIsPositive);
177 
184  GetVoronoiMap();
185 
195  GetDistanceMap();
196 
199  GetVectorDistanceMap();
200 
203  using Superclass::MakeOutput;
205  MakeOutput(DataObjectPointerArraySizeType idx) override;
206 
207 #ifdef ITK_USE_CONCEPT_CHECKING
208  // Begin concept checking
209  itkConceptMacro(IntConvertibleToInputCheck, (Concept::Convertible<int, PixelType>));
210  itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<PixelType>));
211  itkConceptMacro(OutputImagePixelTypeIsFloatingPointCheck,
213  // End concept checking
214 #endif
215 
216 protected:
218  ~SignedDanielssonDistanceMapImageFilter() override = default;
219  void
220  PrintSelf(std::ostream & os, Indent indent) const override;
221 
223  void
224  GenerateData() override;
225 
226 private:
227  bool m_SquaredDistance{};
228  bool m_UseImageSpacing{ true };
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::Functor::InvertIntensityFunctor
Definition: itkSignedDanielssonDistanceMapImageFilter.h:30
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::SignedDanielssonDistanceMapImageFilter::VoronoiImagePointer
typename VoronoiImageType::Pointer VoronoiImagePointer
Definition: itkSignedDanielssonDistanceMapImageFilter.h:141
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:717
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::SignedDanielssonDistanceMapImageFilter::OffsetType
typename InputImageType::OffsetType OffsetType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:117
itk::SignedDanielssonDistanceMapImageFilter::IndexType
typename RegionType::IndexType IndexType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:114
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:194
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:86
itk::SignedDanielssonDistanceMapImageFilter::SizeType
typename RegionType::SizeType SizeType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:123
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::NumericTraits::OneValue
static T OneValue()
Definition: itkNumericTraits.h:158
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::SignedDanielssonDistanceMapImageFilter::VoronoiImageType
TVoronoiImage VoronoiImageType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:140
itk::SignedDanielssonDistanceMapImageFilter::PixelType
typename InputImageType::PixelType PixelType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:120
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:955
itk::SignedDanielssonDistanceMapImageFilter::VoronoiPixelType
typename VoronoiImageType::PixelType VoronoiPixelType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:142
itkSubtractImageFilter.h
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkDanielssonDistanceMapImageFilter.h
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: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::Concept::Convertible
Definition: itkConceptChecking.h:217
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::Functor::InvertIntensityFunctor::operator()
InputPixelType operator()(InputPixelType input) const
Definition: itkSignedDanielssonDistanceMapImageFilter.h:30
itk::SignedDanielssonDistanceMapImageFilter::VectorImagePointer
typename VectorImageType::Pointer VectorImagePointer
Definition: itkSignedDanielssonDistanceMapImageFilter.h:138
itk::SignedDanielssonDistanceMapImageFilter::RegionType
typename InputImageType::RegionType RegionType
Definition: itkSignedDanielssonDistanceMapImageFilter.h:111
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90