OTB  9.0.0
Orfeo Toolbox
otbGeodesicMorphologyLevelingFilter.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 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>
101  FunctorImageFilter<Functor::LevelingFunctor<typename TInputImage::PixelType, typename TInputMaps::PixelType, typename TOutputImage::PixelType>,
102  std::tuple<typename Functor::LevelingFunctor_tags::pixel, typename Functor::LevelingFunctor_tags::convex_pixel,
104 } // End namespace otb
105 #endif
otb::Functor::LevelingFunctor::operator()
TOutput operator()(const TInput &pixel, const TInputMap &convexPixel, const TInputMap &concavePixel) const
Definition: otbGeodesicMorphologyLevelingFilter.h:66
otb::GeodesicMorphologyLevelingFilter
FunctorImageFilter< Functor::LevelingFunctor< typename TInputImage::PixelType, typename TInputMaps::PixelType, typename TOutputImage::PixelType >, std::tuple< typename Functor::LevelingFunctor_tags::pixel, typename Functor::LevelingFunctor_tags::convex_pixel, typename Functor::LevelingFunctor_tags::concave_pixel > > GeodesicMorphologyLevelingFilter
This filter performs the leveling operation defined in the documentation of the geodesic decompositio...
Definition: otbGeodesicMorphologyLevelingFilter.h:103
otbFunctorImageFilter.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::LevelingFunctor::LevelingFunctor
LevelingFunctor()
Constructor.
Definition: otbGeodesicMorphologyLevelingFilter.h:58
otb::Functor::LevelingFunctor_tags::convex_pixel
Definition: otbGeodesicMorphologyLevelingFilter.h:35
otb::Functor::LevelingFunctor::~LevelingFunctor
virtual ~LevelingFunctor()
Destructor.
Definition: otbGeodesicMorphologyLevelingFilter.h:62
otb::Functor::LevelingFunctor_tags::pixel
Definition: otbGeodesicMorphologyLevelingFilter.h:32
otb::Functor::LevelingFunctor_tags::concave_pixel
Definition: otbGeodesicMorphologyLevelingFilter.h:38
otb::Functor::LevelingFunctor
This functor performs the pixel-wise leveling operation needed in the geodesic morphology decompositi...
Definition: otbGeodesicMorphologyLevelingFilter.h:54