OTB  9.0.0
Orfeo Toolbox
otbMassOfBelief.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 otbMassOfBelief_h
22 #define otbMassOfBelief_h
23 
24 #include "itkDataObject.h"
25 #include "itkObjectFactory.h"
26 #include "itkNumericTraits.h"
27 
28 #include <set>
29 #include <map>
30 #include <ostream>
31 
32 
33 namespace otb
34 {
35 
89 template <class TLabel = unsigned short, class TMass = double>
90 class ITK_EXPORT MassOfBelief : public itk::DataObject
91 {
92 public:
94  typedef MassOfBelief Self;
95  typedef itk::DataObject Superclass;
96  typedef itk::SmartPointer<Self> Pointer;
97  typedef itk::SmartPointer<const Self> ConstPointer;
98 
100  itkNewMacro(Self);
101 
103  itkTypeMacro(MassOfBelief, DataObject);
104 
105  typedef TLabel LabelType;
106  typedef TMass MassType;
107  typedef std::set<LabelType> LabelSetType;
108  typedef std::map<LabelSetType, MassType> MassMapType;
109  typedef std::set<LabelSetType> LabelSetOfSetType;
110 
112  void SetMass(const LabelSetType& labelSet, const MassType& mass);
113 
116  MassType GetMass(const LabelSetType& labelSet) const;
117 
119  void RemoveMass(const LabelSetType& labelSet);
120 
124  LabelSetOfSetType GetSupport() const;
125 
127  LabelSetType GetUniverse() const;
128 
130  void Normalize();
131 
134  void EstimateUncertainty();
135 
137  void Clear();
138 
144  void InitializePowerSetMasses(const LabelSetType& universe);
145 
147  MassType GetBelief(const LabelSetType& labelSet) const;
148 
150  MassType GetPlausibility(const LabelSetType& labelSet) const;
151 
154  MassType GetBelief(const LabelSetOfSetType& containedLabelSet) const;
155 
158  MassType GetPlausibility(const LabelSetOfSetType& intersectedLabelSet) const;
159 
161  void Copy(const Self* massOfBelief);
162 
164  bool IsEmpty() const;
165 
169  static std::ostream& PrintLabelSet(std::ostream& out, const LabelSetType& labelSet);
170 
174  static std::ostream& PrintLabelSetOfSet(std::ostream& out, const LabelSetOfSetType& labelSet);
175 
176 protected:
179  {
180  }
181 
183  ~MassOfBelief() override
184  {
185  }
186 
188  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
189 
190 private:
191  MassOfBelief(const Self&) = delete;
192  void operator=(const Self&) = delete;
193 
196 };
197 
198 } // end namespace otb
199 
200 
201 #ifndef OTB_MANUAL_INSTANTIATION
202 #include "otbMassOfBelief.hxx"
203 #endif
204 
205 #endif
otb::MassOfBelief
This class represent a mass of belief function.
Definition: otbMassOfBelief.h:90
otb::MassOfBelief::~MassOfBelief
~MassOfBelief() override
Definition: otbMassOfBelief.h:183
otb::MassOfBelief::MassMapType
std::map< LabelSetType, MassType > MassMapType
Definition: otbMassOfBelief.h:108
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::MassOfBelief::MassType
TMass MassType
Definition: otbMassOfBelief.h:106
otb::MassOfBelief::LabelType
TLabel LabelType
Definition: otbMassOfBelief.h:103
otbMassOfBelief.hxx
otb::MassOfBelief::m_MassesMap
MassMapType m_MassesMap
Definition: otbMassOfBelief.h:195
otb::MassOfBelief::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbMassOfBelief.h:97
otb::MassOfBelief::LabelSetType
std::set< LabelType > LabelSetType
Definition: otbMassOfBelief.h:107
otb::MassOfBelief::LabelSetOfSetType
std::set< LabelSetType > LabelSetOfSetType
Definition: otbMassOfBelief.h:109
otb::MassOfBelief::Self
MassOfBelief Self
Definition: otbMassOfBelief.h:94
otb::MassOfBelief::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMassOfBelief.h:96
otb::MassOfBelief::MassOfBelief
MassOfBelief()
Definition: otbMassOfBelief.h:178
otb::MassOfBelief::Superclass
itk::DataObject Superclass
Definition: otbMassOfBelief.h:95