#ifndef _OTB_TRISKELE_ARRAY_TREE_BUILDER_HPP #define _OTB_TRISKELE_ARRAY_TREE_BUILDER_HPP //XXX #include "triskeleDebug.hpp" #ifdef SMART_LOG #include #endif // SMART_LOG #include "triskeleSort.hpp" #include "triskeleDealThreads.hpp" #include "TreeBuilder.hpp" #include "IImage.hpp" #include "GraphWalker.hpp" #include "Weight.hpp" #include "Leader.hpp" namespace otb { namespace triskele { namespace arrayTree { template class ArrayTreeBuilder : public TreeBuilder { const unsigned int coreCount; const IImage ℑ const GraphWalker &graphWalker; TreeType type; bool countingFlag; Leader leaders; DimNodeId *childCountRec; DimImg *newCompIdx; WeightT *compWeights; // [leafCount] public: ArrayTreeBuilder (const unsigned int &coreCount, IImage &image, const GraphWalker &graphWalker, const TreeType &treeType, const bool &countingSort = true); ~ArrayTreeBuilder () {} inline void buildTree (Tree &tree); private: template inline void buildTree (Tree &tree, const WeightFunct &weightFunct); template inline void fillAPTree (PixelT *leafAPTree, const WeightFunct &weightFunct); template inline void buildTree (Edge *edges, const WeightFunct &weightFunct, const Rect &tile, DimImg &topParent); template inline void connectLeaf (DimImg a, DimImg b, const WeightT &weight, DimImg &parCount, const WeightFunct &weightFunct); template inline void connectComp (DimImg newComp, DimImg topA, DimImg topB, const WeightFunct &weightFunct); template inline void connectComp (DimImg topA, DimImg topB, const WeightFunct &weightFunct); template inline DimImg updateNewIdx (const vector &compBases, const vector &compTops, const WeightFunct &weightFunct); inline void updateNewIdx (const DimImg curComp, DimImg &compCount); inline void compress (const DimImg &compTop); inline void 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 inline DimImg findTopComp (const DimImg &comp, const WeightFunct &weightFunct); template inline DimImg findTopComp (DimImg comp, const WeightT &weight, const WeightFunct &weightFunct); inline DimImg findCompMultiChild (DimImg comp); inline void buildChildren (); template inline void initWeights (const GraphWalker &graphWalker, const WeightFunct &weightFunct); #ifdef SMART_LOG inline void printTree (const Size &size, const bool &rec); inline void printLeaders (const Size &size); inline void printNewCompIdx (const Size &size); #endif }; #include "ArrayTreeBuilder.tpp" } // arrayTree } // triskele } // otb #endif // _OTB_TRISKELE_ARRAY_TREE_BUILDER_HPP