#ifndef _OTB_TRISKELE_BASE_HPP #define _OTB_TRISKELE_BASE_HPP #include #include #include #include #include #include #include "triskeleDebug.hpp" #define DimImg_MAX UINT32_MAX namespace triskele { using namespace std; /*! Image band type */ typedef uint16_t DimChanel; // hyperspectral > 256 /*! Image size type */ typedef uint32_t DimSideImg; /*! Number of pixels */ typedef uint32_t DimImg; /*! Number of nodes */ typedef uint32_t DimNodeId; /*! Compte le nombre de bits utilisés pour chaque nombre : bitCount[nombre] = nombre de bits*/ extern int bitCount[]; struct Size { DimSideImg width, height; inline Size (); inline Size (const Size &size); inline Size (const DimSideImg &w, const DimSideImg &h); }; inline bool operator== (const Size &s1, const Size &s2); inline ostream &operator << (ostream &out, const Size &s); extern Size NullSize; struct Point { DimSideImg x, y; inline Point (); inline Point (const DimSideImg &abs, const DimSideImg &ord); inline Point (const Size &size, const DimImg &idx); }; inline bool operator== (const Point &p1, const Point &p2); inline ostream &operator << (ostream &out, const Point &p); extern Point NullPoint; /*! Convertit un point d'un tableau (on peut imaginer une image à 2 dimension) en un index */ inline DimImg point2idx (const Size &size, const Point &p); inline DimImg point2idx (const Size &size, const Point &tileOrig, const Point &p); inline DimImg idxTile2idxRect (const Size &tileSize, const DimImg &tileIdx, const Size &rectSize, const DimImg tileOrig); struct Rect { DimSideImg x, y, width, height; inline Rect (); inline Rect (const Rect &rect); inline Rect (const Point &orig, const Size &size); inline Rect (const DimSideImg &abs, const DimSideImg &ord, const DimSideImg &w, const DimSideImg &h); inline DimImg relIdx (const Point &absPos) const; inline DimImg absIdx (const DimImg &relIdx, const Size &rectSize) const; template inline void cpToTile (const Size &size, const T *src, vector &dst) const; template inline void cpFromTile (const Size &size, const vector &src, T *dst) const; template inline void cpFromTileMove (const Size &size, const vector &src, T *dst, const T &move) const; }; inline bool operator== (const Rect &r1, const Rect &r2); inline ostream &operator << (ostream &out, const Rect &r); extern Rect NullRect; static const DimSideImg printMapMaxSide = 25; /*! Affiche le contenu d'un tableau en spécifiant sa taille */ template struct CPrintMap { const T *map; const Size &size; DimNodeId maxValues; inline CPrintMap (const T *map, const Size &size, DimNodeId maxValues = 0); inline ostream &print (ostream &out) const; }; template inline CPrintMap printMap (const T *map, const Size &size, DimNodeId maxValues); template inline ostream &operator << (ostream& out, const CPrintMap &cpm) { return cpm.print (out); } #include "triskeleBase.tpp" } // namespace triskele #endif // _OTB_TRISKELE_BASE_HPP