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é : include/CompAttribute.hpp modifié : include/CompAttribute.tpp modifié : include/IImage.hpp modifié : include/IImage.tpp modifié : include/Tree.hpp modifié : include/Tree.tpp modifié : src/Tree.cpp modifié : src/testMain.cpp
This commit is contained in:
parent
675b87e17e
commit
3d46f792d6
@ -23,7 +23,7 @@ namespace otb {
|
|||||||
template <typename WeightT, typename PixelT>
|
template <typename WeightT, typename PixelT>
|
||||||
class ArrayTreeBuilder : public TreeBuilder {
|
class ArrayTreeBuilder : public TreeBuilder {
|
||||||
protected:
|
protected:
|
||||||
const unsigned int coreCount;
|
unsigned int coreCount;
|
||||||
const Raster<PixelT> &raster;
|
const Raster<PixelT> &raster;
|
||||||
const GraphWalker &graphWalker;
|
const GraphWalker &graphWalker;
|
||||||
TreeType type;
|
TreeType type;
|
||||||
@ -35,8 +35,7 @@ namespace otb {
|
|||||||
DimImg *newCompId;
|
DimImg *newCompId;
|
||||||
WeightT *compWeights;
|
WeightT *compWeights;
|
||||||
public:
|
public:
|
||||||
inline ArrayTreeBuilder (const unsigned int &coreCount,
|
inline ArrayTreeBuilder (Raster<PixelT> &raster, const GraphWalker &graphWalker,
|
||||||
Raster<PixelT> &raster, const GraphWalker &graphWalker,
|
|
||||||
const TreeType &treeType, const bool &countingSort = true);
|
const TreeType &treeType, const bool &countingSort = true);
|
||||||
inline ~ArrayTreeBuilder ();
|
inline ~ArrayTreeBuilder ();
|
||||||
|
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
// ========================================
|
// ========================================
|
||||||
template<typename WeightT, typename PixelT>
|
template<typename WeightT, typename PixelT>
|
||||||
inline
|
inline
|
||||||
ArrayTreeBuilder<WeightT, PixelT>::ArrayTreeBuilder (const unsigned int &coreCount,
|
ArrayTreeBuilder<WeightT, PixelT>::ArrayTreeBuilder (Raster<PixelT> &raster, const GraphWalker &graphWalker,
|
||||||
Raster<PixelT> &raster, const GraphWalker &graphWalker,
|
|
||||||
const TreeType &treeType, const bool &countingSort) :
|
const TreeType &treeType, const bool &countingSort) :
|
||||||
coreCount (coreCount),
|
coreCount (boost::thread::hardware_concurrency ()),
|
||||||
raster (raster),
|
raster (raster),
|
||||||
graphWalker (graphWalker),
|
graphWalker (graphWalker),
|
||||||
type (treeType),
|
type (treeType),
|
||||||
@ -83,8 +82,7 @@ template<typename WeightFunct>
|
|||||||
inline void
|
inline void
|
||||||
ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &weightFunct) {
|
ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &weightFunct) {
|
||||||
DEF_LOG ("ArrayTreeBuilder::buildTree", "");
|
DEF_LOG ("ArrayTreeBuilder::buildTree", "");
|
||||||
|
coreCount = tree.getCoreCount ();
|
||||||
//XXX initWeights (graphWalker, weightFunct);
|
|
||||||
|
|
||||||
// buildParents
|
// buildParents
|
||||||
vector<Edge<WeightT> > allEdges (graphWalker.edgeMaxCount ());
|
vector<Edge<WeightT> > allEdges (graphWalker.edgeMaxCount ());
|
||||||
|
@ -9,7 +9,7 @@ namespace otb {
|
|||||||
|
|
||||||
class AreaAttributes : public CompAttributeC<DimImg> {
|
class AreaAttributes : public CompAttributeC<DimImg> {
|
||||||
public:
|
public:
|
||||||
inline AreaAttributes (const Tree &tree, const unsigned int &treeCoreCount);
|
inline AreaAttributes (const Tree &tree);
|
||||||
inline ~AreaAttributes ();
|
inline ~AreaAttributes ();
|
||||||
protected:
|
protected:
|
||||||
inline void compute ();
|
inline void compute ();
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
|
||||||
|
|
||||||
inline
|
inline
|
||||||
AreaAttributes::AreaAttributes (const Tree &tree, const unsigned int &treeCoreCount)
|
AreaAttributes::AreaAttributes (const Tree &tree)
|
||||||
: CompAttributeC<DimImg> (tree, treeCoreCount) {
|
: CompAttributeC<DimImg> (tree) {
|
||||||
compute ();
|
compute ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace otb {
|
|||||||
class AverageAttributes : public CompAttributeC<double> {
|
class AverageAttributes : public CompAttributeC<double> {
|
||||||
public:
|
public:
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline AverageAttributes (const Tree &tree, const Raster<PixelT> &raster, const AreaAttributes &areaAttributes, const unsigned int &treeCoreCount);
|
inline AverageAttributes (const Tree &tree, const Raster<PixelT> &raster, const AreaAttributes &areaAttributes);
|
||||||
inline ~AverageAttributes ();
|
inline ~AverageAttributes ();
|
||||||
protected:
|
protected:
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline
|
inline
|
||||||
AverageAttributes::AverageAttributes (const Tree &tree, const Raster<PixelT> &raster, const AreaAttributes &areaAttributes, const unsigned int &treeCoreCount)
|
AverageAttributes::AverageAttributes (const Tree &tree, const Raster<PixelT> &raster, const AreaAttributes &areaAttributes)
|
||||||
: CompAttributeC<double> (tree, treeCoreCount) {
|
: CompAttributeC<double> (tree) {
|
||||||
compute (raster, areaAttributes);
|
compute (raster, areaAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ namespace otb {
|
|||||||
|
|
||||||
class MoIAttributes : public CompAttributeC<double> {
|
class MoIAttributes : public CompAttributeC<double> {
|
||||||
public:
|
public:
|
||||||
inline MoIAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes, const unsigned int &treeCoreCount);
|
inline MoIAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes);
|
||||||
inline ~MoIAttributes ();
|
inline ~MoIAttributes ();
|
||||||
protected:
|
protected:
|
||||||
inline void compute (const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes);
|
inline void compute (const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes);
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define _OTB_TRISKELE_MOI_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_MOI_ATTRIBUTES_TPP
|
||||||
|
|
||||||
inline
|
inline
|
||||||
MoIAttributes::MoIAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes, const unsigned int &treeCoreCount)
|
MoIAttributes::MoIAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const XYAttributes &xyAttributes)
|
||||||
: CompAttributeC<double> (tree, treeCoreCount) {
|
: CompAttributeC<double> (tree) {
|
||||||
compute (areaAttributes, xyAttributes);
|
compute (areaAttributes, xyAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace otb {
|
|||||||
|
|
||||||
class SDAttributes : public CompAttributeC<double> {
|
class SDAttributes : public CompAttributeC<double> {
|
||||||
public:
|
public:
|
||||||
inline SDAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const unsigned int &treeCoreCount);
|
inline SDAttributes (const Tree &tree, const AreaAttributes &areaAttributes);
|
||||||
inline ~SDAttributes ();
|
inline ~SDAttributes ();
|
||||||
protected:
|
protected:
|
||||||
inline void compute (const AreaAttributes &areaAttributes);
|
inline void compute (const AreaAttributes &areaAttributes);
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define _OTB_TRISKELE_SD_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_SD_ATTRIBUTES_TPP
|
||||||
|
|
||||||
inline
|
inline
|
||||||
SDAttributes::SDAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const unsigned int &treeCoreCount)
|
SDAttributes::SDAttributes (const Tree &tree, const AreaAttributes &areaAttributes)
|
||||||
: CompAttributeC<double> (tree, treeCoreCount) {
|
: CompAttributeC<double> (tree) {
|
||||||
compute (areaAttributes);
|
compute (areaAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace otb {
|
|||||||
};
|
};
|
||||||
class XYAttributes : public CompAttributeC<AverageXY> {
|
class XYAttributes : public CompAttributeC<AverageXY> {
|
||||||
public:
|
public:
|
||||||
inline XYAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const unsigned int &treeCoreCount);
|
inline XYAttributes (const Tree &tree, const AreaAttributes &areaAttributes);
|
||||||
inline ~XYAttributes ();
|
inline ~XYAttributes ();
|
||||||
protected:
|
protected:
|
||||||
inline void compute (const AreaAttributes &areaAttributes);
|
inline void compute (const AreaAttributes &areaAttributes);
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define _OTB_TRISKELE_XY_ATTRIBUTES_TPP
|
#define _OTB_TRISKELE_XY_ATTRIBUTES_TPP
|
||||||
|
|
||||||
inline
|
inline
|
||||||
XYAttributes::XYAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const unsigned int &treeCoreCount)
|
XYAttributes::XYAttributes (const Tree &tree, const AreaAttributes &areaAttributes)
|
||||||
: CompAttributeC<AverageXY> (tree, treeCoreCount) {
|
: CompAttributeC<AverageXY> (tree) {
|
||||||
compute (areaAttributes);
|
compute (areaAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace otb {
|
|||||||
template<typename AttrT>
|
template<typename AttrT>
|
||||||
class CompAttributeC : public CompAttribute<AttrT> {
|
class CompAttributeC : public CompAttribute<AttrT> {
|
||||||
public:
|
public:
|
||||||
inline CompAttributeC (const Tree &tree, const unsigned int &treeCoreCount);
|
inline CompAttributeC (const Tree &tree);
|
||||||
inline ~CompAttributeC ();
|
inline ~CompAttributeC ();
|
||||||
|
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
@ -60,8 +60,6 @@ namespace otb {
|
|||||||
const DimImg &pixelId, const AttrT &pixelAttrValue, const vector<const ThresholdsChanel<AttrT> > &selection);
|
const DimImg &pixelId, const AttrT &pixelAttrValue, const vector<const ThresholdsChanel<AttrT> > &selection);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const unsigned int treeCoreCount;
|
|
||||||
|
|
||||||
template<typename CumpFunctPSE>
|
template<typename CumpFunctPSE>
|
||||||
inline void computeSameCompLevel (const CumpFunctPSE &cumpFunctPSE /* cumpFunctPSE (DimImg parentId)*/);
|
inline void computeSameCompLevel (const CumpFunctPSE &cumpFunctPSE /* cumpFunctPSE (DimImg parentId)*/);
|
||||||
};
|
};
|
||||||
|
@ -66,9 +66,8 @@ CompAttribute<AttrT>::book (const DimImg &leafCount) {
|
|||||||
// ========================================
|
// ========================================
|
||||||
template<typename AttrT>
|
template<typename AttrT>
|
||||||
inline
|
inline
|
||||||
CompAttributeC<AttrT>::CompAttributeC (const Tree &tree, const unsigned int &treeCoreCount)
|
CompAttributeC<AttrT>::CompAttributeC (const Tree &tree)
|
||||||
: CompAttribute<AttrT> (tree),
|
: CompAttribute<AttrT> (tree) {
|
||||||
treeCoreCount (treeCoreCount) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename AttrT>
|
template<typename AttrT>
|
||||||
@ -81,14 +80,15 @@ template<typename CumpFunctPSE>
|
|||||||
inline void
|
inline void
|
||||||
CompAttributeC<AttrT>::computeSameCompLevel (const CumpFunctPSE &cumpFunctPSE) {
|
CompAttributeC<AttrT>::computeSameCompLevel (const CumpFunctPSE &cumpFunctPSE) {
|
||||||
const vector<DimImg> &weightBounds (CompAttribute<AttrT>::tree.getWeightBounds ());
|
const vector<DimImg> &weightBounds (CompAttribute<AttrT>::tree.getWeightBounds ());
|
||||||
if (!weightBounds.size () || CompAttribute<AttrT>::tree.getCompCount ()/weightBounds.size () < treeCoreCount) {
|
unsigned int coreCount = CompAttribute<AttrT>::tree.getCoreCount ();
|
||||||
|
if (!weightBounds.size () || CompAttribute<AttrT>::tree.getCompCount ()/weightBounds.size () < coreCount) {
|
||||||
CompAttribute<AttrT>::tree.forEachComp (cumpFunctPSE);
|
CompAttribute<AttrT>::tree.forEachComp (cumpFunctPSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DimImg first = weightBounds [0];
|
DimImg first = weightBounds [0];
|
||||||
for (DimImg curBound = 1; curBound < weightBounds.size (); curBound++) {
|
for (DimImg curBound = 1; curBound < weightBounds.size (); curBound++) {
|
||||||
DimImg next = weightBounds [curBound];
|
DimImg next = weightBounds [curBound];
|
||||||
dealThreadRange (next-first, treeCoreCount, [this, &first, &cumpFunctPSE] (const DimImg &id) {
|
dealThreadRange (next-first, coreCount, [this, &first, &cumpFunctPSE] (const DimImg &id) {
|
||||||
const DimImg parentId = id+first;
|
const DimImg parentId = id+first;
|
||||||
cumpFunctPSE (parentId);
|
cumpFunctPSE (parentId);
|
||||||
});
|
});
|
||||||
@ -101,7 +101,7 @@ template<typename PixelT>
|
|||||||
inline void
|
inline void
|
||||||
CompAttributeC<AttrT>::cut (vector<vector<PixelT> > allBands, const AttributeProfiles<PixelT> &attributeProfiles,
|
CompAttributeC<AttrT>::cut (vector<vector<PixelT> > allBands, const AttributeProfiles<PixelT> &attributeProfiles,
|
||||||
const AttrT &pixelAttrValue, const vector<const ThresholdsChanel<AttrT> > &selection) {
|
const AttrT &pixelAttrValue, const vector<const ThresholdsChanel<AttrT> > &selection) {
|
||||||
dealThreadRange (CompAttribute<AttrT>::leafCount, treeCoreCount, [this, &allBands, &attributeProfiles, &pixelAttrValue, &selection] (const DimImg &leafId) {
|
dealThreadRange (CompAttribute<AttrT>::leafCount, CompAttribute<AttrT>::coreCount, [this, &allBands, &attributeProfiles, &pixelAttrValue, &selection] (const DimImg &leafId) {
|
||||||
cutOnPos (allBands, attributeProfiles, leafId, pixelAttrValue, selection);
|
cutOnPos (allBands, attributeProfiles, leafId, pixelAttrValue, selection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ namespace triskele {
|
|||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline void readBand (Raster<PixelT> &raster, DimChanel band, const Point &cropOrig, const Size &cropSize) const;
|
inline void readBand (Raster<PixelT> &raster, DimChanel band, const Point &cropOrig, const Size &cropSize) const;
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline void writeBand (Raster<PixelT> &raster, DimChanel band) const;
|
inline void writeBand (PixelT *pixels, DimChanel band) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IImage (const IImage &o) = delete;
|
IImage (const IImage &o) = delete;
|
||||||
|
@ -131,12 +131,12 @@ IImage::readBand (Raster<PixelT> &raster, DimChanel band, const Point &cropOrig,
|
|||||||
|
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline void
|
inline void
|
||||||
IImage::writeBand (Raster<PixelT> &raster, DimChanel band) const {
|
IImage::writeBand (PixelT *pixels, DimChanel band) const {
|
||||||
DEF_LOG ("IImage::writeBand", "band: " << band);
|
DEF_LOG ("IImage::writeBand", "band: " << band);
|
||||||
BOOST_ASSERT (gdalOutputDataset);
|
BOOST_ASSERT (gdalOutputDataset);
|
||||||
band++; // !!! GDAL layers starts at 1 (not 0 :-( )
|
band++; // !!! GDAL layers starts at 1 (not 0 :-( )
|
||||||
GDALRasterBand &poBand = *gdalOutputDataset->GetRasterBand (band);
|
GDALRasterBand &poBand = *gdalOutputDataset->GetRasterBand (band);
|
||||||
CPLErr err = poBand.RasterIO (GF_Write, 0, 0, size.width, size.height, raster.getPixels (), size.width, size.height, dataType, 0, 0);
|
CPLErr err = poBand.RasterIO (GF_Write, 0, 0, size.width, size.height, pixels, size.width, size.height, dataType, 0, 0);
|
||||||
if (err != CE_None)
|
if (err != CE_None)
|
||||||
cerr << "IImage::writeBand: can't acces " << fileName << endl;
|
cerr << "IImage::writeBand: can't acces " << fileName << endl;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#include "triskeleBase.hpp"
|
#include "triskeleBase.hpp"
|
||||||
#include "triskeleDebug.hpp"
|
#include "triskeleDebug.hpp"
|
||||||
@ -26,6 +27,9 @@ namespace otb {
|
|||||||
inline DimNodeId *getChildCount ();
|
inline DimNodeId *getChildCount ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/*! nb core for build and compute attributes */
|
||||||
|
const unsigned int coreCount;
|
||||||
|
|
||||||
/*! Info about the picture */
|
/*! Info about the picture */
|
||||||
Size size;
|
Size size;
|
||||||
|
|
||||||
@ -55,9 +59,10 @@ namespace otb {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors, destructor and resize method (does the same as the constructors)
|
// Constructors, destructor and resize method (does the same as the constructors)
|
||||||
|
|
||||||
Tree (const DimSideImg &width, const DimSideImg &height);
|
// XXX test sans defaut treeCoreCount
|
||||||
Tree ();
|
Tree (const DimSideImg &width, const DimSideImg &height, unsigned int coreCount = boost::thread::hardware_concurrency ());
|
||||||
|
Tree (unsigned int coreCount = boost::thread::hardware_concurrency ());
|
||||||
~Tree ();
|
~Tree ();
|
||||||
|
|
||||||
/*! clear values according to the size defined */
|
/*! clear values according to the size defined */
|
||||||
@ -69,6 +74,8 @@ namespace otb {
|
|||||||
inline void setNodeCount (const DimImg &newNodeCount);
|
inline void setNodeCount (const DimImg &newNodeCount);
|
||||||
inline void setSize (const Size &newSize);
|
inline void setSize (const Size &newSize);
|
||||||
|
|
||||||
|
inline unsigned int getCoreCount () const;
|
||||||
|
|
||||||
// Get the tree state and the size
|
// Get the tree state and the size
|
||||||
inline State getState () const;
|
inline State getState () const;
|
||||||
inline Size getSize () const;
|
inline Size getSize () const;
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
#define _OTB_TRISKELE_TREE_TPP
|
#define _OTB_TRISKELE_TREE_TPP
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
|
inline unsigned int
|
||||||
|
Tree::getCoreCount () const {
|
||||||
|
return coreCount;
|
||||||
|
}
|
||||||
|
|
||||||
inline DimNodeId *
|
inline DimNodeId *
|
||||||
Tree::getChildCount () {
|
Tree::getChildCount () {
|
||||||
return childCount;
|
return childCount;
|
||||||
|
@ -3,14 +3,15 @@
|
|||||||
using namespace otb::triskele;
|
using namespace otb::triskele;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Tree::Tree (const DimSideImg &width, const DimSideImg &height)
|
Tree::Tree (const DimSideImg &width, const DimSideImg &height, unsigned int coreCount)
|
||||||
: Tree ()
|
: Tree (coreCount)
|
||||||
{
|
{
|
||||||
resize (width, height);
|
resize (width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tree::Tree ()
|
Tree::Tree (unsigned int coreCount)
|
||||||
: size (),
|
: size (),
|
||||||
|
coreCount (coreCount),
|
||||||
leafCount (0),
|
leafCount (0),
|
||||||
nodeCount (0),
|
nodeCount (0),
|
||||||
leafParents (nullptr),
|
leafParents (nullptr),
|
||||||
|
@ -32,40 +32,47 @@ using namespace otb::triskele::arrayTree;
|
|||||||
|
|
||||||
template<typename PixelT>
|
template<typename PixelT>
|
||||||
inline
|
inline
|
||||||
void prog (const Option &option) {
|
void prog (Option &option) {
|
||||||
Raster<PixelT> raster;
|
Raster<PixelT> raster;
|
||||||
option.inputImage.readBand (raster, option.chanel, option.topLeft, option.size);
|
option.inputImage.readBand (raster, option.chanel, option.topLeft, option.size);
|
||||||
|
|
||||||
Border border; // default = no border
|
Border border; // default = no border
|
||||||
GraphWalker graphWalker (raster.getSize (), border);
|
GraphWalker graphWalker (raster.getSize (), border);
|
||||||
ArrayTreeBuilder<PixelT, PixelT> atb (option.treeCoreCount, raster, graphWalker, TreeType::MAX);
|
ArrayTreeBuilder<PixelT, PixelT> atb (raster, graphWalker, TreeType::MAX);
|
||||||
Tree tree;
|
Tree tree (option.treeCoreCount);
|
||||||
WeightAttributes<PixelT> weightAttributes (tree);
|
WeightAttributes<PixelT> weightAttributes (tree);
|
||||||
atb.buildTree (tree, weightAttributes);
|
atb.buildTree (tree, weightAttributes);
|
||||||
weightAttributes.printValues ("weight");
|
weightAttributes.printValues ("weight");
|
||||||
|
|
||||||
|
tree.printTree ();
|
||||||
|
|
||||||
AttributeProfiles<PixelT> attributeProfiles (tree);
|
AttributeProfiles<PixelT> attributeProfiles (tree);
|
||||||
atb.setAttributProfiles (attributeProfiles, raster);
|
atb.setAttributProfiles (attributeProfiles, raster);
|
||||||
attributeProfiles.printValues ();
|
attributeProfiles.printValues ();
|
||||||
|
|
||||||
AreaAttributes areaAttributes (tree, option.treeCoreCount);
|
AreaAttributes areaAttributes (tree);
|
||||||
areaAttributes.printValues ("area");
|
areaAttributes.printValues ("area");
|
||||||
AverageAttributes averageAttributes (tree, raster, areaAttributes, option.treeCoreCount);
|
AverageAttributes averageAttributes (tree, raster, areaAttributes);
|
||||||
averageAttributes.printValues ("average");
|
averageAttributes.printValues ("average");
|
||||||
SDAttributes sdAttributes (tree, areaAttributes, option.treeCoreCount);
|
SDAttributes sdAttributes (tree, areaAttributes);
|
||||||
sdAttributes.printValues ("sd");
|
sdAttributes.printValues ("sd");
|
||||||
XYAttributes xyAttributes (tree, areaAttributes, option.treeCoreCount);
|
XYAttributes xyAttributes (tree, areaAttributes);
|
||||||
//xyAttributes.printValues ("XY"); // pb print de complexe
|
//xyAttributes.printValues ("XY"); // pb print de complexe
|
||||||
MoIAttributes moiAttributes (tree, areaAttributes, xyAttributes, option.treeCoreCount);
|
MoIAttributes moiAttributes (tree, areaAttributes, xyAttributes);
|
||||||
moiAttributes.printValues ("moi");
|
moiAttributes.printValues ("moi");
|
||||||
|
|
||||||
// XXX cut
|
|
||||||
|
// XXX cut allProfiles.clear ();
|
||||||
|
DimChanel nbBands = 1;
|
||||||
|
vector <vector <PixelT> > allBands (tree.getLeafCount (), vector<PixelT> (nbBands, 0));
|
||||||
|
|
||||||
// attribute.cut (out, attributProfiles, threshold)
|
// attribute.cut (out, attributProfiles, threshold)
|
||||||
|
|
||||||
// XXX write
|
// XXX write
|
||||||
|
option.outputImage.createImage (tree.getSize (), option.inputImage.getDataType (), nbBands);
|
||||||
tree.printTree ();
|
for (DimChanel c = 0; c < nbBands; ++c)
|
||||||
|
option.outputImage.writeBand (&allBands[c][0], c);
|
||||||
|
|
||||||
cerr << endl << "*** prog ok!" << endl;
|
cerr << endl << "*** prog ok!" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user