modifié : CMakeLists.txt
modifié : CMakeListsOTB.txt modifié : LICENSE modifié : MakefileNoOTB modifié : Readme.html modifié : Readme.txt modifié : data/10m.tif modifié : data/areaThresholds.txt modifié : data/moiThresholds.txt modifié : data/sdThresholds.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
This commit is contained in:
parent
952f2ddea5
commit
2683beda1a
0
CMakeLists.txt
Normal file → Executable file
0
CMakeLists.txt
Normal file → Executable file
0
CMakeListsOTB.txt
Normal file → Executable file
0
CMakeListsOTB.txt
Normal file → Executable file
6
MakefileNoOTB
Normal file → Executable file
6
MakefileNoOTB
Normal file → Executable file
@ -21,8 +21,8 @@ PRF_SRC = $(patsubst %, $(CPP_DIR)/%.cpp, $(PRF_PRG))
|
||||
PRF_OUT = $(patsubst %, $(OUT_DIR)/%, $(PRF_PRG))
|
||||
|
||||
## FLAGS ###############################
|
||||
DFLAGS = -O2 -DNDEBUG -DBOOST_DISABLE_ASSERTS -DNO_OTB # -DINTEL_TBB_THREAD
|
||||
#DFLAGS = -g -DENABLE_LOG -DNO_OTB -DTHREAD_DISABLE -DENABLE_SMART_LOG
|
||||
DFLAGS = -O2 -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD # -DBOOST_DISABLE_ASSERTS
|
||||
#DFLAGS = -g -DENABLE_LOG -DNO_OTB # -DTHREAD_DISABLE -DENABLE_SMART_LOG
|
||||
IFLAGS = $(DFLAGS) -MMD -I$(HPP_DIR) -I/usr/include/gdal
|
||||
LFLAGS = -L$(LIB_DIR) -ltriskele -lstdc++ -lpthread -lboost_system -lboost_chrono -lboost_thread -lboost_program_options -lboost_date_time -lboost_serialization -lboost_filesystem -lboost_unit_test_framework -lgdal -ltbb
|
||||
CC = g++
|
||||
@ -48,7 +48,7 @@ testB: all
|
||||
$(APG_OUT) data/10m.tif data/result.tif --min-tree --max-tree --tos-tree --alpha-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug
|
||||
|
||||
perfA: all
|
||||
$(PRF_OUT) MIN 8 20 1000000
|
||||
$(PRF_OUT) MIN 4 20 1000000
|
||||
|
||||
init:
|
||||
mkdir -p $(OUT_DIR) $(OBJ_DIR) $(LIB_DIR)
|
||||
|
0
Readme.html
Normal file → Executable file
0
Readme.html
Normal file → Executable file
0
Readme.txt
Normal file → Executable file
0
Readme.txt
Normal file → Executable file
0
data/10m.tif
Normal file → Executable file
0
data/10m.tif
Normal file → Executable file
0
data/areaThresholds.txt
Normal file → Executable file
0
data/areaThresholds.txt
Normal file → Executable file
0
data/moiThresholds.txt
Normal file → Executable file
0
data/moiThresholds.txt
Normal file → Executable file
0
data/sdThresholds.txt
Normal file → Executable file
0
data/sdThresholds.txt
Normal file → Executable file
1
include/Appli/Option.hpp
Normal file → Executable file
1
include/Appli/Option.hpp
Normal file → Executable file
@ -23,6 +23,7 @@ namespace otb {
|
||||
Point topLeft = NullPoint;
|
||||
Size size = NullSize;
|
||||
Selected selectedBand;
|
||||
size_t countingSortCeil = 2;
|
||||
vector<DimImg> areaThresholds;
|
||||
vector<double> sdThresholds, moiThresholds;
|
||||
unsigned int coreCount = boost::thread::hardware_concurrency ();
|
||||
|
0
include/Appli/Selected.hpp
Normal file → Executable file
0
include/Appli/Selected.hpp
Normal file → Executable file
0
include/Appli/Selected.tpp
Normal file → Executable file
0
include/Appli/Selected.tpp
Normal file → Executable file
4
include/ArrayTree/ArrayTreeBuilder.hpp
Normal file → Executable file
4
include/ArrayTree/ArrayTreeBuilder.hpp
Normal file → Executable file
@ -30,7 +30,7 @@ namespace otb {
|
||||
const Raster<PixelT> &raster;
|
||||
const GraphWalker &graphWalker;
|
||||
TreeType treeType;
|
||||
bool countingFlag;
|
||||
size_t countingSortCeil;
|
||||
Leader leaders;
|
||||
|
||||
// transcient
|
||||
@ -39,7 +39,7 @@ namespace otb {
|
||||
WeightT *compWeights;
|
||||
public:
|
||||
inline ArrayTreeBuilder (const Raster<PixelT> &raster, const GraphWalker &graphWalker,
|
||||
const TreeType &treeType, const bool &countingSort = true);
|
||||
const TreeType &treeType, const size_t &countingSortCeil = 2);
|
||||
inline ~ArrayTreeBuilder ();
|
||||
|
||||
inline void buildTree (Tree &tree, WeightAttributes<WeightT> &weightAttributes);
|
||||
|
14
include/ArrayTree/ArrayTreeBuilder.tpp
Normal file → Executable file
14
include/ArrayTree/ArrayTreeBuilder.tpp
Normal file → Executable file
@ -7,12 +7,12 @@ using namespace boost::chrono;
|
||||
template<typename WeightT, typename PixelT>
|
||||
inline
|
||||
ArrayTreeBuilder<WeightT, PixelT>::ArrayTreeBuilder (const Raster<PixelT> &raster, const GraphWalker &graphWalker,
|
||||
const TreeType &treeType, const bool &countingSort) :
|
||||
const TreeType &treeType, const size_t &countingSortCeil) :
|
||||
coreCount (boost::thread::hardware_concurrency ()),
|
||||
raster (raster),
|
||||
graphWalker (graphWalker),
|
||||
treeType (treeType),
|
||||
countingFlag (countingSort),
|
||||
countingSortCeil (countingSortCeil),
|
||||
compWeights (nullptr),
|
||||
childCount (nullptr),
|
||||
newCompId (nullptr)
|
||||
@ -30,7 +30,7 @@ template<typename WeightT, typename PixelT>
|
||||
inline void
|
||||
ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, WeightAttributes<WeightT> &weightAttributes) {
|
||||
DEF_LOG ("ArrayTreeBuilder::buildTree", "size:" << graphWalker.vertexMaxCount ());
|
||||
setTreeSize (tree, graphWalker.size);
|
||||
setTreeSize (tree, graphWalker.getSize ());
|
||||
weightAttributes.updateTranscient ();
|
||||
if (!leafCount)
|
||||
return;
|
||||
@ -114,7 +114,7 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &wei
|
||||
vector<Rect> tiles;
|
||||
vector<Rect> boundaries;
|
||||
vector<bool> verticalBoundaries;
|
||||
const Size &size (graphWalker.size);
|
||||
const Size &size (graphWalker.getSize ());
|
||||
graphWalker.setTiles (coreCount, Rect (NullPoint, size), tiles, boundaries, verticalBoundaries);
|
||||
unsigned int tileCount = tiles.size ();
|
||||
unsigned int boundCount = boundaries.size ();
|
||||
@ -248,12 +248,12 @@ template<typename WeightFunct>
|
||||
inline void
|
||||
ArrayTreeBuilder<WeightT, PixelT>::buildParents (Edge<WeightT> *edges, const WeightFunct &weightFunct,
|
||||
const Rect &tile, DimImg &topParent) {
|
||||
SMART_DEF_LOG ("ArrayTreeBuilder::buildParents", " tile:" << tile << " topParent:" << topParent << " counting:" << countingFlag);
|
||||
DimEdge edgeCount = (sizeof (WeightT) < 3 || countingFlag) ?
|
||||
SMART_DEF_LOG ("ArrayTreeBuilder::buildParents", " tile:" << tile << " topParent:" << topParent << " counting:" << countingSortCeil);
|
||||
DimEdge edgeCount = (sizeof (WeightT) <= countingSortCeil) ?
|
||||
graphWalker.getCountingSortedEdges<WeightT, WeightFunct> (tile, Surface, edges, weightFunct) :
|
||||
graphWalker.getSortedEdges (tile, Surface, edges, weightFunct);
|
||||
|
||||
const Size &size = graphWalker.size;
|
||||
const Size &size = graphWalker.getSize ();
|
||||
for (DimEdge edgeIdx = 0; edgeIdx < edgeCount; ++edgeIdx) {
|
||||
Edge<WeightT> &curEdge = edges[edgeIdx];
|
||||
DimImg pa = point2idx (size, curEdge.points[0]);
|
||||
|
9
include/ArrayTree/Border.hpp
Normal file → Executable file
9
include/ArrayTree/Border.hpp
Normal file → Executable file
@ -42,13 +42,16 @@ namespace otb {
|
||||
|
||||
/*! Construit Border, les valeurs de map dépendent de defaultVal */
|
||||
inline Border (const Size &size, bool defaultVal);
|
||||
inline Border (const Border &border, const Rect &tile);
|
||||
inline ~Border ();
|
||||
|
||||
inline void reset (bool defaultVal);
|
||||
|
||||
inline const Size &getSize () const;
|
||||
|
||||
/*! Compte le nombre de pixels considérés comme de la bordure */
|
||||
inline DimImg borderCount ();
|
||||
|
||||
|
||||
private:
|
||||
/*! Nombre de pixels dans l'image */
|
||||
DimImg pixelsCount;
|
||||
@ -62,6 +65,10 @@ namespace otb {
|
||||
/*! Tableau "simplifié" des pixels */
|
||||
vector<uint8_t> map;
|
||||
|
||||
bool defaultVal;
|
||||
|
||||
inline void createMap ();
|
||||
|
||||
friend inline ostream &operator << (ostream &out, const Border &border);
|
||||
};
|
||||
|
||||
|
52
include/ArrayTree/Border.tpp
Normal file → Executable file
52
include/ArrayTree/Border.tpp
Normal file → Executable file
@ -12,32 +12,40 @@ Border::getMapLength (DimImg pixelsCount) {
|
||||
|
||||
inline bool
|
||||
Border::isBorder (DimImg idx) const {
|
||||
return map.size () ? map[idx/8] & (1 << (idx%8)) : false;
|
||||
BOOST_ASSERT (idx < pixelsCount);
|
||||
return map.size () ? map[idx/8] & (1 << (idx%8)) : defaultVal;
|
||||
}
|
||||
|
||||
inline bool
|
||||
Border::isBorder (const Point &p) const {
|
||||
return map.size () ? isBorder (pointToId (size, p)) : false;
|
||||
BOOST_ASSERT (p.x < size.width && p.y < size.height);
|
||||
return isBorder (point2idx (size, p));
|
||||
}
|
||||
|
||||
inline void
|
||||
Border::clearBorder (DimImg idx) {
|
||||
if (!map.size ())
|
||||
createMap ();
|
||||
BOOST_ASSERT (idx < pixelsCount);
|
||||
map[idx/8] &= ~(1 << (idx%8));
|
||||
}
|
||||
|
||||
inline void
|
||||
Border::clearBorder (const Point &p) {
|
||||
clearBorder (pointToId (size, p));
|
||||
clearBorder (point2idx (size, p));
|
||||
}
|
||||
|
||||
inline void
|
||||
Border::setBorder (DimImg idx) {
|
||||
if (!map.size ())
|
||||
createMap ();
|
||||
BOOST_ASSERT (idx < pixelsCount);
|
||||
map[idx/8] |= (1 << (idx%8));
|
||||
}
|
||||
|
||||
inline void
|
||||
Border::setBorder (const Point &p) {
|
||||
setBorder (pointToId (size, p));
|
||||
setBorder (point2idx (size, p));
|
||||
}
|
||||
|
||||
inline
|
||||
@ -45,29 +53,57 @@ Border::Border ()
|
||||
: pixelsCount (0),
|
||||
mapLength (0),
|
||||
size (),
|
||||
map () {
|
||||
}
|
||||
map (),
|
||||
defaultVal (false) {
|
||||
}
|
||||
|
||||
inline
|
||||
Border::Border (const Size &size, bool defaultVal)
|
||||
: pixelsCount (getPixelsCount (size)),
|
||||
size (size),
|
||||
mapLength (getMapLength (pixelsCount)),
|
||||
size (size) {
|
||||
reset (defaultVal);
|
||||
map (),
|
||||
defaultVal (defaultVal) {
|
||||
}
|
||||
|
||||
inline
|
||||
Border::Border (const Border &border, const Rect &tile)
|
||||
: size (tile.width, tile.height),
|
||||
pixelsCount (getPixelsCount (size)),
|
||||
mapLength (getMapLength (pixelsCount)),
|
||||
map (),
|
||||
defaultVal (border.defaultVal) {
|
||||
if (!border.map.size ())
|
||||
return;
|
||||
// XXX todo
|
||||
// width >= 8 => for bytes
|
||||
// width < 8 => for bits
|
||||
BOOST_ASSERT (false);
|
||||
}
|
||||
|
||||
inline
|
||||
Border::~Border () {
|
||||
}
|
||||
|
||||
inline void
|
||||
Border::reset (bool defaultVal) {
|
||||
this->defaultVal = defaultVal;
|
||||
map.clear ();
|
||||
}
|
||||
|
||||
inline void
|
||||
Border::createMap () {
|
||||
map.assign (mapLength, defaultVal ? 0xFF : 0);
|
||||
if (!(mapLength && defaultVal))
|
||||
return;
|
||||
map[mapLength-1] &= 0xFF >> (8-(pixelsCount%8))%8;
|
||||
}
|
||||
|
||||
inline const Size &
|
||||
Border::getSize () const {
|
||||
return size;
|
||||
}
|
||||
|
||||
inline DimImg
|
||||
Border::borderCount () {
|
||||
DimImg result = 0;
|
||||
|
18
include/ArrayTree/GraphWalker.hpp
Normal file → Executable file
18
include/ArrayTree/GraphWalker.hpp
Normal file → Executable file
@ -29,26 +29,32 @@ namespace otb {
|
||||
/** GraphWalker */
|
||||
class GraphWalker {
|
||||
public:
|
||||
const Size size;
|
||||
const Border &border;
|
||||
const Connectivity connectivity;
|
||||
inline const Size &getSize () const;
|
||||
|
||||
inline GraphWalker (const Border &border, const Connectivity &connectivity = Connectivity::C4);
|
||||
|
||||
inline GraphWalker (const Size &size, const Border &border, const Connectivity &connectivity = Connectivity::C4);
|
||||
inline DimImg vertexMaxCount () const;
|
||||
inline DimImg vertexMaxCount (const Size &tileSize) const;
|
||||
static inline DimImg vertexMaxCount (const Size &tileSize);
|
||||
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,
|
||||
vector<Rect> &tiles, vector<Rect> &boundaries, vector<bool> &verticalBoundaries) const;
|
||||
inline void setTiles (const unsigned int &coreCount,
|
||||
vector<Rect> &tiles, vector<Rect> &boundaries, vector<bool> &verticalBoundaries) const {
|
||||
setTiles (coreCount, Rect (NullPoint, border.getSize ()), tiles, boundaries, verticalBoundaries);
|
||||
}
|
||||
static inline void setTiles (const unsigned int &coreCount, const Rect &rect,
|
||||
vector<Rect> &tiles, vector<Rect> &boundaries, vector<bool> &verticalBoundaries);
|
||||
inline void setMaxBounds (const vector<Rect> &tiles, vector<DimImg> &vertexMaxBounds, vector<DimImg> &edgesMaxBounds) 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)); });
|
||||
const Size &size (border.getSize ());
|
||||
return forEachVertexIdx ([&lambda, &size] (const Point &p) { lambda (point2idx (size, p)); });
|
||||
}
|
||||
template<typename Funct>
|
||||
inline DimImg forEachVertexIdx (const Rect &rect, const Funct &lambda /*lambda (idx)*/) const;
|
||||
|
53
include/ArrayTree/GraphWalker.tpp
Normal file → Executable file
53
include/ArrayTree/GraphWalker.tpp
Normal file → Executable file
@ -1,31 +1,37 @@
|
||||
#ifndef _OTB_TRISKELE_ARRAY_TREE_GRAPHWALKER_TPP
|
||||
#define _OTB_TRISKELE_ARRAY_TREE_GRAPHWALKER_TPP
|
||||
|
||||
// ========================================
|
||||
inline const Size &
|
||||
GraphWalker::getSize () const {
|
||||
return border.getSize ();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
inline
|
||||
GraphWalker::GraphWalker (const Size &size, const Border &border, const Connectivity &connectivity)
|
||||
: size (size), border (border), connectivity (connectivity) {
|
||||
DEF_LOG ("GraphWalker::GraphWalker", "size: " << size);
|
||||
BOOST_ASSERT (size.width >= DimImg (0));
|
||||
BOOST_ASSERT (size.height >= DimImg (0));
|
||||
GraphWalker::GraphWalker (const Border &border, const Connectivity &connectivity)
|
||||
: border (border), connectivity (connectivity) {
|
||||
DEF_LOG ("GraphWalker::GraphWalker", "size: " << border.getSize ());
|
||||
BOOST_ASSERT (border.getSize ().width >= DimImg (0));
|
||||
BOOST_ASSERT (border.getSize ().height >= DimImg (0));
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
inline DimImg
|
||||
GraphWalker::vertexMaxCount () const {
|
||||
return vertexMaxCount (size);
|
||||
return vertexMaxCount (border.getSize ());
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
inline DimImg
|
||||
GraphWalker::vertexMaxCount (const Size &tileSize) const {
|
||||
GraphWalker::vertexMaxCount (const Size &tileSize) {
|
||||
return DimImg (tileSize.width)*DimImg (tileSize.height);
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
inline DimEdge
|
||||
GraphWalker::edgeMaxCount () const {
|
||||
return edgeMaxCount (size);
|
||||
return edgeMaxCount (border.getSize ());
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
@ -64,20 +70,20 @@ GraphWalker::edgeBoundaryMaxCount (const DimSideImg &side) const {
|
||||
|
||||
// ========================================
|
||||
inline void
|
||||
GraphWalker::setTiles (const unsigned int &coreCount, const Rect &tile,
|
||||
vector<Rect> &tiles, vector<Rect> &boundaries, vector<bool> &verticalBoundaries) const {
|
||||
GraphWalker::setTiles (const unsigned int &coreCount, const Rect &rect,
|
||||
vector<Rect> &tiles, vector<Rect> &boundaries, vector<bool> &verticalBoundaries) {
|
||||
BOOST_ASSERT (coreCount);
|
||||
DEF_LOG ("GraphWalker::setTiles", "coreCount:" << coreCount << " tile:" << tile);
|
||||
if (coreCount < 2 || max (tile.width, tile.height) < 4 || min (tile.width, tile.height) < 3) {
|
||||
LOG ("tile:" << tile);
|
||||
tiles.push_back (tile);
|
||||
DEF_LOG ("GraphWalker::setTiles", "coreCount:" << coreCount << " rect:" << rect);
|
||||
if (coreCount < 2 || max (rect.width, rect.height) < 4 || min (rect.width, rect.height) < 3) {
|
||||
LOG ("rect:" << rect);
|
||||
tiles.push_back (rect);
|
||||
return;
|
||||
}
|
||||
bool vertical = tile.width > tile.height;
|
||||
bool vertical = rect.width > rect.height;
|
||||
bool odd = coreCount & 0x1;
|
||||
DimImg thin = (vertical ? tile.width : tile.height) / (odd ? coreCount : 2);
|
||||
Rect tileA (tile);
|
||||
Rect tileB (tile);
|
||||
DimImg thin = (vertical ? rect.width : rect.height) / (odd ? coreCount : 2);
|
||||
Rect tileA (rect);
|
||||
Rect tileB (rect);
|
||||
if (vertical) {
|
||||
tileA.width = thin;
|
||||
tileB.x += thin;
|
||||
@ -121,6 +127,7 @@ GraphWalker::forEachVertexIdx (const Funct &lambda /*lambda (DimImg idx)*/) cons
|
||||
template<typename Funct>
|
||||
inline DimImg
|
||||
GraphWalker::forEachVertexIdx (const Rect &rect, const Funct &lambda /*lambda (DimImg idx)*/) const {
|
||||
const Size &size (border.getSize ());
|
||||
DimImg vertexCount = 0;
|
||||
DimSideImg const lastX = rect.x+rect.width;
|
||||
DimSideImg const lastY = rect.y+rect.height;
|
||||
@ -136,6 +143,7 @@ GraphWalker::forEachVertexIdx (const Rect &rect, const Funct &lambda /*lambda (D
|
||||
template<typename Funct>
|
||||
inline DimImg
|
||||
GraphWalker::forEachVertexPt (const Rect &rect, const Funct &lambda /*lambda (Point p)*/) const {
|
||||
const Size &size (border.getSize ());
|
||||
DimImg vertexCount = 0;
|
||||
DimSideImg const lastX = rect.x+rect.width;
|
||||
DimSideImg const lastY = rect.y+rect.height;
|
||||
@ -275,9 +283,9 @@ inline DimEdge
|
||||
GraphWalker::getSortedEdges (const Rect &rect, TileItem tileItem, Edge<WeightT> *edges, const EdgeWeightFunction &ef /*ef.getWeight (p0, p1) ef.sort ()*/) const {
|
||||
SMART_DEF_LOG ("GraphWalker::getSortedEdges", "");
|
||||
DimEdge edgeCount = getEdges (rect, tileItem, edges, ef);
|
||||
// SMART_LOG (endl << printEdges (edges, size, edgeCount));
|
||||
// SMART_LOG (endl << printEdges (edges, border.getSize (), edgeCount));
|
||||
ef.sort (edges, edgeCount);
|
||||
SMART_LOG (endl << printEdges (edges, size, edgeCount))
|
||||
SMART_LOG (endl << printEdges (edges, border.getSize (), edgeCount))
|
||||
return edgeCount;
|
||||
}
|
||||
|
||||
@ -308,10 +316,13 @@ GraphWalker::getCountingSortedEdges (const Rect &rect, TileItem tileItem, Edge<W
|
||||
} else
|
||||
indices[0] = 0;
|
||||
// extract edges
|
||||
#ifdef ENABLE_SMART_LOG
|
||||
const Size &size (border.getSize ());
|
||||
#endif
|
||||
forEachEdgePt (rect, tileItem,
|
||||
[
|
||||
#ifdef ENABLE_SMART_LOG
|
||||
this,
|
||||
&size,
|
||||
#endif
|
||||
&ef, &edges, &indices] (Point const &a, Point const &b) {
|
||||
WeightT weight = ef.getWeight (a, b);
|
||||
|
3
include/ArrayTree/Leader.hpp
Normal file → Executable file
3
include/ArrayTree/Leader.hpp
Normal file → Executable file
@ -22,7 +22,7 @@ namespace otb {
|
||||
vector<DimImg> leaders;
|
||||
|
||||
public:
|
||||
inline Leader ();
|
||||
inline Leader (DimImg vertexCount = 0);
|
||||
inline ~Leader ();
|
||||
|
||||
/*! Remet à 0 et redéfinit la taille des tableaux */
|
||||
@ -38,6 +38,7 @@ namespace otb {
|
||||
inline void link (DimImg a, const DimImg &r);
|
||||
|
||||
inline DimImg *getLeaders ();
|
||||
inline vector<DimImg> &getLeadersVector ();
|
||||
};
|
||||
|
||||
#include "Leader.tpp"
|
||||
|
10
include/ArrayTree/Leader.tpp
Normal file → Executable file
10
include/ArrayTree/Leader.tpp
Normal file → Executable file
@ -3,9 +3,9 @@
|
||||
|
||||
// ========================================
|
||||
inline
|
||||
Leader::Leader ()
|
||||
: size (0),
|
||||
leaders () {
|
||||
Leader::Leader (DimImg vertexCount)
|
||||
: size (vertexCount),
|
||||
leaders (size, DimImg_MAX) {
|
||||
}
|
||||
|
||||
inline
|
||||
@ -67,6 +67,10 @@ Leader::getLeaders () {
|
||||
return &leaders[0];
|
||||
}
|
||||
|
||||
inline vector<DimImg> &
|
||||
Leader::getLeadersVector () {
|
||||
return leaders;
|
||||
}
|
||||
// ========================================
|
||||
|
||||
#endif // _OTB_TRISKELE_ARRAY_TREE_LEADER_TPP
|
||||
|
40
include/ArrayTree/Weight.hpp
Normal file → Executable file
40
include/ArrayTree/Weight.hpp
Normal file → Executable file
@ -5,6 +5,7 @@
|
||||
#include <typeinfo>
|
||||
|
||||
#include "triskeleBase.hpp"
|
||||
#include "IImage.hpp"
|
||||
#include "triskeleArrayTreeBase.hpp"
|
||||
|
||||
namespace otb {
|
||||
@ -14,13 +15,16 @@ namespace otb {
|
||||
class GraphWalker;
|
||||
|
||||
/*! Structure définissant la base d'un poids entre les pixels */
|
||||
template <typename PixelT> struct WeightBase {
|
||||
template <typename PixelT, typename WeightT> struct WeightBase {
|
||||
protected:
|
||||
const PixelT *pixels;
|
||||
const Size size;
|
||||
Size size;
|
||||
inline DimNodeId pointIdx (const Point &p) const;
|
||||
PixelT halfPixel, maxPixel;
|
||||
inline void reset (const PixelT *pixels, const Size &size);
|
||||
public:
|
||||
const PixelT *getPixels () const { return pixels; }
|
||||
|
||||
inline const Size &getSize () const;
|
||||
inline const PixelT &getValue (const DimImg &idx) const;
|
||||
inline const PixelT &getValue (const Point &p) const;
|
||||
@ -28,15 +32,7 @@ namespace otb {
|
||||
inline const PixelT &getMaxPixel () const;
|
||||
inline const PixelT &getHalfPixel () const;
|
||||
|
||||
inline PixelT *allocAP (const DimNodeId &nodeCapacity) const;
|
||||
|
||||
inline WeightBase (const PixelT *pixels, const Size &size);
|
||||
};
|
||||
|
||||
template <typename PixelT, typename WeightT> struct WeightBase2 : public WeightBase<PixelT> {
|
||||
typedef WeightBase<PixelT> WB;
|
||||
|
||||
inline WeightBase2 (const PixelT *pixels, const Size &size);
|
||||
|
||||
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
|
||||
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
|
||||
@ -49,15 +45,17 @@ namespace otb {
|
||||
};
|
||||
|
||||
/*! Structure intégrant la façon dont est géré un poids pour un MinTree */
|
||||
template <typename PixelT, typename WeightT> struct MinWeight : public WeightBase2<PixelT, WeightT> {
|
||||
typedef WeightBase2<PixelT, WeightT> WB;
|
||||
template <typename PixelT, typename WeightT> struct MinWeight : public WeightBase<PixelT, WeightT> {
|
||||
typedef WeightBase<PixelT, WeightT> WB;
|
||||
|
||||
inline bool getDecr () const;
|
||||
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
|
||||
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
|
||||
static inline void sort (Edge<WeightT> *edges, DimEdge count);
|
||||
|
||||
inline MinWeight ();
|
||||
inline MinWeight (const PixelT *pixels, const Size &size);
|
||||
inline MinWeight (const MinWeight &model, const PixelT *pixels, const Size &size);
|
||||
|
||||
inline WeightT getWeight (const DimImg &idx) const;
|
||||
inline WeightT getWeight (const Point &a, const Point &b) const;
|
||||
@ -65,10 +63,12 @@ namespace otb {
|
||||
|
||||
// ========================================
|
||||
/*! Structure intégrant la façon dont est géré un poids pour un MaxTree */
|
||||
template <typename PixelT, typename WeightT> struct MaxWeight : public WeightBase2<PixelT, WeightT> {
|
||||
typedef WeightBase2<PixelT, WeightT> WB;
|
||||
template <typename PixelT, typename WeightT> struct MaxWeight : public WeightBase<PixelT, WeightT> {
|
||||
typedef WeightBase<PixelT, WeightT> WB;
|
||||
|
||||
inline MaxWeight ();
|
||||
inline MaxWeight (const PixelT *pixels, const Size &size);
|
||||
inline MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size);
|
||||
|
||||
inline WeightT getWeight (const DimImg &idx) const;
|
||||
inline WeightT getWeight (const Point &a, const Point &b) const;
|
||||
@ -76,10 +76,12 @@ namespace otb {
|
||||
|
||||
// ========================================
|
||||
/*! Structure intégrant la façon dont est géré un poids pour un AlphaTree */
|
||||
template <typename PixelT, typename WeightT> struct DiffWeight : public WeightBase2<PixelT, WeightT> {
|
||||
typedef WeightBase2<PixelT, WeightT> WB;
|
||||
template <typename PixelT, typename WeightT> struct DiffWeight : public WeightBase<PixelT, WeightT> {
|
||||
typedef WeightBase<PixelT, WeightT> WB;
|
||||
|
||||
inline DiffWeight ();
|
||||
inline DiffWeight (const PixelT *pixels, const Size &size);
|
||||
inline DiffWeight (const DiffWeight &model, const PixelT *pixels, const Size &size);
|
||||
|
||||
inline WeightT getWeight (const DimImg &idx) const;
|
||||
inline WeightT getWeight (const Point &a, const Point &b) const;
|
||||
@ -87,8 +89,8 @@ namespace otb {
|
||||
|
||||
// ========================================
|
||||
/*! Structure intégrant la façon dont est géré un poids pour un TreeOfShape */
|
||||
template <typename PixelT, typename WeightT> struct MedianWeight : public WeightBase2<PixelT, WeightT> {
|
||||
typedef WeightBase2<PixelT, WeightT> WB;
|
||||
template <typename PixelT, typename WeightT> struct MedianWeight : public WeightBase<PixelT, WeightT> {
|
||||
typedef WeightBase<PixelT, WeightT> WB;
|
||||
protected:
|
||||
PixelT median, thresholdPixel;
|
||||
WeightT thresholdWeight;
|
||||
@ -106,7 +108,9 @@ namespace otb {
|
||||
inline WeightT value2weight (const PixelT &val) const;
|
||||
inline PixelT weight2value (const WeightT &weight) const;
|
||||
|
||||
inline MedianWeight ();
|
||||
inline MedianWeight (const PixelT *pixels, const GraphWalker &graphWalker);
|
||||
inline MedianWeight (const MedianWeight &model, const PixelT *pixels, const Size &size);
|
||||
|
||||
inline WeightT getWeight (const DimImg &idx) const;
|
||||
inline WeightT getWeight (const Point &a, const Point &b) const;
|
||||
|
149
include/ArrayTree/Weight.tpp
Normal file → Executable file
149
include/ArrayTree/Weight.tpp
Normal file → Executable file
@ -2,100 +2,97 @@
|
||||
#define _OTB_TRISKELE_ARRAY_TREE_WEIGHT_TPP
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT>
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline DimNodeId
|
||||
WeightBase<PixelT>::pointIdx (const Point &p) const {
|
||||
WeightBase<PixelT, WeightT>::pointIdx (const Point &p) const {
|
||||
return point2idx (size, p);
|
||||
}
|
||||
|
||||
template <typename PixelT>
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline const Size &
|
||||
WeightBase<PixelT>::getSize () const {
|
||||
WeightBase<PixelT, WeightT>::getSize () const {
|
||||
return size;
|
||||
}
|
||||
|
||||
template <typename PixelT>
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline const PixelT &
|
||||
WeightBase<PixelT>::getValue (const DimImg &idx) const {
|
||||
WeightBase<PixelT, WeightT>::getValue (const DimImg &idx) const {
|
||||
return pixels[idx];
|
||||
}
|
||||
|
||||
template <typename PixelT>
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline const PixelT &
|
||||
WeightBase<PixelT>::getValue (const Point &p) const {
|
||||
WeightBase<PixelT, WeightT>::getValue (const Point &p) const {
|
||||
return getValue (pointIdx (p));
|
||||
}
|
||||
|
||||
template <typename PixelT>
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline bool
|
||||
WeightBase<PixelT>::getDecr () const {
|
||||
WeightBase<PixelT, WeightT>::getDecr () const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename PixelT>
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline const PixelT &
|
||||
WeightBase<PixelT>::getMaxPixel () const {
|
||||
WeightBase<PixelT, WeightT>::getMaxPixel () const {
|
||||
return maxPixel;
|
||||
}
|
||||
|
||||
template <typename PixelT>
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline const PixelT &
|
||||
WeightBase<PixelT>::getHalfPixel () const {
|
||||
WeightBase<PixelT, WeightT>::getHalfPixel () const {
|
||||
return halfPixel;
|
||||
}
|
||||
|
||||
template <typename PixelT>
|
||||
inline PixelT *
|
||||
WeightBase<PixelT>::allocAP (const DimNodeId &nodeCapacity) const {
|
||||
return new PixelT [nodeCapacity];
|
||||
}
|
||||
|
||||
template <typename PixelT>
|
||||
inline
|
||||
WeightBase<PixelT>::WeightBase (const PixelT *pixels, const Size &size)
|
||||
: pixels (pixels),
|
||||
size (size) {
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline void
|
||||
WeightBase<PixelT, WeightT>::reset (const PixelT *pixels, const Size &size) {
|
||||
this->pixels = pixels;
|
||||
this->size = size;
|
||||
maxPixel = std::numeric_limits<PixelT>::max ();
|
||||
// only if unsigned
|
||||
halfPixel = maxPixel / 2;
|
||||
if (typeid (PixelT) != typeid (float))
|
||||
halfPixel++;
|
||||
}
|
||||
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
WeightBase<PixelT, WeightT>::WeightBase (const PixelT *pixels, const Size &size)
|
||||
: pixels (nullptr),
|
||||
size (NullSize) {
|
||||
reset (pixels, size);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
WeightBase2<PixelT, WeightT>::WeightBase2 (const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline bool
|
||||
WeightBase2<PixelT, WeightT>::isWeightInf (const WeightT &a, const WeightT &b) {
|
||||
WeightBase<PixelT, WeightT>::isWeightInf (const WeightT &a, const WeightT &b) {
|
||||
return a < b;
|
||||
}
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline bool
|
||||
WeightBase2<PixelT, WeightT>::isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b) {
|
||||
WeightBase<PixelT, WeightT>::isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b) {
|
||||
return isWeightInf (a.weight, b.weight);
|
||||
}
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline void
|
||||
WeightBase2<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) {
|
||||
WeightBase<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) {
|
||||
std::sort (edges, edges+count, isEdgeInf);
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline void
|
||||
WeightBase2<PixelT, WeightT>::copyPixelsBound (PixelT *leafAPTree, const DimImg &minVal, const DimImg &maxVal) const {
|
||||
WeightBase<PixelT, WeightT>::copyPixelsBound (PixelT *leafAPTree, const DimImg &minVal, const DimImg &maxVal) const {
|
||||
for (DimImg i = minVal; i < maxVal; ++i)
|
||||
leafAPTree[i] = WB::pixels [i];
|
||||
leafAPTree[i] = pixels [i];
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline void
|
||||
WeightBase2<PixelT, WeightT>::weight2valueBound (PixelT *compAPTree, const WeightT *compWeights,
|
||||
const DimImg &minVal, const DimImg &maxVal) const {
|
||||
WeightBase<PixelT, WeightT>::weight2valueBound (PixelT *compAPTree, const WeightT *compWeights,
|
||||
const DimImg &minVal, const DimImg &maxVal) const {
|
||||
//memcpy (compAPTree+minVal, compWeights+minVal, maxVal-minVal);
|
||||
for (DimImg compIdx = minVal; compIdx < maxVal; ++compIdx)
|
||||
compAPTree[compIdx] = compWeights[compIdx];
|
||||
@ -126,12 +123,24 @@ MinWeight<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) {
|
||||
std::sort (edges, edges+count, isEdgeInf);
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MinWeight<PixelT, WeightT>::MinWeight ()
|
||||
: WB (nullptr, NullSize) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MinWeight<PixelT, WeightT>::MinWeight (const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MinWeight<PixelT, WeightT>::MinWeight (const MinWeight &model, const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline WeightT
|
||||
MinWeight<PixelT, WeightT>::getWeight (const DimImg &idx) const {
|
||||
@ -146,12 +155,24 @@ MinWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight ()
|
||||
: WB (nullptr, NullSize) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight (const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline WeightT
|
||||
MaxWeight<PixelT, WeightT>::getWeight (const DimImg &idx) const {
|
||||
@ -166,12 +187,24 @@ MaxWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
DiffWeight<PixelT, WeightT>::DiffWeight ()
|
||||
: WB (nullptr, NullSize) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
DiffWeight<PixelT, WeightT>::DiffWeight (const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
DiffWeight<PixelT, WeightT>::DiffWeight (const DiffWeight &model, const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline WeightT
|
||||
DiffWeight<PixelT, WeightT>::getWeight (const DimImg &idx) const {
|
||||
@ -254,6 +287,34 @@ MedianWeight<PixelT, WeightT>::weight2value (const WeightT &weight) const {
|
||||
return int (weight) % 2 ? median - weight/2 : median + weight/2;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MedianWeight<PixelT, WeightT>::MedianWeight ()
|
||||
: WB (nullptr, NullSize),
|
||||
median (0),
|
||||
thresholdPixel (0),
|
||||
thresholdWeight (0) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MedianWeight<PixelT, WeightT>::MedianWeight (const PixelT *pixels, const GraphWalker &graphWalker)
|
||||
: WB (pixels, graphWalker.getSize ()) {
|
||||
median = graphWalker.getMedian<WeightT> (*this);
|
||||
thresholdPixel = median < WB::halfPixel ? median * 2 : WB::maxPixel - (WB::maxPixel-median) * 2;
|
||||
thresholdWeight = median < WB::halfPixel ? median * 2 : (WB::maxPixel-median) * 2;
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MedianWeight<PixelT, WeightT>::MedianWeight (const MedianWeight &model, const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size),
|
||||
median (model.median),
|
||||
thresholdPixel (model.thresholdPixel),
|
||||
thresholdWeight (model.thresholdWeight) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline WeightT
|
||||
MedianWeight<PixelT, WeightT>::getWeight (const DimImg &idx) const {
|
||||
@ -270,21 +331,11 @@ MedianWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline void
|
||||
MedianWeight<PixelT, WeightT>::weight2valueBound (PixelT *compAPTree, const WeightT *compWeights,
|
||||
const DimImg &minVal, const DimImg &maxVal) const {
|
||||
const DimImg &minVal, const DimImg &maxVal) const {
|
||||
for (DimImg compIdx = minVal; compIdx < maxVal; ++compIdx)
|
||||
compAPTree[compIdx] = weight2value (compWeights[compIdx]);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MedianWeight<PixelT, WeightT>::MedianWeight (const PixelT *pixels, const GraphWalker &graphWalker)
|
||||
: WB (pixels, graphWalker.size) {
|
||||
median = graphWalker.getMedian<WeightT> (*this);
|
||||
thresholdPixel = median < WB::halfPixel ? median * 2 : WB::maxPixel - (WB::maxPixel-median) * 2;
|
||||
thresholdWeight = median < WB::halfPixel ? median * 2 : (WB::maxPixel-median) * 2;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
|
||||
#endif // _OTB_TRISKELE_ARRAY_TREE_WEIGHT_TPP
|
||||
|
0
include/ArrayTree/triskeleArrayTreeBase.hpp
Normal file → Executable file
0
include/ArrayTree/triskeleArrayTreeBase.hpp
Normal file → Executable file
0
include/ArrayTree/triskeleArrayTreeBase.tpp
Normal file → Executable file
0
include/ArrayTree/triskeleArrayTreeBase.tpp
Normal file → Executable file
0
include/ArrayTree/triskeleSort.hpp
Normal file → Executable file
0
include/ArrayTree/triskeleSort.hpp
Normal file → Executable file
0
include/ArrayTree/triskeleSort.tpp
Normal file → Executable file
0
include/ArrayTree/triskeleSort.tpp
Normal file → Executable file
0
include/AttributeProfiles.hpp
Normal file → Executable file
0
include/AttributeProfiles.hpp
Normal file → Executable file
0
include/AttributeProfiles.tpp
Normal file → Executable file
0
include/AttributeProfiles.tpp
Normal file → Executable file
0
include/Attributes/AreaAttributes.hpp
Normal file → Executable file
0
include/Attributes/AreaAttributes.hpp
Normal file → Executable file
0
include/Attributes/AreaAttributes.tpp
Normal file → Executable file
0
include/Attributes/AreaAttributes.tpp
Normal file → Executable file
0
include/Attributes/AverageAttributes.hpp
Normal file → Executable file
0
include/Attributes/AverageAttributes.hpp
Normal file → Executable file
0
include/Attributes/AverageAttributes.tpp
Normal file → Executable file
0
include/Attributes/AverageAttributes.tpp
Normal file → Executable file
0
include/Attributes/MoIAttributes.hpp
Normal file → Executable file
0
include/Attributes/MoIAttributes.hpp
Normal file → Executable file
0
include/Attributes/MoIAttributes.tpp
Normal file → Executable file
0
include/Attributes/MoIAttributes.tpp
Normal file → Executable file
0
include/Attributes/SDAttributes.hpp
Normal file → Executable file
0
include/Attributes/SDAttributes.hpp
Normal file → Executable file
0
include/Attributes/SDAttributes.tpp
Normal file → Executable file
0
include/Attributes/SDAttributes.tpp
Normal file → Executable file
0
include/Attributes/WeightAttributes.hpp
Normal file → Executable file
0
include/Attributes/WeightAttributes.hpp
Normal file → Executable file
0
include/Attributes/WeightAttributes.tpp
Normal file → Executable file
0
include/Attributes/WeightAttributes.tpp
Normal file → Executable file
0
include/Attributes/XYAttributes.hpp
Normal file → Executable file
0
include/Attributes/XYAttributes.hpp
Normal file → Executable file
0
include/Attributes/XYAttributes.tpp
Normal file → Executable file
0
include/Attributes/XYAttributes.tpp
Normal file → Executable file
0
include/CompAttribute.hpp
Normal file → Executable file
0
include/CompAttribute.hpp
Normal file → Executable file
0
include/CompAttribute.tpp
Normal file → Executable file
0
include/CompAttribute.tpp
Normal file → Executable file
2
include/IImage.hpp
Normal file → Executable file
2
include/IImage.hpp
Normal file → Executable file
@ -24,11 +24,13 @@ namespace triskele {
|
||||
inline const Size &getSize () const;
|
||||
inline const PixelT *getPixels () const;
|
||||
inline PixelT *getPixels ();
|
||||
inline vector<PixelT> &getPixelsVector ();
|
||||
inline DimNodeId pointIdx (const Point &p) const;
|
||||
inline PixelT getValue (const DimImg &idx) const;
|
||||
inline PixelT getValue (const Point &point) const;
|
||||
|
||||
inline Raster (const Size &size = NullSize);
|
||||
inline Raster (const Raster &raster, const Rect &tile);
|
||||
inline ~Raster ();
|
||||
};
|
||||
|
||||
|
14
include/IImage.tpp
Normal file → Executable file
14
include/IImage.tpp
Normal file → Executable file
@ -30,6 +30,12 @@ Raster<PixelT>::getPixels () {
|
||||
return &pixels[0];
|
||||
}
|
||||
|
||||
template<typename PixelT>
|
||||
inline vector<PixelT> &
|
||||
Raster<PixelT>::getPixelsVector () {
|
||||
return pixels;
|
||||
}
|
||||
|
||||
template<typename PixelT>
|
||||
inline DimNodeId
|
||||
Raster<PixelT>::pointIdx (const Point &p) const {
|
||||
@ -57,6 +63,14 @@ Raster<PixelT>::Raster (const Size &size)
|
||||
setSize (size);
|
||||
}
|
||||
|
||||
template<typename PixelT>
|
||||
inline
|
||||
Raster<PixelT>::Raster (const Raster &raster, const Rect &tile)
|
||||
: size (tile.width, tile.height),
|
||||
pixels () {
|
||||
tile.cpToTile (raster.size, &raster.pixels[0], pixels);
|
||||
}
|
||||
|
||||
template<typename PixelT>
|
||||
inline
|
||||
Raster<PixelT>::~Raster () {
|
||||
|
0
include/QuadTree/QuadTreeBuilder.hpp
Normal file → Executable file
0
include/QuadTree/QuadTreeBuilder.hpp
Normal file → Executable file
2
include/Tree.hpp
Normal file → Executable file
2
include/Tree.hpp
Normal file → Executable file
@ -72,7 +72,7 @@ namespace otb {
|
||||
void resize (const DimSideImg &width, const DimSideImg &height);
|
||||
|
||||
// Setter for nodeCount and size
|
||||
inline void setNodeCount (const DimImg &newNodeCount);
|
||||
inline void setNodeCount (const DimNodeId &newNodeCount);
|
||||
inline void setSize (const Size &newSize);
|
||||
|
||||
inline unsigned int getCoreCount () const;
|
||||
|
0
include/Tree.tpp
Normal file → Executable file
0
include/Tree.tpp
Normal file → Executable file
7
include/TreeBuilder.hpp
Normal file → Executable file
7
include/TreeBuilder.hpp
Normal file → Executable file
@ -18,13 +18,14 @@ namespace otb {
|
||||
// Used to set the attributes below with the tree
|
||||
inline void setTreeSize (Tree &tree, const Size &size);
|
||||
inline void getTranscient (Tree &tree);
|
||||
inline DimNodeId getCompCount () const;
|
||||
inline DimImg getCompCount () const;
|
||||
inline void setNodeCount (Tree &tree, DimNodeId nodeCount);
|
||||
|
||||
// Attributes corresponding to the tree, used to make the construction easier
|
||||
DimImg leafCount, nodeCount;
|
||||
DimImg leafCount;
|
||||
DimNodeId nodeCount;
|
||||
/*! Pointers on the parents of each leafs / nodes */
|
||||
DimNodeId *leafParents, *compParents;
|
||||
DimImg *leafParents, *compParents;
|
||||
|
||||
/*! Pointers on the children and count how many children a parents have */
|
||||
DimNodeId *children, *childrenStart;
|
||||
|
2
include/TreeBuilder.tpp
Normal file → Executable file
2
include/TreeBuilder.tpp
Normal file → Executable file
@ -35,7 +35,7 @@ TreeBuilder::getTranscient (Tree &tree) {
|
||||
childrenStart = &tree.childrenStart[0];
|
||||
}
|
||||
|
||||
inline DimNodeId
|
||||
inline DimImg
|
||||
TreeBuilder::getCompCount () const {
|
||||
return nodeCount-leafCount;
|
||||
}
|
||||
|
3
include/TreeStats.hpp
Normal file → Executable file
3
include/TreeStats.hpp
Normal file → Executable file
@ -32,7 +32,10 @@ namespace otb {
|
||||
enum TimeType {
|
||||
buildTreeStats,
|
||||
buildSetupStats,
|
||||
buildToTilesStats,
|
||||
buildEdgesStats,
|
||||
buildParentsStats,
|
||||
buildFromTilesStats,
|
||||
buildMergeStats,
|
||||
buildIndexStats,
|
||||
buildCompressStats,
|
||||
|
0
include/TreeStats.tpp
Normal file → Executable file
0
include/TreeStats.tpp
Normal file → Executable file
0
include/XMLTree/XMLTreeBuilder.hpp
Normal file → Executable file
0
include/XMLTree/XMLTreeBuilder.hpp
Normal file → Executable file
48
include/triskeleBase.hpp
Normal file → Executable file
48
include/triskeleBase.hpp
Normal file → Executable file
@ -3,10 +3,13 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cstdint>
|
||||
|
||||
#include "triskeleDebug.hpp"
|
||||
|
||||
#define DimImg_MAX UINT32_MAX
|
||||
|
||||
namespace triskele {
|
||||
@ -28,44 +31,55 @@ namespace triskele {
|
||||
/*! Compte le nombre de bits utilisés pour chaque nombre : bitCount[nombre] = nombre de bits*/
|
||||
extern int bitCount[];
|
||||
|
||||
struct Point {
|
||||
DimSideImg x, y;
|
||||
inline Point ();
|
||||
inline Point (const DimSideImg &abs, const DimSideImg &ord);
|
||||
};
|
||||
inline bool operator== (const Point &p1, const Point &p2);
|
||||
inline ostream &operator << (ostream &out, const Point &p);
|
||||
extern Point NullPoint;
|
||||
|
||||
struct Size {
|
||||
DimSideImg width, height;
|
||||
|
||||
inline Size ();
|
||||
inline Size (const Size &size);
|
||||
inline Size (const DimSideImg &w, const DimSideImg &h);
|
||||
};
|
||||
inline bool operator== (const Size &s1, const Size &s2);
|
||||
inline ostream &operator << (ostream &out, const Size &s);
|
||||
extern Size NullSize;
|
||||
|
||||
inline DimImg pointToId (const Size &size, const Point &p);
|
||||
inline Point idToPoint (const Size &size, const DimImg &id);
|
||||
struct Point {
|
||||
DimSideImg x, y;
|
||||
|
||||
inline Point ();
|
||||
inline Point (const DimSideImg &abs, const DimSideImg &ord);
|
||||
inline Point (const Size &size, const DimImg &idx);
|
||||
};
|
||||
inline bool operator== (const Point &p1, const Point &p2);
|
||||
inline ostream &operator << (ostream &out, const Point &p);
|
||||
extern Point NullPoint;
|
||||
|
||||
/*! Convertit un point d'un tableau (on peut imaginer une image à 2 dimension) en un index */
|
||||
inline DimImg point2idx (const Size &size, const Point &p);
|
||||
inline DimImg point2idx (const Size &size, const Point &tileOrig, const Point &p);
|
||||
inline DimImg idxTile2idxRect (const Size &tileSize, const DimImg &tileIdx, const Size &rectSize, const DimImg tileOrig);
|
||||
|
||||
struct Rect {
|
||||
DimSideImg x, y, width, height;
|
||||
|
||||
inline Rect ();
|
||||
inline Rect (const Rect &rect);
|
||||
inline Rect (const Point &orig, const Size &size);
|
||||
inline Rect (const DimSideImg &abs, const DimSideImg &ord, const DimSideImg &w, const DimSideImg &h);
|
||||
|
||||
inline DimImg relIdx (const Point &absPos) const;
|
||||
inline DimImg absIdx (const DimImg &relIdx, const Size &rectSize) const;
|
||||
|
||||
template<typename T>
|
||||
inline void cpToTile (const Size &size, const T *src, vector<T> &dst) const;
|
||||
template<typename T>
|
||||
inline void cpFromTile (const Size &size, const vector<T> &src, T *dst) const;
|
||||
template<typename T>
|
||||
inline void cpFromTileMove (const Size &size, const vector<T> &src, T *dst, const T &move) const;
|
||||
};
|
||||
inline bool operator== (const Rect &r1, const Rect &r2);
|
||||
inline ostream &operator << (ostream &out, const Rect &r);
|
||||
extern Rect NullRect;
|
||||
|
||||
/*! Convertit un point d'un tableau (on peut imaginer une image à 2 dimension) en un index */
|
||||
inline DimImg point2idx (const Size &size, const Point &p);
|
||||
|
||||
/*! Convertit un index d'un tableau (on peut imaginer une image à 2 dimension) en point correspondant à des coordonnées */
|
||||
inline Point idx2point (const Size &size, const DimImg &idx);
|
||||
|
||||
static const DimSideImg printMapMaxSide = 25;
|
||||
|
||||
/*! Affiche le contenu d'un tableau en spécifiant sa taille */
|
||||
|
126
include/triskeleBase.tpp
Normal file → Executable file
126
include/triskeleBase.tpp
Normal file → Executable file
@ -1,35 +1,18 @@
|
||||
#ifndef _OTB_TRISKELE_BASE_TPP
|
||||
#define _OTB_TRISKELE_BASE_TPP
|
||||
|
||||
|
||||
inline
|
||||
Point::Point ()
|
||||
: x (0),
|
||||
y (0) {
|
||||
}
|
||||
|
||||
inline
|
||||
Point::Point (const DimSideImg &abs, const DimSideImg &ord)
|
||||
: x (abs),
|
||||
y (ord) {
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator== (const Point &p1, const Point &p2) {
|
||||
return p1.x == p2.x && p1.y == p2.y;
|
||||
}
|
||||
|
||||
inline ostream &
|
||||
operator << (ostream &out, const Point &p) {
|
||||
return out << "(" << p.x << "," << p.y << ")";
|
||||
}
|
||||
|
||||
inline
|
||||
Size::Size ()
|
||||
: width (0),
|
||||
height (0) {
|
||||
}
|
||||
|
||||
inline
|
||||
Size::Size (const Size &size)
|
||||
: width (size.width),
|
||||
height (size.height) {
|
||||
}
|
||||
|
||||
inline
|
||||
Size::Size (const DimSideImg &w, const DimSideImg &h)
|
||||
: width (w),
|
||||
@ -46,14 +29,36 @@ operator << (ostream &out, const Size &s) {
|
||||
return out << "[" << s.width << "," << s.height << "]";
|
||||
}
|
||||
|
||||
inline DimImg
|
||||
pointToId (const Size &size, const Point &p) {
|
||||
return (DimImg)p.x + (DimImg)p.y * size.width;
|
||||
inline
|
||||
Point::Point ()
|
||||
: x (0),
|
||||
y (0) {
|
||||
}
|
||||
|
||||
inline Point
|
||||
idToPoint (const Size &size, const DimImg &id) {
|
||||
return Point(id % size.width, id / size.width);
|
||||
inline
|
||||
Point::Point (const DimSideImg &abs, const DimSideImg &ord)
|
||||
: x (abs),
|
||||
y (ord) {
|
||||
}
|
||||
|
||||
inline
|
||||
Point::Point (const Size &size, const DimImg &idx)
|
||||
: x (idx % size.width),
|
||||
y (idx / size.width) {
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator== (const Point &p1, const Point &p2) {
|
||||
return p1.x == p2.x && p1.y == p2.y;
|
||||
}
|
||||
|
||||
inline ostream &
|
||||
operator << (ostream &out, const Point &p) {
|
||||
return out << "(" << p.x << "," << p.y << ")";
|
||||
}
|
||||
|
||||
inline DimImg point2idx (const Size &size, const Point &p) {
|
||||
return DimImg (p.x) + DimImg (p.y)*DimImg (size.width);
|
||||
}
|
||||
|
||||
inline
|
||||
@ -88,6 +93,60 @@ Rect::Rect (const DimSideImg &abs, const DimSideImg &ord, const DimSideImg &w, c
|
||||
height (h) {
|
||||
}
|
||||
|
||||
inline DimImg
|
||||
Rect::relIdx (const Point &p) const {
|
||||
return DimImg (p.x-x) + DimImg (p.y-y)*DimImg (width);
|
||||
}
|
||||
inline DimImg
|
||||
Rect::absIdx (const DimImg &relIdx, const Size &rectSize) const {
|
||||
return (relIdx % width)+x + ((relIdx / width)+y)*rectSize.width;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void
|
||||
Rect::cpToTile (const Size &size, const T* src, vector<T> &dst) const {
|
||||
// XXX no border
|
||||
//SMART_DEF_LOG ("Rect::cpToTile", "rectSize:" << size);
|
||||
const DimImg maxCount = width*height;
|
||||
dst.resize (maxCount);
|
||||
for (DimImg idx = 0; idx < maxCount; ++idx) {
|
||||
dst [idx] = src [absIdx (idx, size)];
|
||||
//SMART_LOG ("idx:" << idx << " abs:" << absIdx (idx, size));
|
||||
}
|
||||
// SMART_LOG ("tile:"<< *this << " src/dst:" << endl
|
||||
// << printMap (src, size, 0) << endl
|
||||
// << printMap (&dst[0], Size (width, height), 0));
|
||||
}
|
||||
template<typename T>
|
||||
inline void
|
||||
Rect::cpFromTile (const Size &size, const vector<T> &src, T *dst) const {
|
||||
// XXX no border
|
||||
const DimImg maxCount = width*height;
|
||||
//SMART_DEF_LOG ("Rect::cpFromTile", "rectSize:" << size);
|
||||
for (DimImg idx = 0; idx < maxCount; ++idx) {
|
||||
dst [absIdx (idx, size)] = src [idx];
|
||||
//SMART_LOG ("idx:" << idx << " abs:" << absIdx (idx, size));
|
||||
}
|
||||
// SMART_LOG ("tile:"<< *this << " src/dst:" << endl
|
||||
// << printMap (&src[0], Size (width, height), 0) << endl
|
||||
// << printMap (dst, size, 0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void
|
||||
Rect::cpFromTileMove (const Size &size, const vector<T> &src, T *dst, const T &move) const {
|
||||
// XXX no border
|
||||
const DimImg maxCount = width*height;
|
||||
DEF_LOG ("Rect::cpFromTileTrans", "rectSize:" << size << " move:" << move);
|
||||
for (DimImg idx = 0; idx < maxCount; ++idx) {
|
||||
dst [absIdx (idx, size)] = src [idx] + move;
|
||||
//LOG ("idx:" << idx << " abs:" << absIdx (idx, size));
|
||||
}
|
||||
SMART_LOG ("tile:"<< *this << " src/dst:" << endl
|
||||
<< printMap (&src[0], Size (width, height), 0) << endl
|
||||
<< printMap (dst, size, 0));
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator== (const Rect &r1, const Rect &r2) {
|
||||
return r1.x == r2.x && r1.y == r2.y && r1.width == r2.width && r1.height == r2.height;
|
||||
@ -98,15 +157,6 @@ operator << (ostream &out, const Rect &r) {
|
||||
return out << "[" << r.x << "," << r.y << " " << r.width << "x" << r.height << "]";
|
||||
}
|
||||
|
||||
inline DimImg point2idx (const Size &size, const Point &p) {
|
||||
return DimImg (p.x) + DimImg (p.y)*DimImg (size.width);
|
||||
}
|
||||
|
||||
inline Point
|
||||
idx2point (const Size &size, const DimImg &idx) {
|
||||
return Point (idx % size.width, idx / size.width);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename T>
|
||||
inline
|
||||
|
0
include/triskeleDealThreads.hpp
Normal file → Executable file
0
include/triskeleDealThreads.hpp
Normal file → Executable file
0
include/triskeleDealThreads.tpp
Normal file → Executable file
0
include/triskeleDealThreads.tpp
Normal file → Executable file
2
include/triskeleDebug.hpp
Normal file → Executable file
2
include/triskeleDebug.hpp
Normal file → Executable file
@ -18,7 +18,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef SMART_LOG_EXPR
|
||||
#define SMART_LOG_EXPR(expr) {if (triskele::debug) expr; }
|
||||
#define SMART_LOG_EXPR(expr) {if (triskele::debug) {expr;} }
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
0
include/triskeleGdalGetType.hpp
Normal file → Executable file
0
include/triskeleGdalGetType.hpp
Normal file → Executable file
0
otb-module.cmake
Normal file → Executable file
0
otb-module.cmake
Normal file → Executable file
6
src/Appli/Option.cpp
Normal file → Executable file
6
src/Appli/Option.cpp
Normal file → Executable file
@ -1,4 +1,4 @@
|
||||
#define LAST_VERSION "2018-03-07 (Debian Stretch)"
|
||||
#define LAST_VERSION "2018-03-29 (Debian Stretch)"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
@ -123,6 +123,10 @@ Option::parse (int argc, char** argv) {
|
||||
("tree-core-count", po::value<unsigned int> (&coreCount), "thread used to build tree (default hardware value)")
|
||||
("one-band", po::bool_switch (&oneBand), "split all bands, one band per image")
|
||||
|
||||
("counting-sort", po::value<size_t> (&countingSortCeil),
|
||||
string ("force counting sort under ceil (default: "+
|
||||
boost::lexical_cast<std::string> (countingSortCeil)+") (n.b. value in [0..2^16] => 300MB!)").c_str ())
|
||||
|
||||
// ("no-border", po::bool_switch (&options.noBorder), "build tree with all pixels (included no-data)")
|
||||
// ("dap", po::bool_switch (&options.dapFlag), "produce DAP rather than AP")
|
||||
// ("use-all-orig", po::bool_switch (&options.useAllOrigFlag), "force use all original band")
|
||||
|
0
src/Appli/Selected.cpp
Normal file → Executable file
0
src/Appli/Selected.cpp
Normal file → Executable file
0
src/ArrayTree/triskeleArrayTreeBase.cpp
Normal file → Executable file
0
src/ArrayTree/triskeleArrayTreeBase.cpp
Normal file → Executable file
0
src/CMakeLists.txt
Normal file → Executable file
0
src/CMakeLists.txt
Normal file → Executable file
0
src/IImage.cpp
Normal file → Executable file
0
src/IImage.cpp
Normal file → Executable file
2
src/PerfArrayTreeBuilder.cpp
Normal file → Executable file
2
src/PerfArrayTreeBuilder.cpp
Normal file → Executable file
@ -71,7 +71,7 @@ main (int argc, char **argv, char **envp) {
|
||||
const size_t w = card/h;
|
||||
Size size (w, h);
|
||||
Border border (size, false);
|
||||
GraphWalker graphWalker (size, border);
|
||||
GraphWalker graphWalker (border);
|
||||
int leafCount = graphWalker.vertexMaxCount ();
|
||||
Raster<PixelT> raster (size);
|
||||
|
||||
|
0
src/QuadTree/QuadTreeBuilder.cpp
Normal file → Executable file
0
src/QuadTree/QuadTreeBuilder.cpp
Normal file → Executable file
2
src/TestArrayTreeBuilder.cpp
Normal file → Executable file
2
src/TestArrayTreeBuilder.cpp
Normal file → Executable file
@ -211,7 +211,7 @@ void test () {
|
||||
//Size size (18, 12);
|
||||
Size size (12, 8);
|
||||
Border border (size, false);
|
||||
GraphWalker graphWalker (size, border);
|
||||
GraphWalker graphWalker (border);
|
||||
int leafCount = graphWalker.vertexMaxCount ();
|
||||
|
||||
// ====================
|
||||
|
2
src/Tree.cpp
Normal file → Executable file
2
src/Tree.cpp
Normal file → Executable file
@ -172,7 +172,7 @@ Tree::compareTo (const Tree &tree, bool testChildren) const {
|
||||
void
|
||||
Tree::checkSpare () const {
|
||||
Border border; // default = no border
|
||||
GraphWalker graphWalker (size, border);
|
||||
GraphWalker graphWalker (border);
|
||||
vector<Rect> tiles;
|
||||
vector<Rect> boundaries;
|
||||
vector<bool> verticalBoundaries;
|
||||
|
15
src/TreeStats.cpp
Normal file → Executable file
15
src/TreeStats.cpp
Normal file → Executable file
@ -10,12 +10,15 @@ using namespace std;
|
||||
// ========================================
|
||||
static string timeTypeLabels [TimeTypeCard] = {
|
||||
"build tree",
|
||||
"build setup ",
|
||||
"build parents ",
|
||||
"build merge ",
|
||||
"build index ",
|
||||
"build compress ",
|
||||
"build children ",
|
||||
" setup ",
|
||||
" to tiles ",
|
||||
" sort edges ",
|
||||
" parents ",
|
||||
" from tiles ",
|
||||
" merge ",
|
||||
" index ",
|
||||
" compress ",
|
||||
" children ",
|
||||
"set AP",
|
||||
"area",
|
||||
"average",
|
||||
|
0
src/XMLTree/XMLTreeBuilder.cpp
Normal file → Executable file
0
src/XMLTree/XMLTreeBuilder.cpp
Normal file → Executable file
6
src/apGenerator.cpp
Normal file → Executable file
6
src/apGenerator.cpp
Normal file → Executable file
@ -66,8 +66,8 @@ void apGenerator (Option &option) {
|
||||
if (!treeTypesCard)
|
||||
cerr << "*** no tree type ! => copy mode" << endl;
|
||||
|
||||
Border border; // default = no border
|
||||
GraphWalker graphWalker (option.size, border);
|
||||
Border border (option.size, false); // default = no border
|
||||
GraphWalker graphWalker (border);
|
||||
DimImg leafCount = graphWalker.vertexMaxCount ();
|
||||
DimChanel maxThresholds = max (max (option.areaThresholds.size (), option.sdThresholds.size ()), option.moiThresholds.size ());
|
||||
vector <vector <PixelT> > allBands (maxThresholds, vector<PixelT> (leafCount, 0));
|
||||
@ -83,7 +83,7 @@ void apGenerator (Option &option) {
|
||||
writeBand (option, raster.getPixels (), chanel++);
|
||||
|
||||
for (TreeType treeType : treeTypes) {
|
||||
ArrayTreeBuilder<PixelT, PixelT> atb (raster, graphWalker, treeType);
|
||||
ArrayTreeBuilder<PixelT, PixelT> atb (raster, graphWalker, treeType, option.countingSortCeil);
|
||||
Tree tree (option.coreCount);
|
||||
WeightAttributes<PixelT> weightAttributes (tree);
|
||||
atb.buildTree (tree, weightAttributes);
|
||||
|
0
src/triskeleBase.cpp
Normal file → Executable file
0
src/triskeleBase.cpp
Normal file → Executable file
0
src/triskeleDebug.cpp
Normal file → Executable file
0
src/triskeleDebug.cpp
Normal file → Executable file
Loading…
Reference in New Issue
Block a user