triskele/include/CompAttribute.hpp
2018-08-06 10:53:08 +02:00

66 lines
2.1 KiB
C++

#ifndef _OTB_TRISKELE_COMP_ATTRIBUTE_HPP
#define _OTB_TRISKELE_COMP_ATTRIBUTE_HPP
#include <vector>
#include "triskeleDebug.hpp"
#include "triskeleBase.hpp"
#include "Tree.hpp"
#include "AttributeProfiles.hpp"
namespace otb {
namespace triskele {
template<typename AttrT>
class CompAttribute {
public:
static inline vector<AttrT> getScaledThresholds (const vector<double> &thresholds, const AttrT &maxValue);
static inline vector<AttrT> getConvertedThresholds (const vector<double> &thresholds);
inline CompAttribute (const Tree &tree, const bool &decr = false);
inline ~CompAttribute ();
inline void updateTranscient ();
inline const AttrT *getValues () const;
inline AttrT *getValues ();
inline AttrT getMaxValue () const;
inline bool getDecr () const;
template<typename PixelT>
inline void cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
const AttrT &pixelAttrValue, const vector<AttrT> &thresholds) const;
template<typename PixelT>
inline void cutOnPos (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
const DimImg &pixelId, const AttrT &pixelAttrValue, const vector<AttrT> &thresholds) const;
virtual inline ostream &print (ostream &out) const { print (out, ""); return out; }
protected:
const Tree &tree;
DimNodeId leafCount;
vector<AttrT> values;
bool decr;
inline void free ();
inline void book (const DimImg &leafCount);
template<typename CumpFunctPSE>
inline void computeSameCompLevel (const CumpFunctPSE &cumpFunctPSE /* cumpFunctPSE (DimImg parentId)*/) const;
ostream &print (ostream &out, const string &msg) const;
friend ostream &operator << (ostream& out, const CompAttribute &ca) { return ca.print (out); return out; }
};
} // triskele
} // otb
#include "Attributes/WeightAttributes.hpp"
namespace otb {
namespace triskele {
#include "CompAttribute.tpp"
} // triskele
} // otb
#endif // _OTB_TRISKELE_COMP_ATTRIBUTE_HPP