modifié : include/ArrayTree/ArrayTreeBuilder.hpp
modifié : include/ArrayTree/ArrayTreeBuilder.tpp supprimé : include/Attributes/AreaAttribute.hpp modifié : include/TreeBuilder.hpp supprimé : src/Attributes/AreaAttribute.cpp modifié : src/Tree.cpp modifié : src/testMain.cpp
This commit is contained in:
parent
bdd6110787
commit
2933efb9d9
@ -9,6 +9,8 @@
|
||||
#include "triskeleSort.hpp"
|
||||
#include "triskeleDealThreads.hpp"
|
||||
#include "TreeBuilder.hpp"
|
||||
#include "Attributes/WeightAttributes.hpp"
|
||||
#include "AttributeProfiles.hpp"
|
||||
#include "IImage.hpp"
|
||||
#include "GraphWalker.hpp"
|
||||
#include "Weight.hpp"
|
||||
@ -27,23 +29,26 @@ namespace otb {
|
||||
TreeType type;
|
||||
bool countingFlag;
|
||||
Leader leaders;
|
||||
WeightT *compWeights; // [leafCount] XXX dans TreeBuilder ???
|
||||
|
||||
// transcient
|
||||
DimNodeId *childCountRec;
|
||||
DimImg *newCompId;
|
||||
WeightT *compWeights;
|
||||
public:
|
||||
inline ArrayTreeBuilder (const unsigned int &coreCount,
|
||||
Raster<PixelT> &raster, const GraphWalker &graphWalker,
|
||||
const TreeType &treeType, const bool &countingSort = true);
|
||||
inline ~ArrayTreeBuilder ();
|
||||
|
||||
inline void buildTree (Tree &tree);
|
||||
|
||||
inline void buildTree (Tree &tree, WeightAttributes<WeightT> &weightAttributes);
|
||||
inline void setAttributProfiles (AttributeProfiles<PixelT> &attributeProfiles, const Raster<PixelT> &raster);
|
||||
protected:
|
||||
template<typename WeightFunct>
|
||||
inline void
|
||||
buildTree (Tree &tree, const WeightFunct &weightFunct);
|
||||
template<typename WeightFunct>
|
||||
inline void
|
||||
setAttributProfiles (AttributeProfiles<PixelT> &attributeProfiles, const WeightFunct &weightFunct);
|
||||
|
||||
// template<typename WeightFunct>
|
||||
// inline void
|
||||
|
@ -19,7 +19,6 @@ ArrayTreeBuilder<WeightT, PixelT>::ArrayTreeBuilder (const unsigned int &coreCou
|
||||
DEF_LOG ("ArrayTreeBuilder::ArrayTreeBuilder", "");
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template<typename WeightT, typename PixelT>
|
||||
inline
|
||||
ArrayTreeBuilder<WeightT, PixelT>::~ArrayTreeBuilder () {
|
||||
@ -28,15 +27,16 @@ ArrayTreeBuilder<WeightT, PixelT>::~ArrayTreeBuilder () {
|
||||
// ========================================
|
||||
template<typename WeightT, typename PixelT>
|
||||
inline void
|
||||
ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree) {
|
||||
ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, WeightAttributes<WeightT> &weightAttributes) {
|
||||
DEF_LOG ("ArrayTreeBuilder::buildTree", "size:" << graphWalker.vertexMaxCount ());
|
||||
setTreeSize (tree, graphWalker.size);
|
||||
weightAttributes.updateTranscient ();
|
||||
if (!leafCount)
|
||||
return;
|
||||
leaders.book (leafCount);
|
||||
childCountRec = childCount+2;
|
||||
newCompId = leaders.getLeaders ();
|
||||
compWeights = new WeightT[leafCount];
|
||||
compWeights = weightAttributes.getValues ();
|
||||
|
||||
switch (type) {
|
||||
// case MIN:
|
||||
@ -54,12 +54,29 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree) {
|
||||
newCompId = nullptr;
|
||||
buildChildren ();
|
||||
childCountRec = nullptr;
|
||||
// XXX
|
||||
// if (compWeights)
|
||||
// delete [] compWeights;
|
||||
// compWeights = nullptr;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template<typename WeightT, typename PixelT>
|
||||
inline void
|
||||
ArrayTreeBuilder<WeightT, PixelT>::setAttributProfiles (AttributeProfiles<PixelT> &attributeProfiles, const Raster<PixelT> &raster) {
|
||||
DEF_LOG ("ArrayTreeBuilder::setAttributProfiles", "");
|
||||
attributeProfiles.updateTranscient ();
|
||||
switch (type) {
|
||||
// case MIN:
|
||||
// setAttributProfiles (attributeProfiles, MinWeight<PixelT, WeightT> (raster.getPixels (), raster.getSize ()));
|
||||
break;
|
||||
case MAX:
|
||||
setAttributProfiles (attributeProfiles, MaxWeight<PixelT, WeightT> (raster.getPixels (), raster.getSize ()));
|
||||
break;
|
||||
// case TOS:
|
||||
// setAttributProfiles (attributeProfiles, MedianWeight<PixelT, WeightT> (raster.getPixels (), raster.getSize ()));
|
||||
break;
|
||||
// XXX msg
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template<typename WeightT, typename PixelT>
|
||||
template<typename WeightFunct>
|
||||
inline void
|
||||
@ -155,6 +172,21 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &wei
|
||||
compParents[root] = root;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template<typename WeightT, typename PixelT>
|
||||
template<typename WeightFunct>
|
||||
inline void
|
||||
ArrayTreeBuilder<WeightT, PixelT>::setAttributProfiles (AttributeProfiles<PixelT> &attributeProfiles, const WeightFunct &weightFunct) {
|
||||
PixelT *leafAP = attributeProfiles.getValues ();
|
||||
dealThreadBound (leafCount, coreCount, [&weightFunct, &leafAP] (const DimImg &minVal, const DimImg &maxVal) {
|
||||
weightFunct.copyPixelsBound (leafAP, minVal, maxVal);
|
||||
});
|
||||
PixelT *compAP = leafAP+leafCount;
|
||||
dealThreadBound (getCompCount (), coreCount, [this, &weightFunct, &compAP] (const DimImg &minVal, const DimImg &maxVal) {
|
||||
weightFunct.weight2valueBound (compAP, compWeights, minVal, maxVal);
|
||||
});
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// template<typename WeightT, typename PixelT>
|
||||
// template<typename WeightFunct>
|
||||
|
@ -1,18 +0,0 @@
|
||||
#ifndef _OTB_TRISKELE_AREA_ATTRIBUTE_HPP
|
||||
#define _OTB_TRISKELE_AREA_ATTRIBUTE_HPP
|
||||
|
||||
#include "Attribute.hpp"
|
||||
|
||||
namespace otb {
|
||||
namespace triskele {
|
||||
|
||||
/** AreaAttribute */
|
||||
class AreaAttribute : Attribute {
|
||||
public:
|
||||
void
|
||||
generate ();
|
||||
};
|
||||
} // triskele
|
||||
} // otb
|
||||
|
||||
#endif // _OTB_TRISKELE_AREA_ATTRIBUTE_HPP
|
@ -1,8 +1,8 @@
|
||||
#ifndef _OTB_TRISKELE_TREE_BUILDER_HPP
|
||||
#define _OTB_TRISKELE_TREE_BUILDER_HPP
|
||||
|
||||
#include "Tree.hpp"
|
||||
#include "triskeleBase.hpp"
|
||||
#include "Tree.hpp"
|
||||
|
||||
namespace otb {
|
||||
namespace triskele {
|
||||
|
@ -1,10 +0,0 @@
|
||||
#include "Attributes/AreaAttribute.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
using namespace otb::triskele;
|
||||
|
||||
void
|
||||
AreaAttribute::generate () {
|
||||
//DimNodeId root = tree->getRoot ();
|
||||
}
|
10
src/Tree.cpp
10
src/Tree.cpp
@ -4,9 +4,9 @@ using namespace otb::triskele;
|
||||
using namespace std;
|
||||
|
||||
Tree::Tree (const DimSideImg &width, const DimSideImg &height)
|
||||
: Tree ((DimImg)width * (DimImg)height)
|
||||
: Tree ()
|
||||
{
|
||||
size = Size (width, height);
|
||||
resize (width, height);
|
||||
}
|
||||
|
||||
Tree::Tree ()
|
||||
@ -42,13 +42,7 @@ Tree::clear () {
|
||||
|
||||
void
|
||||
Tree::resize (const DimSideImg &width, const DimSideImg &height) {
|
||||
// resize ((DimImg)width * (DimImg)height);
|
||||
size = Size (width, height);
|
||||
// }
|
||||
|
||||
// void
|
||||
// Tree::resize (const DimImg &leafCount) {
|
||||
// size = NullSize;
|
||||
book ((DimImg)width * (DimImg)height);
|
||||
clear ();
|
||||
}
|
||||
|
@ -18,6 +18,9 @@
|
||||
#include "ArrayTree/Weight.hpp"
|
||||
|
||||
#include "ArrayTree/ArrayTreeBuilder.hpp"
|
||||
#include "Attributes/WeightAttributes.hpp"
|
||||
#include "AttributeProfiles.hpp"
|
||||
#include "Attributes/AreaAttributes.hpp"
|
||||
|
||||
//using namespace triskele;
|
||||
using namespace otb::triskele;
|
||||
@ -33,8 +36,21 @@ void prog (const Option &option) {
|
||||
GraphWalker graphWalker (raster.getSize (), border);
|
||||
ArrayTreeBuilder<PixelT, PixelT> atb (option.treeCoreCount, raster, graphWalker, TreeType::MAX);
|
||||
Tree tree;
|
||||
atb.buildTree (tree);
|
||||
WeightAttributes<PixelT> weightAttributes (tree);
|
||||
atb.buildTree (tree, weightAttributes);
|
||||
|
||||
// XXX buildAttr
|
||||
AttributeProfiles<PixelT> attributeProfiles (tree);
|
||||
atb.setAttributProfiles (attributeProfiles, raster);
|
||||
|
||||
AreaAttributes areaAttributes (tree); // XXX <DimImg> option.treeCoreCount
|
||||
// AverageAttributs<PixelT> averageAttributs (tree, raster);
|
||||
// SDAttributs sdAttributs (tree, areaAttributs); // XXX<double>
|
||||
// XYAttributs xyAttributs (tree, areaAttributs); // XXX<double>
|
||||
// MoIAttributs moiAttributs (tree, xyAttributs); // XXX<double>
|
||||
|
||||
// XXX cut
|
||||
// attribut.cut (out, attributProfiles, threshold)
|
||||
|
||||
// XXX write
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user