#ifndef _OTB_TRISKELE_WEIGHT_ATTRIBUTES_TPP #define _OTB_TRISKELE_WEIGHT_ATTRIBUTES_TPP using namespace boost::chrono; template inline WeightAttributes::WeightAttributes (const Tree &tree, const bool &decr) : CompAttribute (tree, decr) { } template inline WeightAttributes::~WeightAttributes () { } template inline void WeightAttributes::setWeightBounds (Tree &tree) { vector &weightBounds (tree.getWeightBounds ()); DimImg rootId = tree.getCompRoot (); DimImg stepsCard = 0; WeightT curLevel = CompAttribute::values [0]; for (DimImg compId = 1; compId <= rootId; ++compId) { if (CompAttribute::values [compId] == curLevel) continue; ++stepsCard; curLevel = CompAttribute::values [compId]; } weightBounds.clear (); weightBounds.reserve (stepsCard+1); weightBounds.push_back (0); curLevel = CompAttribute::values [0]; for (DimImg compId = 1; compId <= rootId; ++compId) { if (CompAttribute::values [compId] == curLevel) continue; weightBounds.push_back (compId); curLevel = CompAttribute::values [compId]; } weightBounds.push_back (rootId+1); } template template inline void WeightAttributes::cut (vector > &allBands, const AttributeProfiles &attributeProfiles, const vector &thresholds) const { auto start = high_resolution_clock::now (); vector orderedThresholds (thresholds); if (CompAttribute::decr) reverse (orderedThresholds.begin (), orderedThresholds.end ()); CompAttribute::cut (allBands, attributeProfiles, 0., orderedThresholds); globalTreeStats.addTime (filteringStats, duration_cast > (high_resolution_clock::now ()-start).count ()); } #endif // _OTB_TRISKELE_WEIGHT_ATTRIBUTES_TPP