/usr/include/OTB-5.8/otbMassOfBelief.h is in libotb-dev 5.8.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | /*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef otbMassOfBelief_h
#define otbMassOfBelief_h
#include "itkDataObject.h"
#include "itkObjectFactory.h"
#include "itkNumericTraits.h"
#include <set>
#include <map>
#include <ostream>
namespace otb
{
/** \class MassOfBelief
* \brief This class represent a mass of belief function
*
* This class represent a Mass of Belief function to be used in
* Dempster-Shafer theory.
*
* Template parameter TLabel is the type of the elements in the
* universe set, while TMass is the type of the mass. TLabel can be
* any type implementing ordering operator, while TMass should be a
* floating point type.
*
* An element of the power-set is represented by the sub-type
* LabelSetType, which is a std::set<TLabel>.
*
* A mass can be associated with a given element from the power set
* by calling the SetMass method. It is not necessary to associate
* masses with each element of the power set: mass is supposed to be
* null otherwise declared.
*
* A mass associated with an element from the power-set can be
* removed using the RemoveMass method, and all masses can be cleared
* using the Clear() function.
*
* The mass associated with a given element from the power-set can be
* retrieved using the GetMass method. If no mass has been associated
* with this element, null is returned.
*
* The Normalize() method allows normalizing all masses so that they
* sum to 1. The EstimateUncertainty() method allows associating to
* the uncertain set (i.e. the universe set) a mass so that all
* masses sum to 1.
*
* The GetUniverse() method allows retrieving the set of all symbols
* (i.e. the universal set), while the GetSupport() method allows
* retrieving the set of all elements of the power-set for which a mass
* has been associated. This method returns a LabelSetOfSetType,
* which is a std::set<std::set<TLabel> >.
*
* The mass function can be optionnaly initialized from a given
* universe set by building the power-set and associating a null mass
* with every elements of this power-set. This allows ensuring that
* two mass functions will share the exact same universe and
* power-set, but is not mandatory, since mass is supposed to be null
* for any set if not stated otherwise.
*
* Once masses are set, the GetPlausibility() and GetBelief()
* function allow computing the belief and plausibility for an
* element of the power-set, or directly for a set of elements of the
* power-set intersecting (resp. contained in) a given hypothesis.
*
*
* \ingroup OTBDempsterShafer
*/
template <class TLabel = unsigned short, class TMass = double>
class ITK_EXPORT MassOfBelief : public itk::DataObject
{
public:
/** Standard class typedefs */
typedef MassOfBelief Self;
typedef itk::DataObject Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(MassOfBelief, DataObject);
typedef TLabel LabelType;
typedef TMass MassType;
typedef std::set<LabelType> LabelSetType;
typedef std::map<LabelSetType, MassType> MassMapType;
typedef std::set<LabelSetType> LabelSetOfSetType;
/** Register a mass associated with an element of the power-set */
void SetMass(const LabelSetType & labelSet, const MassType & mass);
/** Retrieve the mass associated with the given element of the power
* set */
MassType GetMass(const LabelSetType & labelSet) const;
/** Remove mass from the support */
void RemoveMass(const LabelSetType & labelSet);
/** Retrieve the support of the mass of belief (i.e. a vector of
* element of the power set for which the mass of belief is not
* null) */
LabelSetOfSetType GetSupport() const;
/** Get the set of universe symbols for this mass function */
LabelSetType GetUniverse() const;
/** Normalize mass set sot that the sum of masses equals 1 */
void Normalize();
/** Associate to uncertainty a mass such that the sum of masses
* equals 1 */
void EstimateUncertainty();
/** Clear all masses */
void Clear();
/** Initialize with all elements from the power set with null
* masses. Please note that this is not mandatory and only allows
* to ensure that two mass functions share the same universe, even
* if most of masses are null.
*/
void InitializePowerSetMasses(const LabelSetType & universe);
/** Get the belief of a given element of the power-set */
MassType GetBelief(const LabelSetType & labelSet) const;
/** Get the plausibility of a given element of the power-set */
MassType GetPlausibility(const LabelSetType & labelSet) const;
/** Get the belief for an hypothesis containing a given set of
* elements from the power-set */
MassType GetBelief(const LabelSetOfSetType & containedLabelSet) const;
/** Get the belief for an hypothesis intersecting a given set of
* elements from the power set.*/
MassType GetPlausibility(const LabelSetOfSetType & intersectedLabelSet) const;
/** Copy masses of two mass functions */
void Copy(const Self * massOfBelief);
/** Return true if the support set is null */
bool IsEmpty() const;
/** Define a Print static method for label sets
* Do not overload << for std::set since it causes
* namespace issues. */
static std::ostream & PrintLabelSet(std::ostream & out,
const LabelSetType & labelSet);
/** Define a Print static method for label sets
* Do not overload << for std::set since it causes
* namespace issues. */
static std::ostream & PrintLabelSetOfSet(std::ostream & out,
const LabelSetOfSetType & labelSet);
protected:
/** Constructor */
MassOfBelief() {}
/** Desctructor */
~MassOfBelief() ITK_OVERRIDE {}
/** PrintSelf method */
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
private:
MassOfBelief(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
/** The masses map */
MassMapType m_MassesMap;
};
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbMassOfBelief.txx"
#endif
#endif
|