triskele/include/Attributes/AreaAttributes.tpp
Git Merciol 77c4b5fd0b 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
2018-02-26 13:49:19 +01:00

39 lines
1.3 KiB
C++

#ifndef _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
#define _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
using namespace boost::chrono;
inline
AreaAttributes::AreaAttributes (const Tree &tree)
: CompAttributeC<DimImg> (tree) {
compute ();
}
inline
AreaAttributes::~AreaAttributes () {
}
template<typename PixelT>
inline void
AreaAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
const vector<DimImg> &thresholds) const {
auto start = high_resolution_clock::now ();
CompAttributeC<DimImg>::cut (allBands, attributeProfiles, 1, thresholds);
globalTreeStats.addTime (filteringStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
}
inline void
AreaAttributes::compute () {
auto start = high_resolution_clock::now ();
computeSameCompLevel ([this] (const DimImg &parentId) {
DimImg area = 0;
tree.forEachChildTI (parentId, [this, &area] (const bool &isLeaf, const DimImg &childId) {
area += isLeaf ? 1 : CompAttribute<DimImg>::values [childId];
});
CompAttribute<DimImg>::values [parentId] = area;
});
globalTreeStats.addTime (areaStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
}
#endif // _OTB_TRISKELE_AREA_ATTRIBUTES_TPP