ITK  6.0.0
Insight Toolkit
itkMorphologicalGradientImageFilter.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 itkMorphologicalGradientImageFilter_h
19 #define itkMorphologicalGradientImageFilter_h
20 
21 #include "itkKernelImageFilter.h"
30 #include "itkSubtractImageFilter.h"
32 #include "itkNeighborhood.h"
33 
34 namespace itk
35 {
49 template <typename TInputImage, typename TOutputImage, typename TKernel>
50 class ITK_TEMPLATE_EXPORT MorphologicalGradientImageFilter
51  : public KernelImageFilter<TInputImage, TOutputImage, TKernel>
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_MOVE(MorphologicalGradientImageFilter);
55 
61 
63  itkNewMacro(Self);
64 
66  itkOverrideGetNameOfClassMacro(MorphologicalGradientImageFilter);
67 
69  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
70 
72  using InputImageType = TInputImage;
73  using OutputImageType = TOutputImage;
75  using SizeType = typename TInputImage::SizeType;
77  using PixelType = typename TInputImage::PixelType;
78  using OffsetType = typename TInputImage::OffsetType;
79  using typename Superclass::OutputImageRegionType;
80 
90 
92  using KernelType = TKernel;
93  // using KernelSuperclass = typename KernelType::Superclass;
94  // using KernelSuperclass = Neighborhood< typename KernelType::PixelType, ImageDimension >;
95 
97 
98 #if !defined(ITK_LEGACY_REMOVE)
99 
100  using AlgorithmType = AlgorithmEnum;
101  // We need to expose the enum values at the class level
102  // for backwards compatibility
103  static constexpr AlgorithmType BASIC = AlgorithmEnum::BASIC;
104  static constexpr AlgorithmType HISTO = AlgorithmEnum::HISTO;
105  static constexpr AlgorithmType ANCHOR = AlgorithmEnum::ANCHOR;
106  static constexpr AlgorithmType VHGW = AlgorithmEnum::VHGW;
107 #endif
108 
110  void
111  SetKernel(const KernelType & kernel) override;
112 
114  void
115  SetAlgorithm(AlgorithmEnum algo);
116  itkGetConstMacro(Algorithm, AlgorithmEnum);
121  void
122  Modified() const override;
123 
124 protected:
126  ~MorphologicalGradientImageFilter() override = default;
127  void
128  PrintSelf(std::ostream & os, Indent indent) const override;
129 
130  void
131  GenerateData() override;
132 
133 private:
134  // the filters used internally
135  typename HistogramFilterType::Pointer m_HistogramFilter{};
136 
137  typename BasicDilateFilterType::Pointer m_BasicDilateFilter{};
138 
139  typename BasicErodeFilterType::Pointer m_BasicErodeFilter{};
140 
141  typename AnchorDilateFilterType::Pointer m_AnchorDilateFilter{};
142 
143  typename AnchorErodeFilterType::Pointer m_AnchorErodeFilter{};
144 
145  typename VHGWDilateFilterType::Pointer m_VanHerkGilWermanDilateFilter{};
146 
147  typename VHGWErodeFilterType::Pointer m_VanHerkGilWermanErodeFilter{};
148 
149  // and the name of the filter
150  AlgorithmEnum m_Algorithm{};
151 }; // end of class
152 } // end namespace itk
153 
154 #ifndef ITK_MANUAL_INSTANTIATION
155 # include "itkMorphologicalGradientImageFilter.hxx"
156 #endif
157 
158 #endif
itkVanHerkGilWermanDilateImageFilter.h
Algorithm
Algorithm or implementation used in the dilation/erosion operations.
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::MorphologicalGradientImageFilter::PixelType
typename TInputImage::PixelType PixelType
Definition: itkMorphologicalGradientImageFilter.h:77
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::AnchorDilateImageFilter
Definition: itkAnchorDilateImageFilter.h:27
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::AnchorErodeImageFilter
Definition: itkAnchorErodeImageFilter.h:26
itk::MovingHistogramMorphologicalGradientImageFilter
Morphological gradients enhance the variation of pixel intensity in a given neighborhood.
Definition: itkMovingHistogramMorphologicalGradientImageFilter.h:235
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkMathematicalMorphologyEnums.h
itk::MorphologicalGradientImageFilter
Compute the gradient of a grayscale image.
Definition: itkMorphologicalGradientImageFilter.h:50
itkAnchorDilateImageFilter.h
itkSubtractImageFilter.h
itkAnchorErodeImageFilter.h
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::MathematicalMorphologyEnums::Algorithm
Algorithm
Definition: itkMathematicalMorphologyEnums.h:42
itk::SubtractImageFilter
Pixel-wise subtraction of two images.
Definition: itkSubtractImageFilter.h:68
itkMovingHistogramMorphologicalGradientImageFilter.h
itkBasicErodeImageFilter.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
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