OTB  9.0.0
Orfeo Toolbox
otbMultiScaleConvexOrConcaveClassificationFilter.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 otbMultiScaleConvexOrConcaveClassificationFilter_h
22 #define otbMultiScaleConvexOrConcaveClassificationFilter_h
23 
24 #include "otbFunctorImageFilter.h"
25 
26 namespace otb
27 {
28 namespace Functor
29 {
30 namespace MultiScaleConvexOrConcaveDecisionRule_tags
31 {
32 struct max_opening_profile_derivative
33 {
34 };
35 struct max_closing_profile_derivative
36 {
37 };
38 struct opening_profile_characteristics
39 {
40 };
41 struct closing_profile_characteristics
42 {
43 };
44 
45 } // End namespace MultiScaleConvexOrConcaveDecisionRule_tags
46 
80 template <class TInput, class TLabeled>
81 class MultiScaleConvexOrConcaveDecisionRule
82 {
83 
84 public:
88  MultiScaleConvexOrConcaveDecisionRule()
89  {
90  m_Sigma = 0.0;
91  m_LabelSeparator = 10;
92  }
93 
97  virtual ~MultiScaleConvexOrConcaveDecisionRule()
98  {
99  }
100 
109  TLabeled operator()(const TInput& opDeMax, const TInput& cloDeMax, const TLabeled& opDeChar, const TLabeled& cloDeChar) const
110  {
111  TLabeled resp = 0;
112 
113  if (opDeMax > cloDeMax && static_cast<double>(opDeMax) > m_Sigma)
114  {
115  resp = m_LabelSeparator + opDeChar;
116  }
117  else if (cloDeMax > opDeMax && static_cast<double>(cloDeMax) > m_Sigma)
118  {
119  resp = cloDeChar;
120  }
121  return resp;
122  }
127  void SetSigma(const double& sigma)
128  {
129  m_Sigma = sigma;
130  }
131 
136  double GetSigma(void)
137  {
138  return m_Sigma;
139  }
140 
145  void SetLabelSeparator(const TLabeled& labelSeparator)
146  {
147  m_LabelSeparator = labelSeparator;
148  }
149 
154  TLabeled GetLabelSeparator(void)
155  {
156  return m_LabelSeparator;
157  }
158 
159 private:
161  double m_Sigma;
162 
164  TLabeled m_LabelSeparator;
165 };
166 } // end namespace Functor
167 
otbFunctorImageFilter.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32