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
152 lines
3.9 KiB
C++
152 lines
3.9 KiB
C++
#ifndef _OTB_TRISKELE_TREE_TPP
|
|
#define _OTB_TRISKELE_TREE_TPP
|
|
|
|
// ========================================
|
|
inline unsigned int
|
|
Tree::getCoreCount () const {
|
|
return coreCount;
|
|
}
|
|
|
|
inline DimNodeId *
|
|
Tree::getChildSum () {
|
|
return &childrenStart[0];
|
|
}
|
|
|
|
inline void
|
|
Tree::setNodeCount (const DimImg &newNodeCount) {
|
|
nodeCount = newNodeCount;
|
|
}
|
|
inline void
|
|
Tree::setSize (const Size &newSize) {
|
|
size = newSize;
|
|
}
|
|
|
|
inline State
|
|
Tree::getState () const {
|
|
return state;
|
|
}
|
|
|
|
inline Size
|
|
Tree::getSize () const {
|
|
return size;
|
|
}
|
|
|
|
inline const DimSideImg &
|
|
Tree::getLeafCount () const {
|
|
return leafCount;
|
|
}
|
|
inline const DimNodeId &
|
|
Tree::getNodeCount () const {
|
|
return nodeCount;
|
|
}
|
|
inline DimImg
|
|
Tree::getCompCount () const {
|
|
return (DimImg) (nodeCount-leafCount);
|
|
}
|
|
inline DimNodeId
|
|
Tree::getNodeRoot () const {
|
|
return nodeCount-1;
|
|
}
|
|
inline DimImg
|
|
Tree::getCompRoot () const {
|
|
return (DimImg) (nodeCount-1-leafCount);
|
|
}
|
|
inline bool
|
|
Tree::isLeaf (const DimNodeId &nodeId) const {
|
|
return nodeId < leafCount;
|
|
}
|
|
inline DimImg
|
|
Tree::getLeafId (const DimNodeId &nodeId) const {
|
|
return (DimImg) nodeId;
|
|
}
|
|
inline DimImg
|
|
Tree::getCompId (const DimNodeId &nodeId) const {
|
|
return (DimImg) (nodeId-leafCount);
|
|
}
|
|
inline DimNodeId
|
|
Tree::getChild (const DimImg &compId, const DimImg &childId) const {
|
|
return children [childrenStart [compId]+childId];
|
|
}
|
|
|
|
inline const DimImg &
|
|
Tree::getParent (const DimNodeId &nodeId) const {
|
|
return leafParents[nodeId];
|
|
}
|
|
inline const DimImg &
|
|
Tree::getLeafParent (const DimImg &leafId) const {
|
|
return leafParents[leafId];
|
|
}
|
|
inline const DimImg &
|
|
Tree::getCompParent (const DimImg &compId) const {
|
|
return compParents[compId];
|
|
}
|
|
|
|
inline const DimImg &
|
|
Tree::getChildrenCount (const DimImg &compId) const {
|
|
return childrenStart[compId];
|
|
}
|
|
inline const DimNodeId &
|
|
Tree::getChildren (const DimImg &childId) const {
|
|
return children[childId];
|
|
}
|
|
inline const DimNodeId *
|
|
Tree::getChildren () const {
|
|
return &children[0];
|
|
}
|
|
|
|
inline const vector<DimImg> &
|
|
Tree::getWeightBounds () const {
|
|
return weightBounds;
|
|
}
|
|
inline vector<DimImg> &
|
|
Tree::getWeightBounds () {
|
|
return weightBounds;
|
|
}
|
|
|
|
// ========================================
|
|
template<typename FuncToApply>
|
|
inline void
|
|
Tree::forEachLeaf (const FuncToApply &f /* f (DimImg leafId) */) const {
|
|
for (DimImg leafId = 0; leafId < leafCount; ++leafId)
|
|
f (leafId);
|
|
}
|
|
|
|
template<typename FuncToApply>
|
|
inline void
|
|
Tree::forEachComp (const FuncToApply &f /* f (DimImg compId) */) const {
|
|
const DimImg compCount = getCompCount ();
|
|
for (DimImg compId = 0; compId < compCount; ++compId)
|
|
f (compId);
|
|
}
|
|
|
|
template<typename FuncToApply>
|
|
inline void
|
|
Tree::forEachNode (const FuncToApply &f /* f (NodeDimImg nodeId) */) const {
|
|
for (DimNodeId nodeId = 0; nodeId < nodeCount; ++nodeId)
|
|
f (nodeId);
|
|
}
|
|
|
|
template<typename FuncToApply>
|
|
inline void
|
|
Tree::forEachChild (const DimNodeId &parentId, const FuncToApply &f /* f (DimNodeId childId) */) const {
|
|
DimNodeId minChild = childrenStart[parentId], maxChild = childrenStart[parentId+1];
|
|
for (DimNodeId childId = minChild; childId < maxChild; ++childId)
|
|
f (children[childId]);
|
|
}
|
|
template<typename FuncToApply>
|
|
inline void
|
|
Tree::forEachChildTI (const DimNodeId &parentId, const FuncToApply &f /* f (bool isLeaf, DimImg childId) */) const {
|
|
DimNodeId minChild = childrenStart[parentId], maxChild = childrenStart[parentId+1];
|
|
for (DimNodeId childId = minChild; childId < maxChild; ++childId) {
|
|
const DimNodeId &child (getChildren (childId));
|
|
const bool isLeaf = child < leafCount;
|
|
if (child >= getNodeCount ()) {
|
|
cerr << "coucou Tree::forEachChildTI parentId:" << parentId << " compCount:" << getCompCount () << " minChild:" << minChild << " maxChild:" << maxChild << " childId:" << childId << " child:" << child << endl;
|
|
}
|
|
BOOST_ASSERT (child < getNodeCount ());
|
|
f (isLeaf, isLeaf ? (DimImg) child : (DimImg) (child-leafCount));
|
|
}
|
|
}
|
|
|
|
#endif // _OTB_TRISKELE_TREE_TPP
|