ITK  6.0.0
Insight Toolkit
itkMorphologyImageFilter.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 itkMorphologyImageFilter_h
19 #define itkMorphologyImageFilter_h
20 
21 #include "itkKernelImageFilter.h"
23 #include "itkNeighborhood.h"
24 #include "itkConstSliceIterator.h"
26 #include "itkImageRegionIterator.h"
27 
28 namespace itk
29 {
71 template <typename TInputImage, typename TOutputImage, typename TKernel>
72 class ITK_TEMPLATE_EXPORT MorphologyImageFilter : public KernelImageFilter<TInputImage, TOutputImage, TKernel>
73 {
74 public:
75  ITK_DISALLOW_COPY_AND_MOVE(MorphologyImageFilter);
76 
82 
84  itkOverrideGetNameOfClassMacro(MorphologyImageFilter);
85 
87  using InputImageType = TInputImage;
88  using OutputImageType = TOutputImage;
90  using SizeType = typename TInputImage::SizeType;
92  using PixelType = typename TInputImage::PixelType;
93  using typename Superclass::OutputImageRegionType;
94 
96  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
97 
102 
105 
107  using KernelType = TKernel;
108 
110  using KernelIteratorType = typename KernelType::ConstIterator;
111 
114 
120  void
122  {
123  m_BoundaryCondition = i;
124  }
125 
127  void
129  {
130  m_BoundaryCondition = &m_DefaultBoundaryCondition;
131  }
132 
134  itkGetConstMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
135 
136 protected:
138  ~MorphologyImageFilter() override = default;
139  void
140  PrintSelf(std::ostream & os, Indent indent) const override;
141 
143  void
144  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
145 
146 
149  virtual PixelType
150  Evaluate(const NeighborhoodIteratorType & nit,
151  const KernelIteratorType kernelBegin,
152  const KernelIteratorType kernelEnd) = 0;
153 
154 private:
157  ImageBoundaryConditionPointerType m_BoundaryCondition{};
158 
160  DefaultBoundaryConditionType m_DefaultBoundaryCondition{};
161 }; // end of class
162 } // end namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 # include "itkMorphologyImageFilter.hxx"
166 #endif
167 
168 #endif
itk::MorphologyImageFilter::KernelIteratorType
typename KernelType::ConstIterator KernelIteratorType
Definition: itkMorphologyImageFilter.h:110
itkNeighborhoodIterator.h
itk::MorphologyImageFilter::PixelType
typename TInputImage::PixelType PixelType
Definition: itkMorphologyImageFilter.h:92
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itkImageRegionIterator.h
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkConstSliceIterator.h
itkNeighborhood.h
itk::BoxImageFilter::RadiusType
typename TInputImage::SizeType RadiusType
Definition: itkBoxImageFilter.h:73
itkConstantBoundaryCondition.h
itk::ImageBoundaryCondition< InputImageType >
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ConstantBoundaryCondition< InputImageType >
itkKernelImageFilter.h
itk::BoxImageFilter::IndexType
typename TInputImage::IndexType IndexType
Definition: itkBoxImageFilter.h:61
itk::MorphologyImageFilter
Base class for the morphological operations such as erosion and dilation.
Definition: itkMorphologyImageFilter.h:72
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::MorphologyImageFilter::ResetBoundaryCondition
void ResetBoundaryCondition()
Definition: itkMorphologyImageFilter.h:128
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ConstNeighborhoodIterator< TInputImage >
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::KernelImageFilter::KernelType
TKernel KernelType
Definition: itkKernelImageFilter.h:71
itk::BoxImageFilter::SizeType
typename TInputImage::SizeType SizeType
Definition: itkBoxImageFilter.h:60
itk::KernelImageFilter
A base class for all the filters working on an arbitrary shaped neighborhood.
Definition: itkKernelImageFilter.h:41
itk::MorphologyImageFilter::OverrideBoundaryCondition
void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
Definition: itkMorphologyImageFilter.h:121
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::BoxImageFilter::RegionType
typename TInputImage::RegionType RegionType
Definition: itkBoxImageFilter.h:59