
modifié : CMakeListsOTB.txt modifié : LICENSE modifié : MakefileNoOTB modifié : Readme.html modifié : Readme.txt modifié : include/Appli/Option.hpp modifié : include/Appli/Selected.hpp modifié : include/Appli/Selected.tpp modifié : include/ArrayTree/ArrayTreeBuilder.hpp modifié : include/ArrayTree/ArrayTreeBuilder.tpp modifié : include/ArrayTree/Border.hpp modifié : include/ArrayTree/Border.tpp modifié : include/ArrayTree/GraphWalker.hpp modifié : include/ArrayTree/GraphWalker.tpp modifié : include/ArrayTree/Leader.hpp modifié : include/ArrayTree/Leader.tpp modifié : include/ArrayTree/Weight.hpp modifié : include/ArrayTree/Weight.tpp modifié : include/ArrayTree/triskeleArrayTreeBase.hpp modifié : include/ArrayTree/triskeleArrayTreeBase.tpp modifié : include/ArrayTree/triskeleSort.hpp modifié : include/ArrayTree/triskeleSort.tpp modifié : include/AttributeProfiles.hpp modifié : include/AttributeProfiles.tpp modifié : include/Attributes/AreaAttributes.hpp modifié : include/Attributes/AreaAttributes.tpp modifié : include/Attributes/AverageAttributes.hpp modifié : include/Attributes/AverageAttributes.tpp modifié : include/Attributes/MoIAttributes.hpp modifié : include/Attributes/MoIAttributes.tpp modifié : include/Attributes/SDAttributes.hpp modifié : include/Attributes/SDAttributes.tpp modifié : include/Attributes/WeightAttributes.hpp modifié : include/Attributes/WeightAttributes.tpp modifié : include/Attributes/XYAttributes.hpp modifié : include/Attributes/XYAttributes.tpp modifié : include/CompAttribute.hpp modifié : include/CompAttribute.tpp modifié : include/IImage.hpp modifié : include/IImage.tpp modifié : include/QuadTree/QuadTreeBuilder.hpp modifié : include/Tree.hpp modifié : include/Tree.tpp modifié : include/TreeBuilder.hpp modifié : include/TreeBuilder.tpp modifié : include/TreeStats.hpp modifié : include/TreeStats.tpp modifié : include/XMLTree/XMLTreeBuilder.hpp modifié : include/triskeleBase.hpp modifié : include/triskeleBase.tpp modifié : include/triskeleDealThreads.hpp modifié : include/triskeleDealThreads.tpp modifié : include/triskeleDebug.hpp modifié : include/triskeleGdalGetType.hpp modifié : otb-module.cmake modifié : src/Appli/Option.cpp modifié : src/Appli/Selected.cpp modifié : src/ArrayTree/triskeleArrayTreeBase.cpp modifié : src/CMakeLists.txt modifié : src/IImage.cpp modifié : src/PerfArrayTreeBuilder.cpp modifié : src/QuadTree/QuadTreeBuilder.cpp modifié : src/TestArrayTreeBuilder.cpp modifié : src/Tree.cpp modifié : src/TreeStats.cpp modifié : src/XMLTree/XMLTreeBuilder.cpp modifié : src/apGenerator.cpp modifié : src/triskeleBase.cpp modifié : src/triskeleDebug.cpp
136 lines
5.0 KiB
C++
136 lines
5.0 KiB
C++
#ifndef _OTB_TRISKELE_ARRAY_TREE_WEIGHT_HPP
|
|
#define _OTB_TRISKELE_ARRAY_TREE_WEIGHT_HPP
|
|
|
|
#include <iostream>
|
|
#include <typeinfo>
|
|
|
|
#include "triskeleBase.hpp"
|
|
#include "IImage.hpp"
|
|
#include "triskeleArrayTreeBase.hpp"
|
|
|
|
namespace otb {
|
|
namespace triskele {
|
|
namespace arrayTree {
|
|
|
|
class GraphWalker;
|
|
|
|
/*! Structure définissant la base d'un poids entre les pixels */
|
|
template <typename PixelT, typename WeightT> struct WeightBase {
|
|
protected:
|
|
const PixelT *pixels;
|
|
Size size;
|
|
inline DimNodeId pointIdx (const Point &p) const;
|
|
PixelT halfPixel, maxPixel;
|
|
inline void reset (const PixelT *pixels, const Size &size);
|
|
public:
|
|
const PixelT *getPixels () const { return pixels; }
|
|
|
|
inline const Size &getSize () const;
|
|
inline const PixelT &getValue (const DimImg &idx) const;
|
|
inline const PixelT &getValue (const Point &p) const;
|
|
inline bool getDecr () const;
|
|
inline const PixelT &getMaxPixel () const;
|
|
inline const PixelT &getHalfPixel () const;
|
|
|
|
inline WeightBase (const PixelT *pixels, const Size &size);
|
|
|
|
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
|
|
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
|
|
static inline void sort (Edge<WeightT> *edges, DimEdge count);
|
|
|
|
inline void copyPixelsBound (PixelT *leafAPTree,
|
|
const DimImg &minVal, const DimImg &maxVal) const;
|
|
inline void weight2valueBound (PixelT *compAPTree, const WeightT *compWeights,
|
|
const DimImg &minVal, const DimImg &maxVal) const;
|
|
};
|
|
|
|
/*! Structure intégrant la façon dont est géré un poids pour un MinTree */
|
|
template <typename PixelT, typename WeightT> struct MinWeight : public WeightBase<PixelT, WeightT> {
|
|
typedef WeightBase<PixelT, WeightT> WB;
|
|
|
|
inline bool getDecr () const;
|
|
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
|
|
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
|
|
static inline void sort (Edge<WeightT> *edges, DimEdge count);
|
|
|
|
inline MinWeight ();
|
|
inline MinWeight (const PixelT *pixels, const Size &size);
|
|
inline MinWeight (const MinWeight &model, const PixelT *pixels, const Size &size);
|
|
|
|
inline WeightT getWeight (const DimImg &idx) const;
|
|
inline WeightT getWeight (const Point &a, const Point &b) const;
|
|
};
|
|
|
|
// ========================================
|
|
/*! Structure intégrant la façon dont est géré un poids pour un MaxTree */
|
|
template <typename PixelT, typename WeightT> struct MaxWeight : public WeightBase<PixelT, WeightT> {
|
|
typedef WeightBase<PixelT, WeightT> WB;
|
|
|
|
inline MaxWeight ();
|
|
inline MaxWeight (const PixelT *pixels, const Size &size);
|
|
inline MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size);
|
|
|
|
inline WeightT getWeight (const DimImg &idx) const;
|
|
inline WeightT getWeight (const Point &a, const Point &b) const;
|
|
};
|
|
|
|
// ========================================
|
|
/*! Structure intégrant la façon dont est géré un poids pour un AlphaTree */
|
|
template <typename PixelT, typename WeightT> struct DiffWeight : public WeightBase<PixelT, WeightT> {
|
|
typedef WeightBase<PixelT, WeightT> WB;
|
|
|
|
inline DiffWeight ();
|
|
inline DiffWeight (const PixelT *pixels, const Size &size);
|
|
inline DiffWeight (const DiffWeight &model, const PixelT *pixels, const Size &size);
|
|
|
|
inline WeightT getWeight (const DimImg &idx) const;
|
|
inline WeightT getWeight (const Point &a, const Point &b) const;
|
|
};
|
|
|
|
// ========================================
|
|
/*! Structure intégrant la façon dont est géré un poids pour un TreeOfShape */
|
|
template <typename PixelT, typename WeightT> struct MedianWeight : public WeightBase<PixelT, WeightT> {
|
|
typedef WeightBase<PixelT, WeightT> WB;
|
|
protected:
|
|
PixelT median, thresholdPixel;
|
|
WeightT thresholdWeight;
|
|
|
|
public:
|
|
inline bool getDecr () const;
|
|
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
|
|
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
|
|
static inline void sort (Edge<WeightT> *edges, DimEdge count);
|
|
|
|
inline const PixelT &getMedian () const;
|
|
inline const PixelT &getThresholdPixel () const;
|
|
inline const WeightT &getThresholdWeight () const;
|
|
|
|
inline WeightT value2weight (const PixelT &val) const;
|
|
inline PixelT weight2value (const WeightT &weight) const;
|
|
|
|
inline MedianWeight ();
|
|
inline MedianWeight (const PixelT *pixels, const GraphWalker &graphWalker);
|
|
inline MedianWeight (const MedianWeight &model, const PixelT *pixels, const Size &size);
|
|
|
|
inline WeightT getWeight (const DimImg &idx) const;
|
|
inline WeightT getWeight (const Point &a, const Point &b) const;
|
|
inline void weight2valueBound (PixelT *compAPTree, const WeightT *compWeights,
|
|
const DimImg &minVal, const DimImg &maxVal) const;
|
|
};
|
|
|
|
} // arrayTree
|
|
} // triskele
|
|
} // otb
|
|
|
|
#include "GraphWalker.hpp"
|
|
|
|
namespace otb {
|
|
namespace triskele {
|
|
namespace arrayTree {
|
|
#include "Weight.tpp"
|
|
} // arrayTree
|
|
} // triskele
|
|
} // otb
|
|
|
|
#endif // _OTB_TRISKELE_ARRAY_TREE_WEIGHT_HPP
|