modifié : ../include/ArrayTree/ArrayTreeBuilder.tpp modifié : ../include/ArrayTree/GraphWalker.hpp modifié : ../include/ArrayTree/GraphWalker.tpp modifié : ../include/ArrayTree/Leader.tpp modifié : ../include/IImage.tpp modifié : ../include/Tree.hpp modifié : ../include/Tree.tpp modifié : ../include/TreeBuilder.hpp modifié : ../include/TreeBuilder.tpp modifié : ../src/QuadTree/QuadTreeBuilder.cpp modifié : ../src/Tree.cpp modifié : ../src/XMLTree/XMLTreeBuilder.cpp modifié : ../src/testMain.cpp
79 lines
3.1 KiB
C++
79 lines
3.1 KiB
C++
#ifndef _OTB_TRISKELE_ARRAY_TREE_GRAPHWALKER_HPP
|
|
#define _OTB_TRISKELE_ARRAY_TREE_GRAPHWALKER_HPP
|
|
|
|
#include <boost/assert.hpp>
|
|
#include <algorithm>
|
|
#include <numeric>
|
|
#include <vector>
|
|
|
|
#include "triskeleDebug.hpp"
|
|
#include "triskeleBase.hpp"
|
|
#include "triskeleArrayTreeBase.hpp"
|
|
#include "Border.hpp"
|
|
|
|
#ifdef GRAPHWALKER_NO_BORDER
|
|
#define GRAPHWALKER_CALL_LAMBDA_IDX(idx, count, lambda) lambda, count++
|
|
#define GRAPHWALKER_CALL_LAMBDA_PTS(p1, p2, count, lambda) lambda, count++
|
|
#else
|
|
#define GRAPHWALKER_CALL_LAMBDA_IDX(idx, count, lambda) if (!border.isBorder (idx)) lambda, count++
|
|
#define GRAPHWALKER_CALL_LAMBDA_PTS(p1, p2, count, lambda) if (!(border.isBorder (p1) || border.isBorder (p2))) lambda, count++
|
|
#endif
|
|
|
|
namespace otb {
|
|
namespace triskele {
|
|
namespace arrayTree {
|
|
|
|
using namespace ::triskele;
|
|
|
|
/** GraphWalker */
|
|
class GraphWalker {
|
|
public:
|
|
const Size size;
|
|
const Border &border;
|
|
const Connectivity connectivity;
|
|
|
|
inline GraphWalker (const Size &size, const Border &border, const Connectivity &connectivity = Connectivity::C4);
|
|
inline DimImg vertexMaxCount () const;
|
|
inline DimImg vertexMaxCount (const Size &tileSize) const;
|
|
inline DimEdge edgeMaxCount () const;
|
|
inline DimEdge edgeMaxCount (const Size &tileSize) const;
|
|
inline DimEdge edgeBoundaryMaxCount (const DimSideImg &side) const;
|
|
|
|
inline void setTiles (const unsigned int &coreCount, const Rect &tile,
|
|
std::vector<Rect> &tiles, std::vector<Rect> &boundaries, std::vector<bool> &verticalBoundaries) const;
|
|
|
|
template<typename Funct>
|
|
inline DimImg forEachVertexIdx (const Funct &lambda /*lambda (idx)*/) const;
|
|
template<typename Funct>
|
|
DimImg forEachVertexPt (const Funct &lambda /*lambda (p)*/) const {
|
|
return forEachVertexIdx ([this, &lambda] (const Point &p) { lambda (point2idx (size, p)); });
|
|
}
|
|
template<typename Funct>
|
|
inline DimImg forEachVertexIdx (const Rect &rect, const Funct &lambda /*lambda (idx)*/) const;
|
|
template<typename Funct>
|
|
inline DimImg forEachVertexPt (const Rect &rect, const Funct &lambda /*lambda (p)*/) const;
|
|
|
|
template<typename Funct>
|
|
inline DimEdge forEachEdgePt (const Rect &rect, TileItem tileItem, const Funct &lambda /*lambda (p0, p1)*/) const;
|
|
|
|
template <typename WeightT, typename EdgeWeightFunction>
|
|
inline WeightT getMedian (const EdgeWeightFunction &ef /*ef.getValue (idx)*/) const;
|
|
|
|
template<typename WeightT, typename EdgeWeightFunction>
|
|
inline DimEdge getEdges (const Rect &rect, TileItem tileItem, Edge<WeightT> *edges, const EdgeWeightFunction &ef /*ef.getWeight (p0, p1)*/) const;
|
|
template<typename WeightT, typename EdgeWeightFunction>
|
|
inline DimEdge getSortedEdges (const Rect &rect, TileItem tileItem, Edge<WeightT> *edges, const EdgeWeightFunction &ef /*ef.getWeight (p0, p1) ef.sort ()*/) const;
|
|
template<typename WeightT, typename EdgeWeightFunction>
|
|
inline DimEdge getCountingSortedEdges (const Rect &rect, TileItem tileItem, Edge<WeightT> *edges, const EdgeWeightFunction &ef /*ef.getWeight (p0, p1)*/) const;
|
|
};
|
|
|
|
#include "GraphWalker.tpp"
|
|
|
|
|
|
} // arrayTree
|
|
} // triskele
|
|
} // otb
|
|
|
|
|
|
#endif // _OTB_TRISKELE_ARRAY_TREE_GRAPHWALKER_HPP
|