ITK  5.4.0
Insight Toolkit
itkGrayscaleMorphologicalOpeningImageFilter.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 itkGrayscaleMorphologicalOpeningImageFilter_h
19 #define itkGrayscaleMorphologicalOpeningImageFilter_h
20 
21 #include "itkKernelImageFilter.h"
31 #include "itkNeighborhood.h"
32 
33 namespace itk
34 {
50 template <typename TInputImage, typename TOutputImage, typename TKernel>
52  : public KernelImageFilter<TInputImage, TOutputImage, TKernel>
53 {
54 public:
55  ITK_DISALLOW_COPY_AND_MOVE(GrayscaleMorphologicalOpeningImageFilter);
56 
62 
64  itkNewMacro(Self);
65 
67  itkOverrideGetNameOfClassMacro(GrayscaleMorphologicalOpeningImageFilter);
68 
70  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
71 
73  using InputImageType = TInputImage;
74  using OutputImageType = TOutputImage;
76  using SizeType = typename TInputImage::SizeType;
78  using PixelType = typename TInputImage::PixelType;
79  using OffsetType = typename TInputImage::OffsetType;
80  using typename Superclass::OutputImageRegionType;
81 
82  using FlatKernelType = FlatStructuringElement<(Self::ImageDimension)>;
91 
93  using KernelType = TKernel;
94  // using KernelSuperclass = typename KernelType::Superclass;
95  // using KernelSuperclass = Neighborhood< typename KernelType::PixelType, ImageDimension >;
96 
98 
99 #if !defined(ITK_LEGACY_REMOVE)
100 
101  using AlgorithmType = AlgorithmEnum;
102  // We need to expose the enum values at the class level
103  // for backwards compatibility
104  static constexpr AlgorithmType BASIC = AlgorithmEnum::BASIC;
105  static constexpr AlgorithmType HISTO = AlgorithmEnum::HISTO;
106  static constexpr AlgorithmType ANCHOR = AlgorithmEnum::ANCHOR;
107  static constexpr AlgorithmType VHGW = AlgorithmEnum::VHGW;
108 #endif
109 
111  void
112  SetKernel(const KernelType & kernel) override;
113 
115  void
116  SetAlgorithm(AlgorithmEnum algo);
117  itkGetConstMacro(Algorithm, AlgorithmEnum);
122  void
123  Modified() const override;
124 
127  itkSetMacro(SafeBorder, bool);
128  itkGetConstReferenceMacro(SafeBorder, bool);
129  itkBooleanMacro(SafeBorder);
132 protected:
134  ~GrayscaleMorphologicalOpeningImageFilter() override = default;
135  void
136  PrintSelf(std::ostream & os, Indent indent) const override;
137 
138  void
139  GenerateData() override;
140 
141 private:
142  // the filters used internally
143  typename HistogramDilateFilterType::Pointer m_HistogramDilateFilter{};
144 
145  typename HistogramErodeFilterType::Pointer m_HistogramErodeFilter{};
146 
147  typename BasicDilateFilterType::Pointer m_BasicDilateFilter{};
148 
149  typename BasicErodeFilterType::Pointer m_BasicErodeFilter{};
150 
151  typename VanHerkGilWermanDilateFilterType::Pointer m_VanHerkGilWermanDilateFilter{};
152 
153  typename VanHerkGilWermanErodeFilterType::Pointer m_VanHerkGilWermanErodeFilter{};
154 
155  typename AnchorFilterType::Pointer m_AnchorFilter{};
156 
157  // and the name of the filter
158  AlgorithmEnum m_Algorithm{ AlgorithmEnum::HISTO };
159 
160  bool m_SafeBorder{ true };
161 }; // end of class
162 } // end namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 # include "itkGrayscaleMorphologicalOpeningImageFilter.hxx"
166 #endif
167 
168 #endif
itkVanHerkGilWermanDilateImageFilter.h
Algorithm
Algorithm or implementation used in the dilation/erosion operations.
itk::CastImageFilter
Casts input pixels to output pixel type.
Definition: itkCastImageFilter.h:100
itk::GrayscaleMorphologicalOpeningImageFilter::PixelType
typename TInputImage::PixelType PixelType
Definition: itkGrayscaleMorphologicalOpeningImageFilter.h:78
itkAnchorOpenImageFilter.h
itkMovingHistogramDilateImageFilter.h
itk::BasicDilateImageFilter
Grayscale dilation of an image.
Definition: itkBasicDilateImageFilter.h:48
itk::FlatStructuringElement
A class to support a variety of flat structuring elements, including versions created by decompositio...
Definition: itkKernelImageFilter.h:27
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::BasicErodeImageFilter
Grayscale erosion of an image.
Definition: itkBasicErodeImageFilter.h:46
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::MovingHistogramErodeImageFilter
Grayscale erosion of an image.
Definition: itkMovingHistogramErodeImageFilter.h:42
itkNeighborhood.h
itk::VanHerkGilWermanErodeImageFilter
Definition: itkVanHerkGilWermanErodeImageFilter.h:39
itk::BoxImageFilter::OffsetType
typename TInputImage::OffsetType OffsetType
Definition: itkBoxImageFilter.h:62
itkConstantBoundaryCondition.h
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
itkKernelImageFilter.h
itk::BoxImageFilter::IndexType
typename TInputImage::IndexType IndexType
Definition: itkBoxImageFilter.h:61
itk::GrayscaleMorphologicalOpeningImageFilter
Grayscale opening of an image.
Definition: itkGrayscaleMorphologicalOpeningImageFilter.h:51
itkMovingHistogramErodeImageFilter.h
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkMathematicalMorphologyEnums.h
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::MathematicalMorphologyEnums::Algorithm
Algorithm
Definition: itkMathematicalMorphologyEnums.h:42
itk::AnchorOpenImageFilter
Definition: itkAnchorOpenImageFilter.h:26
itkBasicErodeImageFilter.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::MovingHistogramDilateImageFilter
Grayscale dilation of an image.
Definition: itkMovingHistogramDilateImageFilter.h:43
itkVanHerkGilWermanErodeImageFilter.h
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::VanHerkGilWermanDilateImageFilter
Definition: itkVanHerkGilWermanDilateImageFilter.h:38
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::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::BoxImageFilter::RegionType
typename TInputImage::RegionType RegionType
Definition: itkBoxImageFilter.h:59
itkBasicDilateImageFilter.h