
nouveau fichier : include/ArrayTree/ArrayTreeBuilder.tpp nouveau fichier : include/ArrayTree/Border.hpp nouveau fichier : include/ArrayTree/GraphWalker.hpp nouveau fichier : include/ArrayTree/Leader.hpp nouveau fichier : include/ArrayTree/Weight.hpp nouveau fichier : include/ArrayTree/Weight.tpp nouveau fichier : include/ArrayTree/triskeleArrayTreeBase.hpp nouveau fichier : include/ArrayTree/triskeleSort.hpp nouveau fichier : include/ArrayTree/triskeleSort.tpp modifié : include/Attribute.hpp modifié : include/Attributes/AreaAttribute.hpp supprimé : include/BuildTree.hpp supprimé : include/DAPTree/Border.hpp supprimé : include/DAPTree/DAPTreeBuilder.hpp supprimé : include/DAPTree/DAPTreeBuilder.tpp supprimé : include/DAPTree/GraphWalker.hpp supprimé : include/DAPTree/ParRnk.hpp supprimé : include/DAPTree/Weight.hpp supprimé : include/DAPTree/baseDAPTree.hpp supprimé : include/DAPTree/sort.hpp nouveau fichier : include/IImage.hpp nouveau fichier : include/IImage.tpp supprimé : include/ImageInterface.hpp supprimé : include/ImageInterface.tpp modifié : include/QuadTree/QuadTreeBuilder.hpp modifié : include/Tree.hpp nouveau fichier : include/TreeBuilder.hpp supprimé : include/TreeOfShapesGeraud/ToSBuilder.hpp supprimé : include/TreeOfShapesGeraud/ToSutils.hpp modifié : include/XMLTree/XMLTreeBuilder.hpp supprimé : include/baseDef.hpp supprimé : include/getType.hpp nouveau fichier : include/triskeleBase.hpp renommé : include/dealThreads.hpp -> include/triskeleDealThreads.hpp nouveau fichier : include/triskeleDealThreads.tpp renommé : include/debug.hpp -> include/triskeleDebug.hpp nouveau fichier : include/triskeleGdalGetType.hpp modifié : otb-module.cmake nouveau fichier : src/ArrayTree/triskeleArrayTreeBase.cpp modifié : src/Attribute.cpp modifié : src/Attributes/AreaAttribute.cpp modifié : src/CMakeLists.txt supprimé : src/DAPTree/GraphWalker.cpp supprimé : src/DAPTree/ParRnk.cpp supprimé : src/DAPTree/baseDAPTree.cpp supprimé : src/DAPTree/sort.cpp modifié : src/QuadTree/QuadTreeBuilder.cpp modifié : src/Tree.cpp supprimé : src/TreeOfShapesGeraud/ToSBuilder.cpp supprimé : src/TreeOfShapesGeraud/ToSutils.cpp modifié : src/XMLTree/XMLTreeBuilder.cpp supprimé : src/debug.cpp modifié : src/testMain.cpp nouveau fichier : src/triskeleDebug.cpp supprimé : tests/ToSGeraudCoord.txt supprimé : tests/ToSGeraudIdx.ods
78 lines
2.9 KiB
C++
78 lines
2.9 KiB
C++
#ifndef _OTB_TRISKELE_BASE_HPP
|
|
#define _OTB_TRISKELE_BASE_HPP
|
|
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
#include <algorithm>
|
|
#include <functional>
|
|
#include <cstdint>
|
|
|
|
#define DimImg_MAX UINT32_MAX
|
|
|
|
namespace triskele {
|
|
|
|
/*! 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 Point {
|
|
DimSideImg x, y;
|
|
Point () : x (0), y (0) {}
|
|
Point (const DimSideImg &abs, const DimSideImg &ord) : x (abs), y (ord) {}
|
|
};
|
|
inline std::ostream &operator << (std::ostream &out, const Point &p) { return out << "(" << p.x << "," << p.y << ")"; }
|
|
extern Point NullPoint;
|
|
|
|
struct Size {
|
|
DimSideImg width, height;
|
|
Size () : width (0), height (0) {}
|
|
Size (const DimSideImg &w, const DimSideImg &h) : width (w), height (h) {}
|
|
};
|
|
inline std::ostream &operator << (std::ostream &out, const Size &s) { return out << "[" << s.width << "," << s.height << "]"; }
|
|
|
|
inline DimImg pointToId (const Size &size, const Point &p) { return (DimImg)p.x + (DimImg)p.y * size.width; }
|
|
|
|
inline Point idToPoint (const Size &size, const DimImg &id) { return Point(id % size.width, id / size.width); }
|
|
extern Size NullSize;
|
|
|
|
struct Rect {
|
|
DimSideImg x, y, width, height;
|
|
Rect () : x (0), y (0), width (0), height (0) {}
|
|
Rect (const Rect &rect) : x (rect.x), y (rect.y), width (rect.width), height (rect.height) {}
|
|
Rect (const Point &orig, const Size &size) : x (orig.x), y (orig.y), width (size.width), height (size.height) {}
|
|
Rect (const DimSideImg &abs, const DimSideImg &ord, const DimSideImg &w, const DimSideImg &h) :
|
|
x (abs), y (ord), width (w), height (h) {}
|
|
};
|
|
inline std::ostream &operator << (std::ostream &out, const Rect &r) {
|
|
return out << "[" << r.x << "," << r.y << " " << r.width << "x" << r.height << "]";
|
|
}
|
|
extern Rect NullRect;
|
|
|
|
/*! 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) { return DimImg (p.x) + DimImg (p.y)*DimImg (size.width); }
|
|
|
|
/*! Convertit un index d'un tableau (on peut imaginer une image à 2 dimension) en point correspondant à des coordonnées */
|
|
inline Point idx2point (const Size &size, const DimImg &idx) { return Point (idx % size.width, idx / size.width); }
|
|
|
|
/*! Affiche le contenu d'un tableau en spécifiant sa taille */
|
|
template <typename DimImg>
|
|
inline std::ostream &printMap (std::ostream &out, const DimImg *map, const Size &size) {
|
|
for (DimSideImg y = 0; y < size.height; ++y) {
|
|
for (DimSideImg x = 0; x < size.width; ++x, ++map)
|
|
out << std::setw(3) << *map;
|
|
out << std::endl;
|
|
}
|
|
return out;
|
|
}
|
|
} // namespace triskele
|
|
|
|
#endif // _OTB_TRISKELE_BASE_HPP
|