OTB  9.0.0
Orfeo Toolbox
otbFuzzyVariable.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 otbFuzzyVariable_h
22 #define otbFuzzyVariable_h
23 
24 #include "itkDataObject.h"
25 #include "itkFixedArray.h"
26 #include "itkObjectFactory.h"
27 
28 namespace otb
29 {
46 template <class TLabel = unsigned short, class TPrecision = double>
47 class ITK_EXPORT FuzzyVariable : public itk::DataObject
48 {
49 public:
52  typedef itk::DataObject Superclass;
53  typedef itk::SmartPointer<Self> Pointer;
54  typedef itk::SmartPointer<const Self> ConstPointer;
55 
57  itkNewMacro(Self);
58 
60  itkTypeMacro(FuzzyVariable, DataObject);
61 
63  typedef TLabel LabelType;
64 
66  typedef TPrecision PrecisionType;
67 
69  typedef std::map<LabelType, PrecisionType> MembershipValueType;
70  typedef itk::FixedArray<PrecisionType, 6> ParametersType;
71  typedef std::map<LabelType, ParametersType> ParametersMapType;
72 
74  PrecisionType GetMembership(const LabelType& var, const PrecisionType& value) const;
75 
77  MembershipValueType GetMembership(const PrecisionType& value) const;
78 
80  LabelType GetMaxVar(const PrecisionType& value) const;
81 
83  void SetMembership(const LabelType& var, const PrecisionType& v1, const PrecisionType& v2, const PrecisionType& v3, const PrecisionType& v4);
84 
85  void SetMembership(const LabelType& var, const PrecisionType& v1, const PrecisionType& v2, const PrecisionType& v3, const PrecisionType& v4,
86  const PrecisionType& min, const PrecisionType& max);
87 
89  void RemoveMembership(const LabelType& var);
90 
92  void Clear();
93 
95  static std::ostream& PrintMembershipValueType(std::ostream& out, const MembershipValueType& membership);
96 
97 
98 protected:
100  FuzzyVariable();
101 
103  ~FuzzyVariable() override
104  {
105  }
106 
108  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
109 
110 private:
113 };
114 } // end namespace otb
115 
116 #ifndef OTB_MANUAL_INSTANTIATION
117 #include "otbFuzzyVariable.hxx"
118 #endif
119 
120 #endif
otb::FuzzyVariable::LabelType
TLabel LabelType
Definition: otbFuzzyVariable.h:60
otb::FuzzyVariable::Superclass
itk::DataObject Superclass
Definition: otbFuzzyVariable.h:52
otb::FuzzyVariable::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbFuzzyVariable.h:54
otb::FuzzyVariable::~FuzzyVariable
~FuzzyVariable() override
Definition: otbFuzzyVariable.h:103
otb::FuzzyVariable::m_MembershipFunctions
ParametersMapType m_MembershipFunctions
Definition: otbFuzzyVariable.h:112
otb::var
Definition: otbParserXPlugins.h:282
otb::FuzzyVariable::PrecisionType
TPrecision PrecisionType
Definition: otbFuzzyVariable.h:66
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::FuzzyVariable
Class to represent a fuzzy N-valued variable.
Definition: otbFuzzyVariable.h:47
otb::FuzzyVariable::Self
FuzzyVariable Self
Definition: otbFuzzyVariable.h:51
otbFuzzyVariable.hxx
otb::FuzzyVariable::MembershipValueType
std::map< LabelType, PrecisionType > MembershipValueType
Definition: otbFuzzyVariable.h:69
otb::FuzzyVariable::ParametersType
itk::FixedArray< PrecisionType, 6 > ParametersType
Definition: otbFuzzyVariable.h:70
otb::FuzzyVariable::ParametersMapType
std::map< LabelType, ParametersType > ParametersMapType
Definition: otbFuzzyVariable.h:71
otb::FuzzyVariable::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbFuzzyVariable.h:53