modifié : MakefileNoOTB
modifié : include/ArrayTree/ArrayTreeBuilder.hpp modifié : include/ArrayTree/ArrayTreeBuilder.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/XYAttributes.hpp modifié : include/Attributes/XYAttributes.tpp modifié : src/apGenerator.cpp
This commit is contained in:
parent
db7037f624
commit
77c4b5fd0b
@ -53,9 +53,9 @@ apGenerator: $(TST_OUT)
|
|||||||
|
|
||||||
## DEPENDS #############################
|
## DEPENDS #############################
|
||||||
ALL_OUT = $(TST_OUT)
|
ALL_OUT = $(TST_OUT)
|
||||||
ALL_OBJ = $(OBJ_DIR)/IImage.o $(OBJ_DIR)/triskeleArrayTreeBase.o $(OBJ_DIR)/Tree.o $(OBJ_DIR)/triskeleDebug.o $(OBJ_DIR)/triskeleBase.o $(OBJ_DIR)/QuadTreeBuilder.o $(OBJ_DIR)/Option.o $(OBJ_DIR)/Selected.o
|
ALL_OBJ = $(OBJ_DIR)/IImage.o $(OBJ_DIR)/triskeleArrayTreeBase.o $(OBJ_DIR)/Tree.o $(OBJ_DIR)/triskeleDebug.o $(OBJ_DIR)/TreeStats.o $(OBJ_DIR)/triskeleBase.o $(OBJ_DIR)/QuadTreeBuilder.o $(OBJ_DIR)/Option.o $(OBJ_DIR)/Selected.o
|
||||||
|
|
||||||
ALL_OBJ_XML = $(OBJ_DIR)/IImage.o $(OBJ_DIR)/triskeleArrayTreeBase.o $(OBJ_DIR)/Tree.o $(OBJ_DIR)/triskeleDebug.o $(OBJ_DIR)/triskeleBase.o $(OBJ_DIR)/QuadTreeBuilder.o $(OBJ_DIR)/XMLTreeBuilder.o $(OBJ_DIR)/Option.o $(OBJ_DIR)/Selected.o
|
ALL_OBJ_XML = $(OBJ_DIR)/IImage.o $(OBJ_DIR)/triskeleArrayTreeBase.o $(OBJ_DIR)/Tree.o $(OBJ_DIR)/triskeleDebug.o $(OBJ_DIR)/TreeStats.o $(OBJ_DIR)/triskeleBase.o $(OBJ_DIR)/QuadTreeBuilder.o $(OBJ_DIR)/XMLTreeBuilder.o $(OBJ_DIR)/Option.o $(OBJ_DIR)/Selected.o
|
||||||
|
|
||||||
DEPENDS = ${ALL_OUT:=.d} ${ALL_OBJ:.o=.d}
|
DEPENDS = ${ALL_OUT:=.d} ${ALL_OBJ:.o=.d}
|
||||||
-include ${DEPENDS}
|
-include ${DEPENDS}
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#endif // ENABLE_LOG
|
#endif // ENABLE_LOG
|
||||||
|
|
||||||
|
#include <boost/chrono.hpp>
|
||||||
|
|
||||||
#include "triskeleDebug.hpp"
|
#include "triskeleDebug.hpp"
|
||||||
#include "triskeleSort.hpp"
|
#include "triskeleSort.hpp"
|
||||||
#include "triskeleDealThreads.hpp"
|
#include "triskeleDealThreads.hpp"
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_ARRAY_TREE_BUILDER_TPP
|
#ifndef _OTB_TRISKELE_ARRAY_TREE_BUILDER_TPP
|
||||||
#define _OTB_TRISKELE_ARRAY_TREE_BUILDER_TPP
|
#define _OTB_TRISKELE_ARRAY_TREE_BUILDER_TPP
|
||||||
|
|
||||||
|
using namespace boost::chrono;
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
template<typename WeightT, typename PixelT>
|
template<typename WeightT, typename PixelT>
|
||||||
inline
|
inline
|
||||||
@ -37,6 +39,7 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, WeightAttributes<Weigh
|
|||||||
newCompId = leaders.getLeaders ();
|
newCompId = leaders.getLeaders ();
|
||||||
compWeights = weightAttributes.getValues ();
|
compWeights = weightAttributes.getValues ();
|
||||||
|
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MIN:
|
case MIN:
|
||||||
buildTree (tree, MinWeight<PixelT, WeightT> (raster.getPixels (), raster.getSize ()));
|
buildTree (tree, MinWeight<PixelT, WeightT> (raster.getPixels (), raster.getSize ()));
|
||||||
@ -50,6 +53,9 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, WeightAttributes<Weigh
|
|||||||
default:
|
default:
|
||||||
cerr << "*** unknown tree type: " << type << endl;
|
cerr << "*** unknown tree type: " << type << endl;
|
||||||
}
|
}
|
||||||
|
globalTreeStats.addTime (buildTreeStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
|
globalTreeStats.addDim ((treeType) type, leafCount, nodeCount-leafCount);
|
||||||
|
|
||||||
weightAttributes.setWeightBounds (tree);
|
weightAttributes.setWeightBounds (tree);
|
||||||
leaders.free ();
|
leaders.free ();
|
||||||
newCompId = nullptr;
|
newCompId = nullptr;
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_AREA_ATTRIBUTES_HPP
|
#ifndef _OTB_TRISKELE_AREA_ATTRIBUTES_HPP
|
||||||
#define _OTB_TRISKELE_AREA_ATTRIBUTES_HPP
|
#define _OTB_TRISKELE_AREA_ATTRIBUTES_HPP
|
||||||
|
|
||||||
|
#include <boost/chrono.hpp>
|
||||||
|
|
||||||
#include "triskeleBase.hpp"
|
#include "triskeleBase.hpp"
|
||||||
#include "CompAttribute.hpp"
|
#include "CompAttribute.hpp"
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
|
#ifndef _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
|
||||||
#define _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
|
||||||
|
|
||||||
|
using namespace boost::chrono;
|
||||||
|
|
||||||
inline
|
inline
|
||||||
AreaAttributes::AreaAttributes (const Tree &tree)
|
AreaAttributes::AreaAttributes (const Tree &tree)
|
||||||
: CompAttributeC<DimImg> (tree) {
|
: CompAttributeC<DimImg> (tree) {
|
||||||
@ -15,11 +17,14 @@ template<typename PixelT>
|
|||||||
inline void
|
inline void
|
||||||
AreaAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
|
AreaAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
|
||||||
const vector<DimImg> &thresholds) const {
|
const vector<DimImg> &thresholds) const {
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
CompAttributeC<DimImg>::cut (allBands, attributeProfiles, 1, thresholds);
|
CompAttributeC<DimImg>::cut (allBands, attributeProfiles, 1, thresholds);
|
||||||
|
globalTreeStats.addTime (filteringStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
AreaAttributes::compute () {
|
AreaAttributes::compute () {
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
computeSameCompLevel ([this] (const DimImg &parentId) {
|
computeSameCompLevel ([this] (const DimImg &parentId) {
|
||||||
DimImg area = 0;
|
DimImg area = 0;
|
||||||
tree.forEachChildTI (parentId, [this, &area] (const bool &isLeaf, const DimImg &childId) {
|
tree.forEachChildTI (parentId, [this, &area] (const bool &isLeaf, const DimImg &childId) {
|
||||||
@ -27,6 +32,7 @@ AreaAttributes::compute () {
|
|||||||
});
|
});
|
||||||
CompAttribute<DimImg>::values [parentId] = area;
|
CompAttribute<DimImg>::values [parentId] = area;
|
||||||
});
|
});
|
||||||
|
globalTreeStats.addTime (areaStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
|
#endif // _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_AVERAGE_ATTRIBUTES_HPP
|
#ifndef _OTB_TRISKELE_AVERAGE_ATTRIBUTES_HPP
|
||||||
#define _OTB_TRISKELE_AVERAGE_ATTRIBUTES_HPP
|
#define _OTB_TRISKELE_AVERAGE_ATTRIBUTES_HPP
|
||||||
|
|
||||||
|
#include <boost/chrono.hpp>
|
||||||
|
|
||||||
#include "triskeleBase.hpp"
|
#include "triskeleBase.hpp"
|
||||||
#include "CompAttribute.hpp"
|
#include "CompAttribute.hpp"
|
||||||
#include "Attributes/AreaAttributes.hpp"
|
#include "Attributes/AreaAttributes.hpp"
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_AVERAGE_ATTRIBUTES_TPP
|
#ifndef _OTB_TRISKELE_AVERAGE_ATTRIBUTES_TPP
|
||||||
#define _OTB_TRISKELE_AVERAGE_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_AVERAGE_ATTRIBUTES_TPP
|
||||||
|
|
||||||
|
using namespace boost::chrono;
|
||||||
|
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline
|
inline
|
||||||
AverageAttributes::AverageAttributes (const Tree &tree, const Raster<PixelT> &raster, const AreaAttributes &areaAttributes)
|
AverageAttributes::AverageAttributes (const Tree &tree, const Raster<PixelT> &raster, const AreaAttributes &areaAttributes)
|
||||||
@ -15,6 +17,7 @@ AverageAttributes::~AverageAttributes () {
|
|||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline void
|
inline void
|
||||||
AverageAttributes::compute (const Raster<PixelT> &raster, const AreaAttributes &areaAttributes) {
|
AverageAttributes::compute (const Raster<PixelT> &raster, const AreaAttributes &areaAttributes) {
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
const PixelT *pixels = raster.getPixels ();
|
const PixelT *pixels = raster.getPixels ();
|
||||||
const DimImg *areas = areaAttributes.getValues ();
|
const DimImg *areas = areaAttributes.getValues ();
|
||||||
computeSameCompLevel ([this, &pixels, &areas] (const DimImg &parentId) {
|
computeSameCompLevel ([this, &pixels, &areas] (const DimImg &parentId) {
|
||||||
@ -24,6 +27,7 @@ AverageAttributes::compute (const Raster<PixelT> &raster, const AreaAttributes &
|
|||||||
});
|
});
|
||||||
CompAttribute<double>::values [parentId] = tmpAverage/areas[parentId];
|
CompAttribute<double>::values [parentId] = tmpAverage/areas[parentId];
|
||||||
});
|
});
|
||||||
|
globalTreeStats.addTime (averageStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _OTB_TRISKELE_AVERAGE_ATTRIBUTES_TPP
|
#endif // _OTB_TRISKELE_AVERAGE_ATTRIBUTES_TPP
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_MOI_ATTRIBUTES_HPP
|
#ifndef _OTB_TRISKELE_MOI_ATTRIBUTES_HPP
|
||||||
#define _OTB_TRISKELE_MOI_ATTRIBUTES_HPP
|
#define _OTB_TRISKELE_MOI_ATTRIBUTES_HPP
|
||||||
|
|
||||||
|
#include <boost/chrono.hpp>
|
||||||
|
|
||||||
#include "triskeleBase.hpp"
|
#include "triskeleBase.hpp"
|
||||||
#include "CompAttribute.hpp"
|
#include "CompAttribute.hpp"
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_MOI_ATTRIBUTES_TPP
|
#ifndef _OTB_TRISKELE_MOI_ATTRIBUTES_TPP
|
||||||
#define _OTB_TRISKELE_MOI_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_MOI_ATTRIBUTES_TPP
|
||||||
|
|
||||||
|
using namespace boost::chrono;
|
||||||
|
|
||||||
inline
|
inline
|
||||||
MoIAttributes::MoIAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes)
|
MoIAttributes::MoIAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes)
|
||||||
: CompAttributeC<double> (tree) {
|
: CompAttributeC<double> (tree) {
|
||||||
@ -18,14 +20,17 @@ MoIAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<P
|
|||||||
DEF_LOG ("MoIAttributes::cut", "thresholds:" << thresholds.size ());
|
DEF_LOG ("MoIAttributes::cut", "thresholds:" << thresholds.size ());
|
||||||
if (!thresholds.size ())
|
if (!thresholds.size ())
|
||||||
return;
|
return;
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
double maxValue = CompAttribute<double>::getMaxValue ();
|
double maxValue = CompAttribute<double>::getMaxValue ();
|
||||||
cerr << "moi max value:" << maxValue << endl;
|
cerr << "moi max value:" << maxValue << endl;
|
||||||
CompAttributeC<double>::cut (allBands, attributeProfiles, 0,
|
CompAttributeC<double>::cut (allBands, attributeProfiles, 0,
|
||||||
CompAttributeC<double>::getScaledThresholds (thresholds, maxValue));
|
CompAttributeC<double>::getScaledThresholds (thresholds, maxValue));
|
||||||
|
globalTreeStats.addTime (filteringStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
MoIAttributes::compute (const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes) {
|
MoIAttributes::compute (const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes) {
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
const AverageXY *xy = xyAttributes.getValues ();
|
const AverageXY *xy = xyAttributes.getValues ();
|
||||||
const DimImg *areas = areaAttributes.getValues ();
|
const DimImg *areas = areaAttributes.getValues ();
|
||||||
computeSameCompLevel ([this, &xy, &areas] (const DimImg &parentId) {
|
computeSameCompLevel ([this, &xy, &areas] (const DimImg &parentId) {
|
||||||
@ -42,6 +47,7 @@ MoIAttributes::compute (const AreaAttributes &areaAttributes, const XYAttributes
|
|||||||
const double card = areas[parentId];
|
const double card = areas[parentId];
|
||||||
CompAttribute<double>::values[parentId] = tmpMoI/(card*card);
|
CompAttribute<double>::values[parentId] = tmpMoI/(card*card);
|
||||||
});
|
});
|
||||||
|
globalTreeStats.addTime (moiStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _OTB_TRISKELE_MOI_ATTRIBUTES_TPP
|
#endif // _OTB_TRISKELE_MOI_ATTRIBUTES_TPP
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_SD_ATTRIBUTES_HPP
|
#ifndef _OTB_TRISKELE_SD_ATTRIBUTES_HPP
|
||||||
#define _OTB_TRISKELE_SD_ATTRIBUTES_HPP
|
#define _OTB_TRISKELE_SD_ATTRIBUTES_HPP
|
||||||
|
|
||||||
|
#include <boost/chrono.hpp>
|
||||||
|
|
||||||
#include "triskeleDebug.hpp"
|
#include "triskeleDebug.hpp"
|
||||||
#include "triskeleBase.hpp"
|
#include "triskeleBase.hpp"
|
||||||
#include "CompAttribute.hpp"
|
#include "CompAttribute.hpp"
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_SD_ATTRIBUTES_TPP
|
#ifndef _OTB_TRISKELE_SD_ATTRIBUTES_TPP
|
||||||
#define _OTB_TRISKELE_SD_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_SD_ATTRIBUTES_TPP
|
||||||
|
|
||||||
|
using namespace boost::chrono;
|
||||||
|
|
||||||
inline
|
inline
|
||||||
SDAttributes::SDAttributes (const Tree &tree, const AreaAttributes &areaAttributes)
|
SDAttributes::SDAttributes (const Tree &tree, const AreaAttributes &areaAttributes)
|
||||||
: CompAttributeC<double> (tree) {
|
: CompAttributeC<double> (tree) {
|
||||||
@ -18,14 +20,17 @@ SDAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<Pi
|
|||||||
DEF_LOG ("SDAttributes::cut", "thresholds:" << thresholds.size ());
|
DEF_LOG ("SDAttributes::cut", "thresholds:" << thresholds.size ());
|
||||||
if (!thresholds.size ())
|
if (!thresholds.size ())
|
||||||
return;
|
return;
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
double maxValue = CompAttribute<double>::getMaxValue ();
|
double maxValue = CompAttribute<double>::getMaxValue ();
|
||||||
cerr << "sd max value:" << maxValue << endl;
|
cerr << "sd max value:" << maxValue << endl;
|
||||||
CompAttributeC<double>::cut (allBands, attributeProfiles, 0,
|
CompAttributeC<double>::cut (allBands, attributeProfiles, 0,
|
||||||
CompAttributeC<double>::getScaledThresholds (thresholds, maxValue));
|
CompAttributeC<double>::getScaledThresholds (thresholds, maxValue));
|
||||||
|
globalTreeStats.addTime (filteringStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
SDAttributes::compute (const AreaAttributes &areaAttributes) {
|
SDAttributes::compute (const AreaAttributes &areaAttributes) {
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
const DimImg *areas = areaAttributes.getValues ();
|
const DimImg *areas = areaAttributes.getValues ();
|
||||||
computeSameCompLevel ([this, &areas] (const DimImg &parentId) {
|
computeSameCompLevel ([this, &areas] (const DimImg &parentId) {
|
||||||
double tmpSD = 0.;
|
double tmpSD = 0.;
|
||||||
@ -40,6 +45,7 @@ SDAttributes::compute (const AreaAttributes &areaAttributes) {
|
|||||||
// XXX on peut virer pour gagner du temps et calculer SD*SD
|
// XXX on peut virer pour gagner du temps et calculer SD*SD
|
||||||
CompAttribute<double>::values[parentId] = sqrt (CompAttribute<double>::values[parentId]);
|
CompAttribute<double>::values[parentId] = sqrt (CompAttribute<double>::values[parentId]);
|
||||||
});
|
});
|
||||||
|
globalTreeStats.addTime (sdStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _OTB_TRISKELE_SD_ATTRIBUTES_TPP
|
#endif // _OTB_TRISKELE_SD_ATTRIBUTES_TPP
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_XY_ATTRIBUTES_HPP
|
#ifndef _OTB_TRISKELE_XY_ATTRIBUTES_HPP
|
||||||
#define _OTB_TRISKELE_XY_ATTRIBUTES_HPP
|
#define _OTB_TRISKELE_XY_ATTRIBUTES_HPP
|
||||||
|
|
||||||
|
#include <boost/chrono.hpp>
|
||||||
|
|
||||||
#include "triskeleBase.hpp"
|
#include "triskeleBase.hpp"
|
||||||
#include "CompAttribute.hpp"
|
#include "CompAttribute.hpp"
|
||||||
#include "Attributes/AreaAttributes.hpp"
|
#include "Attributes/AreaAttributes.hpp"
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef _OTB_TRISKELE_XY_ATTRIBUTES_TPP
|
#ifndef _OTB_TRISKELE_XY_ATTRIBUTES_TPP
|
||||||
#define _OTB_TRISKELE_XY_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_XY_ATTRIBUTES_TPP
|
||||||
|
|
||||||
|
using namespace boost::chrono;
|
||||||
|
|
||||||
inline
|
inline
|
||||||
XYAttributes::XYAttributes (const Tree &tree, const AreaAttributes &areaAttributes)
|
XYAttributes::XYAttributes (const Tree &tree, const AreaAttributes &areaAttributes)
|
||||||
: CompAttributeC<AverageXY> (tree) {
|
: CompAttributeC<AverageXY> (tree) {
|
||||||
@ -13,6 +15,7 @@ XYAttributes::~XYAttributes () {
|
|||||||
|
|
||||||
inline void
|
inline void
|
||||||
XYAttributes::compute (const AreaAttributes &areaAttributes) {
|
XYAttributes::compute (const AreaAttributes &areaAttributes) {
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
DimImg const width = CompAttribute<AverageXY>::tree.getSize ().width;
|
DimImg const width = CompAttribute<AverageXY>::tree.getSize ().width;
|
||||||
const DimImg *areas = areaAttributes.getValues ();
|
const DimImg *areas = areaAttributes.getValues ();
|
||||||
computeSameCompLevel ([this, &width, &areas] (const DimImg &parentId) {
|
computeSameCompLevel ([this, &width, &areas] (const DimImg &parentId) {
|
||||||
@ -29,6 +32,7 @@ XYAttributes::compute (const AreaAttributes &areaAttributes) {
|
|||||||
CompAttribute<AverageXY>::values[parentId].x = tmpXY.x/areas[parentId];
|
CompAttribute<AverageXY>::values[parentId].x = tmpXY.x/areas[parentId];
|
||||||
CompAttribute<AverageXY>::values[parentId].y = tmpXY.y/areas[parentId];
|
CompAttribute<AverageXY>::values[parentId].y = tmpXY.y/areas[parentId];
|
||||||
});
|
});
|
||||||
|
globalTreeStats.addTime (xyStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _OTB_TRISKELE_XY_ATTRIBUTES_TPP
|
#endif // _OTB_TRISKELE_XY_ATTRIBUTES_TPP
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
#include "triskeleBase.hpp"
|
#include "triskeleBase.hpp"
|
||||||
#include "Appli/Option.hpp"
|
#include "Appli/Option.hpp"
|
||||||
#include "Tree.hpp"
|
#include "Tree.hpp"
|
||||||
|
#include "TreeStats.hpp"
|
||||||
#include "TreeBuilder.hpp"
|
#include "TreeBuilder.hpp"
|
||||||
#include "QuadTree/QuadTreeBuilder.hpp"
|
#include "QuadTree/QuadTreeBuilder.hpp"
|
||||||
//#include "XMLTree/XMLTreeBuilder.hpp"
|
//#include "XMLTree/XMLTreeBuilder.hpp"
|
||||||
@ -33,13 +34,12 @@ using namespace otb::triskele::arrayTree;
|
|||||||
|
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline void
|
inline void
|
||||||
writeOneBand (Option &option, PixelT *pixels, DimChanel band) {
|
writeBand (Option &option, PixelT *pixels, DimChanel band) {
|
||||||
if (!option.oneBand) {
|
if (!option.oneBand) {
|
||||||
option.outputImage.writeBand (pixels, band);
|
option.outputImage.writeBand (pixels, band);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string outputBaseName = boost::filesystem::path (option.outputImage.getFileName ()).replace_extension ("").string ();
|
string outputBaseName = boost::filesystem::path (option.outputImage.getFileName ()).replace_extension ("").string ();
|
||||||
//boost::filesystem::basename (option.outputImage.getFileName ());
|
|
||||||
string outputExtension = boost::filesystem::extension (option.outputImage.getFileName ());
|
string outputExtension = boost::filesystem::extension (option.outputImage.getFileName ());
|
||||||
|
|
||||||
ostringstream fileNameStream;
|
ostringstream fileNameStream;
|
||||||
@ -79,7 +79,7 @@ void apGenerator (Option &option) {
|
|||||||
DimChanel chanel = 0;
|
DimChanel chanel = 0;
|
||||||
for (DimChanel band : option.selectedBand.getSet ()) {
|
for (DimChanel band : option.selectedBand.getSet ()) {
|
||||||
option.inputImage.readBand (raster, band, option.topLeft, option.size);
|
option.inputImage.readBand (raster, band, option.topLeft, option.size);
|
||||||
writeOneBand (option, raster.getPixels (), chanel++);
|
writeBand (option, raster.getPixels (), chanel++);
|
||||||
|
|
||||||
for (TreeType treeType : treeTypes) {
|
for (TreeType treeType : treeTypes) {
|
||||||
ArrayTreeBuilder<PixelT, PixelT> atb (raster, graphWalker, treeType);
|
ArrayTreeBuilder<PixelT, PixelT> atb (raster, graphWalker, treeType);
|
||||||
@ -93,25 +93,27 @@ void apGenerator (Option &option) {
|
|||||||
if (option.areaThresholds.size ()) {
|
if (option.areaThresholds.size ()) {
|
||||||
areaAttributes.cut (allBands, attributeProfiles, option.areaThresholds);
|
areaAttributes.cut (allBands, attributeProfiles, option.areaThresholds);
|
||||||
for (DimChanel c = 0; c < option.areaThresholds.size (); ++c, ++chanel)
|
for (DimChanel c = 0; c < option.areaThresholds.size (); ++c, ++chanel)
|
||||||
writeOneBand (option, &allBands[c][0], chanel);
|
writeBand (option, &allBands[c][0], chanel);
|
||||||
}
|
}
|
||||||
if (option.sdThresholds.size ()) {
|
if (option.sdThresholds.size ()) {
|
||||||
SDAttributes sdAttributes (tree, areaAttributes);
|
SDAttributes sdAttributes (tree, areaAttributes);
|
||||||
sdAttributes.cut (allBands, attributeProfiles, option.sdThresholds);
|
sdAttributes.cut (allBands, attributeProfiles, option.sdThresholds);
|
||||||
for (DimChanel c = 0; c < option.sdThresholds.size (); ++c, ++chanel)
|
for (DimChanel c = 0; c < option.sdThresholds.size (); ++c, ++chanel)
|
||||||
writeOneBand (option, &allBands[c][0], chanel);
|
writeBand (option, &allBands[c][0], chanel);
|
||||||
}
|
}
|
||||||
if (option.moiThresholds.size ()) {
|
if (option.moiThresholds.size ()) {
|
||||||
XYAttributes xyAttributes (tree, areaAttributes);
|
XYAttributes xyAttributes (tree, areaAttributes);
|
||||||
MoIAttributes moiAttributes (tree, areaAttributes, xyAttributes);
|
MoIAttributes moiAttributes (tree, areaAttributes, xyAttributes);
|
||||||
moiAttributes.cut (allBands, attributeProfiles, option.moiThresholds);
|
moiAttributes.cut (allBands, attributeProfiles, option.moiThresholds);
|
||||||
for (DimChanel c = 0; c < option.moiThresholds.size (); ++c, ++chanel)
|
for (DimChanel c = 0; c < option.moiThresholds.size (); ++c, ++chanel)
|
||||||
writeOneBand (option, &allBands[c][0], chanel);
|
writeBand (option, &allBands[c][0], chanel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr << endl << "*** apGenerator done!" << endl;
|
cerr << endl << "*** apGenerator done!" << endl;
|
||||||
|
globalTreeStats.printDim (cerr);
|
||||||
|
globalTreeStats.printTime (cerr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user