OTB  10.0.0
Orfeo Toolbox
otbGeodesicMorphologyLevelingFilter.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 otbGeodesicMorphologyLevelingFilter_h
22 #define otbGeodesicMorphologyLevelingFilter_h
23 
24 #include "otbFunctorImageFilter.h"
25 
26 namespace otb
27 {
28 namespace Functor
29 {
30 namespace LevelingFunctor_tags
31 {
32 struct pixel
33 {
34 };
36 {
37 };
39 {
40 };
41 }
53 template <class TInput, class TInputMap, class TOutput>
55 {
56 public:
59  {
60  }
62  virtual ~LevelingFunctor()
63  {
64  }
65 
66  inline TOutput operator()(const TInput& pixel, const TInputMap& convexPixel, const TInputMap& concavePixel) const
67  {
68  TOutput result;
69 
70  if (convexPixel > concavePixel)
71  {
72  result = static_cast<TOutput>(pixel - convexPixel);
73  }
74  else if (convexPixel < concavePixel)
75  {
76  result = static_cast<TOutput>(concavePixel + pixel);
77  }
78  else
79  {
80  result = static_cast<TOutput>(pixel);
81  }
82  return result;
83  }
84 };
85 } // end namespace Functor
86 
99 template <class TInputImage, class TInputMaps, class TOutputImage>
104 } // End namespace otb
105 #endif
A generic functor filter templated by its functor.
This functor performs the pixel-wise leveling operation needed in the geodesic morphology decompositi...
TOutput operator()(const TInput &pixel, const TInputMap &convexPixel, const TInputMap &concavePixel) const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.