nouveau fichier : include/ArrayTree/ArrayTreeBuilder.tpp nouveau fichier : include/ArrayTree/Border.hpp nouveau fichier : include/ArrayTree/GraphWalker.hpp nouveau fichier : include/ArrayTree/Leader.hpp nouveau fichier : include/ArrayTree/Weight.hpp nouveau fichier : include/ArrayTree/Weight.tpp nouveau fichier : include/ArrayTree/triskeleArrayTreeBase.hpp nouveau fichier : include/ArrayTree/triskeleSort.hpp nouveau fichier : include/ArrayTree/triskeleSort.tpp modifié : include/Attribute.hpp modifié : include/Attributes/AreaAttribute.hpp supprimé : include/BuildTree.hpp supprimé : include/DAPTree/Border.hpp supprimé : include/DAPTree/DAPTreeBuilder.hpp supprimé : include/DAPTree/DAPTreeBuilder.tpp supprimé : include/DAPTree/GraphWalker.hpp supprimé : include/DAPTree/ParRnk.hpp supprimé : include/DAPTree/Weight.hpp supprimé : include/DAPTree/baseDAPTree.hpp supprimé : include/DAPTree/sort.hpp nouveau fichier : include/IImage.hpp nouveau fichier : include/IImage.tpp supprimé : include/ImageInterface.hpp supprimé : include/ImageInterface.tpp modifié : include/QuadTree/QuadTreeBuilder.hpp modifié : include/Tree.hpp nouveau fichier : include/TreeBuilder.hpp supprimé : include/TreeOfShapesGeraud/ToSBuilder.hpp supprimé : include/TreeOfShapesGeraud/ToSutils.hpp modifié : include/XMLTree/XMLTreeBuilder.hpp supprimé : include/baseDef.hpp supprimé : include/getType.hpp nouveau fichier : include/triskeleBase.hpp renommé : include/dealThreads.hpp -> include/triskeleDealThreads.hpp nouveau fichier : include/triskeleDealThreads.tpp renommé : include/debug.hpp -> include/triskeleDebug.hpp nouveau fichier : include/triskeleGdalGetType.hpp modifié : otb-module.cmake nouveau fichier : src/ArrayTree/triskeleArrayTreeBase.cpp modifié : src/Attribute.cpp modifié : src/Attributes/AreaAttribute.cpp modifié : src/CMakeLists.txt supprimé : src/DAPTree/GraphWalker.cpp supprimé : src/DAPTree/ParRnk.cpp supprimé : src/DAPTree/baseDAPTree.cpp supprimé : src/DAPTree/sort.cpp modifié : src/QuadTree/QuadTreeBuilder.cpp modifié : src/Tree.cpp supprimé : src/TreeOfShapesGeraud/ToSBuilder.cpp supprimé : src/TreeOfShapesGeraud/ToSutils.cpp modifié : src/XMLTree/XMLTreeBuilder.cpp supprimé : src/debug.cpp modifié : src/testMain.cpp nouveau fichier : src/triskeleDebug.cpp supprimé : tests/ToSGeraudCoord.txt supprimé : tests/ToSGeraudIdx.ods
84 lines
3.2 KiB
C++
84 lines
3.2 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;
|
|
|
|
GraphWalker (const Size &size, const Border &border, const Connectivity &connectivity = Connectivity::C4)
|
|
: size (size), border (border), connectivity (connectivity) {
|
|
BOOST_ASSERT (size.width >= DimImg (0));
|
|
BOOST_ASSERT (size.height >= DimImg (0));
|
|
}
|
|
|
|
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
|