#ifndef _OTB_TRISKELE_SD_ATTRIBUTES_TPP #define _OTB_TRISKELE_SD_ATTRIBUTES_TPP inline SDAttributes::SDAttributes (const Tree &tree, const AreaAttributes &areaAttributes, const unsigned int &treeCoreCount) : CompAttributeC (tree, treeCoreCount) { compute (areaAttributes); } inline SDAttributes::~SDAttributes () { } inline void SDAttributes::compute (const AreaAttributes &areaAttributes) { const DimImg *areas = areaAttributes.getValues (); computeSameCompLevel ([this, &areas] (const DimImg &parentId) { double tmpSD = 0.; tree.forEachChildTI (parentId, [this, &tmpSD, &areas, &parentId] (const bool &isLeaf, const DimImg &childId) { if (isLeaf) return; double diff = areas [childId]-areas [parentId]; tmpSD += (diff * diff)*areas[childId]; }); CompAttribute::values[parentId] = tmpSD / areas[parentId]; // XXX on peut virer pour gagner du temps et calculer SD*SD CompAttribute::values[parentId] = sqrt (CompAttribute::values[parentId]); }); } #endif // _OTB_TRISKELE_SD_ATTRIBUTES_TPP