OTB  10.0.0
Orfeo Toolbox
otbHorizontalSobelVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbHorizontalSobelVectorImageFilter_h
22 #define otbHorizontalSobelVectorImageFilter_h
23 
25 
26 namespace otb
27 {
28 
29 namespace Functor
30 {
36 template <class TInput, class TOutput>
38 {
39 public:
41  {
42  }
44  {
45  }
46 
47  TOutput operator()(const TInput& input)
48  {
49  unsigned int length = input.GetPixel(0).Size();
50  TOutput output(length);
51  for (unsigned int i = 0; i < length; ++i)
52  {
53  output[i] = static_cast<typename TOutput::ValueType>((input.GetPixel(0)[i] - input.GetPixel(2)[i]) + 2 * (input.GetPixel(3)[i] - input.GetPixel(5)[i]) +
54  (input.GetPixel(6)[i] - input.GetPixel(8)[i]));
55  }
56  return output;
57  }
58 }; // end of functor class
59 
60 } // end of namespace Functor
61 
67 template <class TInputImage, class TOutputImage>
70  TInputImage, TOutputImage, Functor::HorizontalSobelOperator<typename itk::ConstNeighborhoodIterator<TInputImage>, typename TOutputImage::PixelType>>
71 {
72 public:
76  TInputImage, TOutputImage, Functor::HorizontalSobelOperator<typename itk::ConstNeighborhoodIterator<TInputImage>, typename TOutputImage::PixelType>>
78  typedef itk::SmartPointer<Self> Pointer;
79  typedef itk::SmartPointer<const Self> ConstPointer;
80 
82  itkNewMacro(Self);
83 
85  itkTypeMacro(HorizontalSobelVectorImageFilter, ImageToImageFilter);
86 
87 protected:
89  {
90 
91  typename Superclass::RadiusType radius = {{1, 1}};
92  this->SetRadius(radius);
93  }
95  {
96  }
97 
98 private:
99  HorizontalSobelVectorImageFilter(const Self&); // Not implemented
100  void operator=(const Self&); // Not implemented
101 }; // end of class
102 
103 } // end of namespace otb
104 
105 
106 #endif // otbHorizontalSobelVectorImageFilter_h
Performs the calculation of horizontal Sobel derivation.
Implements the Horizontal Sobel Gradient to be processed on a vector image.
UnaryFunctorNeighborhoodVectorImageFilter< TInputImage, TOutputImage, Functor::HorizontalSobelOperator< typename itk::ConstNeighborhoodIterator< TInputImage >, typename TOutputImage::PixelType > > Superclass
Implements neighborhood-wise generic operation of one vector image.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.