OTB  6.1.0
Orfeo Toolbox
otbMassOfBelief.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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;
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,
170  const LabelSetType & labelSet);
171 
175  static std::ostream & PrintLabelSetOfSet(std::ostream & out,
176  const LabelSetOfSetType & labelSet);
177 
178 protected:
181 
183  ~MassOfBelief() ITK_OVERRIDE {}
184 
186  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
187 
188 private:
189  MassOfBelief(const Self&); //purposely not implemented
190  void operator=(const Self&); //purposely not implemented
191 
194 };
195 
196 } // end namespace otb
197 
198 
199 #ifndef OTB_MANUAL_INSTANTIATION
200 #include "otbMassOfBelief.txx"
201 #endif
202 
203 #endif
~MassOfBelief() ITK_OVERRIDE
itk::SmartPointer< Self > Pointer
This class represent a mass of belief function.
std::set< LabelSetType > LabelSetOfSetType
MassMapType m_MassesMap
std::map< LabelSetType, MassType > MassMapType
MassOfBelief Self
itk::SmartPointer< const Self > ConstPointer
std::set< LabelType > LabelSetType
itk::DataObject Superclass