triskele/include/AttributeProfiles.tpp
Git Merciol 300bfd965d modifié : MakefileNoOTB
modifié :         include/Appli/Option.hpp
	modifié :         include/ArrayTree/ArrayTreeBuilder.hpp
	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/MoIAttributes.hpp
	modifié :         include/Attributes/MoIAttributes.tpp
	modifié :         include/Attributes/SDAttributes.hpp
	modifié :         include/Attributes/SDAttributes.tpp
	modifié :         include/CompAttribute.hpp
	modifié :         include/CompAttribute.tpp
	modifié :         src/Appli/Option.cpp
	modifié :         src/testMain.cpp
2018-02-20 16:39:24 +01:00

66 lines
1.4 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 const PixelT *
AttributeProfiles<PixelT>::getValues () const {
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