OTB  9.0.0
Orfeo Toolbox
otbLocalGradientVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 otbLocalGradientVectorImageFilter_h
22 #define otbLocalGradientVectorImageFilter_h
23 
25 
26 #include <itkNumericTraits.h>
27 
28 namespace otb
29 {
30 
31 namespace Functor
32 {
38 template <class TInput, class TOutput>
40 {
41 public:
43  {
44  }
46  {
47  }
48 
49  TOutput operator()(const TInput& input)
50  {
51  /*
52  * it is assumed that input and output have the same size
53  */
54  unsigned int length = input.GetPixel(0).Size();
55  TOutput output(length);
56  for (unsigned int i = 0; i < length; ++i)
57  {
58  output[i] = static_cast<typename TOutput::ValueType>(input.GetCenterPixel()[i] - input.GetPixel(5)[i] / 2. - input.GetPixel(7)[i] / 2.);
59  }
60  return output;
61  }
62 }; // end of functor class
63 
64 } // end of namespace Functor
65 
71 template <class TInputImage, class TOutputImage>
74  TInputImage, TOutputImage, Functor::LocalGradientOperator<typename itk::ConstNeighborhoodIterator<TInputImage>, typename TOutputImage::PixelType>>
75 {
76 public:
80  TInputImage, TOutputImage, Functor::LocalGradientOperator<typename itk::ConstNeighborhoodIterator<TInputImage>, typename TOutputImage::PixelType>>
82  typedef itk::SmartPointer<Self> Pointer;
83  typedef itk::SmartPointer<const Self> ConstPointer;
84 
86  itkNewMacro(Self);
87 
89  itkTypeMacro(LocalGradientVectorImageFilter, ImageToImageFilter);
90 
91 protected:
93  {
94  typename Superclass::RadiusType radius = {{1, 1}};
95  this->SetRadius(radius);
96  }
98  {
99  }
100 
101 private:
102  LocalGradientVectorImageFilter(const Self&); // Not implemented
103  void operator=(const Self&); // Not implemented
104 }; // end of class
105 
106 } // end of namespace otb
107 
108 
109 #endif // otbLocalGradientVectorImageFilter_h
otb::LocalGradientVectorImageFilter::LocalGradientVectorImageFilter
LocalGradientVectorImageFilter()
Definition: otbLocalGradientVectorImageFilter.h:92
otb::Functor::LocalGradientOperator::operator()
TOutput operator()(const TInput &input)
Definition: otbLocalGradientVectorImageFilter.h:49
otb::UnaryFunctorNeighborhoodVectorImageFilter::RadiusType
NeighborhoodIteratorType::RadiusType RadiusType
Definition: otbUnaryFunctorNeighborhoodVectorImageFilter.h:98
otb::Functor::LocalGradientOperator::~LocalGradientOperator
virtual ~LocalGradientOperator()
Definition: otbLocalGradientVectorImageFilter.h:45
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LocalGradientVectorImageFilter::~LocalGradientVectorImageFilter
~LocalGradientVectorImageFilter() override
Definition: otbLocalGradientVectorImageFilter.h:97
otb::LocalGradientVectorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLocalGradientVectorImageFilter.h:82
otb::LocalGradientVectorImageFilter::Superclass
UnaryFunctorNeighborhoodVectorImageFilter< TInputImage, TOutputImage, Functor::LocalGradientOperator< typename itk::ConstNeighborhoodIterator< TInputImage >, typename TOutputImage::PixelType > > Superclass
Definition: otbLocalGradientVectorImageFilter.h:81
otb::Functor::LocalGradientOperator
Performs the calculation of LocalGradient derivation.
Definition: otbLocalGradientVectorImageFilter.h:39
otb::LocalGradientVectorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLocalGradientVectorImageFilter.h:83
otb::Functor::LocalGradientOperator::LocalGradientOperator
LocalGradientOperator()
Definition: otbLocalGradientVectorImageFilter.h:42
otb::UnaryFunctorNeighborhoodVectorImageFilter
Implements neighborhood-wise generic operation of one vector image.
Definition: otbUnaryFunctorNeighborhoodVectorImageFilter.h:42
otb::LocalGradientVectorImageFilter::Self
LocalGradientVectorImageFilter Self
Definition: otbLocalGradientVectorImageFilter.h:78
otb::LocalGradientVectorImageFilter
Implements the 3x3 Local Gradient to be processed on a vector image.
Definition: otbLocalGradientVectorImageFilter.h:72
otbUnaryFunctorNeighborhoodVectorImageFilter.h