triskele/include/AttributeProfiles.tpp
Git Merciol 869eda6449 modifié : include/ArrayTree/ArrayTreeBuilder.tpp
modifié :         include/AttributeProfiles.hpp
	modifié :         include/AttributeProfiles.tpp
	modifié :         include/Attributes/AreaAttributes.hpp
	modifié :         include/Attributes/AreaAttributes.tpp
	modifié :         include/Attributes/WeightAttributes.hpp
	modifié :         include/Attributes/WeightAttributes.tpp
	modifié :         include/Tree.hpp
	modifié :         include/Tree.tpp
	modifié :         include/triskeleBase.tpp
	modifié :         src/Tree.cpp
	modifié :         src/XMLTree/XMLTreeBuilder.cpp
	modifié :         src/testMain.cpp
2018-02-19 16:56:30 +01:00

60 lines
1.3 KiB
C++

#ifndef _OTB_TRISKELE_ATTRIBUTE_PROFILES_TPP
#define _OTB_TRISKELE_ATTRIBUTE_PROFILES_TPP
template<typename PixelT>
inline
AttributeProfiles<PixelT>::AttributeProfiles (const Tree &tree)
: tree (tree),
leafCount (0),
values (nullptr) {
updateTranscient ();
}
template<typename PixelT>
inline
AttributeProfiles<PixelT>::~AttributeProfiles () {
free ();
}
template<typename PixelT>
inline void
AttributeProfiles<PixelT>::updateTranscient () {
book (tree.getLeafCount ());
}
template<typename PixelT>
inline PixelT *
AttributeProfiles<PixelT>::getValues () {
return values;
}
template<typename PixelT>
inline void
AttributeProfiles<PixelT>::printValues () const {
cout << "AP" << endl;
const Size doubleSize (tree.getSize().width, 2*tree.getSize ().height);
printMap (cout, values, doubleSize, tree.getNodeCount ()) << endl << endl;
}
template<typename PixelT>
inline void
AttributeProfiles<PixelT>::free () {
if (values)
delete[] values;
values = nullptr;
}
template<typename PixelT>
inline void
AttributeProfiles<PixelT>::book (const DimImg &leafCount) {
if (this->leafCount == leafCount)
return;
free ();
if (!leafCount)
return;
this->leafCount = leafCount;
values = new PixelT[leafCount*2];
}
#endif // _OTB_TRISKELE_ATTRIBUTE_PROFILES_TPP