triskele/include/Attributes/AreaAttributes.tpp
Git Merciol aff93d5467 modifié : include/Appli/Option.hpp
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/triskeleDealThreads.tpp
	modifié :         src/Appli/Option.cpp
	modifié :         src/IImage.cpp
	modifié :         src/apGenerator.cpp
2018-04-20 09:49:46 +02: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)
: CompAttribute<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 ();
CompAttribute<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