triskele/include/ArrayTree/ArrayTreeBuilder.hpp
Git Merciol caa6e85da2 modifié : MakefileNoOTB
modifié :         include/ArrayTree/ArrayTreeBuilder.hpp
	modifié :         include/ArrayTree/ArrayTreeBuilder.tpp
	modifié :         include/TreeStats.hpp
	modifié :         include/TreeStats.tpp
	modifié :         src/TreeStats.cpp
2018-03-14 14:27:59 +01:00

131 lines
3.6 KiB
C++

#ifndef _OTB_TRISKELE_ARRAY_TREE_BUILDER_HPP
#define _OTB_TRISKELE_ARRAY_TREE_BUILDER_HPP
#ifdef ENABLE_LOG
#include <iostream>
#endif // ENABLE_LOG
#include <boost/chrono.hpp>
#include "triskeleBase.hpp"
#include "triskeleDebug.hpp"
#include "triskeleSort.hpp"
#include "triskeleDealThreads.hpp"
#include "TreeBuilder.hpp"
#include "Attributes/WeightAttributes.hpp"
#include "AttributeProfiles.hpp"
#include "IImage.hpp"
#include "GraphWalker.hpp"
#include "Weight.hpp"
#include "Leader.hpp"
namespace otb {
namespace triskele {
namespace arrayTree {
template <typename WeightT, typename PixelT>
class ArrayTreeBuilder : public TreeBuilder {
protected:
unsigned int coreCount;
const Raster<PixelT> &raster;
const GraphWalker &graphWalker;
TreeType treeType;
bool countingFlag;
Leader leaders;
// transcient
DimNodeId *childCount;
DimImg *newCompId;
WeightT *compWeights;
public:
inline ArrayTreeBuilder (const Raster<PixelT> &raster, const GraphWalker &graphWalker,
const TreeType &treeType, const bool &countingSort = true);
inline ~ArrayTreeBuilder ();
inline void buildTree (Tree &tree, WeightAttributes<WeightT> &weightAttributes);
inline void setAttributProfiles (AttributeProfiles<PixelT> &attributeProfiles);
protected:
template<typename WeightFunct>
inline void
buildTree (Tree &tree, const WeightFunct &weightFunct);
template<typename WeightFunct>
inline void
setAttributProfiles (AttributeProfiles<PixelT> &attributeProfiles, const WeightFunct &weightFunct);
template<typename WeightFunct>
inline void
buildParents (Edge<WeightT> *edges, const WeightFunct &weightFunct, const Rect &tile, DimImg &topParent);
template<typename WeightFunct>
inline void
connectLeaf (DimImg a, DimImg b, const WeightT &weight, DimImg &parCount, const WeightFunct &weightFunct);
inline void
unlinkParent (const DimImg &par);
template<typename WeightFunct>
inline void
connect3Comp (DimImg newComp, DimImg topA, DimImg topB, const WeightFunct &weightFunct);
template<typename WeightFunct>
inline void
connectComp (DimImg topA, DimImg topB, const WeightFunct &weightFunct);
template<typename WeightFunct>
inline DimImg
updateNewId (const vector<DimImg> &compBases, const vector<DimImg> &compTops, const WeightFunct &weightFunct);
inline void
updateNewId (const DimImg curComp, DimImg &compCount);
inline void
compress (const DimImg &compTop);
inline DimImg
createParent (DimImg &topParent, const WeightT &weight, DimImg &childA, DimImg &childB);
inline void
addChild (const DimImg &parent, DimImg &child);
inline void
addChildren (const DimImg &parent, const DimImg &sibling);
inline DimImg
findRoot (DimImg comp);
template<typename WeightFunct>
inline DimImg
findTopComp (const DimImg &comp, const WeightFunct &weightFunct);
template<typename WeightFunct>
inline DimImg
findTopComp (DimImg comp, const WeightT &weight, const WeightFunct &weightFunct);
inline DimImg
findNotLonelyTop (DimImg comp);
inline DimImg
findMultiChildrenTop (DimImg comp);
inline void
buildChildren ();
// nice ostream
struct CPrintComp {
const ArrayTreeBuilder &atb;
const DimImg &compId;
inline CPrintComp (const ArrayTreeBuilder &atb, const DimImg &compId);
inline ostream &print (ostream &out) const;
};
inline CPrintComp printComp (const DimImg &compId) const { return CPrintComp (*this, compId); }
friend inline ostream &operator << (ostream& out, const CPrintComp &lc) { return lc.print (out); }
};
#include "ArrayTreeBuilder.tpp"
} // arrayTree
} // triskele
} // otb
#endif // _OTB_TRISKELE_ARRAY_TREE_BUILDER_HPP