aimsalgo 6.0.0
Neuroimaging image processing
geometric.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34
35
36#ifndef AIMS_MESH_GEOMETRIC_H
37#define AIMS_MESH_GEOMETRIC_H
38
39#include <aims/mesh/texture.h>
40#include <aims/mesh/surface.h>
42#include <cartobase/smart/rcptr.h>
43#include <list>
44
45template <class T>
46inline float sign(T x)
47{
48 if (x>(T)0) return(1);
49 else
50 if (x<(T)0) return(-1);
51 else
52 return(0);
53}
54
55
56
57// Cross product between two 3D points
58inline Point3df cross( const Point3df & a, const Point3df & b )
59{
60
61 Point3df n;
62 n[0] = a[1]*b[2] - a[2]*b[1];
63 n[1] = a[2]*b[0] - a[0]*b[2];
64 n[2] = a[0]*b[1] - a[1]*b[0];
65 return n;
66}
67
68// Cross product between two 2D points
69inline float cross( const Point2df & a, const Point2df & b )
70{
71 return (a[0] * b[1]) - (a[1] * b[0]);
72}
73
74namespace aims
75{
76
78 {
79 public:
80 typedef std::list<unsigned> Neighborhood;
81 typedef std::vector< Neighborhood > NeighborList;
82 typedef std::vector< std::list<float> > WeightNeighborList;
83 typedef std::vector<float> WeightList;
84 typedef typename
87
93
94 const WeightNeighborList & getPhi() const ;
95 const WeightNeighborList & getTheta() const ;
96 const WeightNeighborList & getDot() const ;
98 const WeightList & getAlpha() const ;
99 const WeightList & getSimpleAlpha() const ;
100 const WeightList & getBeta() const ;
103 const NeighborList & getNeighbor() const;
108 { return _graphvertices; }
110 { return _graphvertices; }
111 meshgraph::MeshGraphFaces & getFaces() { return _graphfaces; }
113 { return _graphfaces; }
114
115// protected:
116 void doPhi();
117 void doTheta();
118 void doAlpha();
120 void doBeta();
121 void doDot();
122 void doSurface();
126 void doGraph();
128
129 private:
130 const AimsSurfaceTriangle & _mesh;
132 NeighborList _neighbourso ;
133 NeighborList _triangleNeighbourso ;
134 WeightNeighborList _phi ;
135 WeightNeighborList _theta;
136 WeightList _alpha; // this represents sum(l*l*cotan(alpha))
137 WeightList _simplealpha; // this is just sum(alpha)
138 WeightList _beta;
140 WeightNeighborList _surface;
141 NeighborList doTriangleNeighbor() ;
142 // using meshgraph
143 meshgraph::MeshGraphVertices _graphvertices;
144 meshgraph::MeshGraphFaces _graphfaces;
145
146 friend class VertexRemover;
147
148 };
149
151 {
152 public:
155 virtual ~Curvature();
156 virtual Texture<float> doIt() = 0; //car defini dnas les classes derivees -> classe abstraite non instantiable
157 static void regularize(Texture<float> & tex, float ratio); // pas lie a une instance de la classe
158 static void getTextureProperties(const Texture<float> & tex); // pas lie a une instance de la classe
159 };
160
162 {
163 public:
165 const std::string & method );
167 const std::string & method );
168
169 };
170
179
180
181 // All these are Mean Curvature estimates
182
191
200
201 // This is a Gaussian Curvature estimate
202
211
212 // This is another Gaussian Curvature estimate (from aims-til/Cathier)
213
215 {
216 public:
221 void localProcess( size_t i_vert, float & gaussianCurvature,
222 float & meanCurvature,
223 std::pair<float, float> & principalCurvatures,
224 float & orientedMeanCurvature,
225 float & orientedGaussianCurvature,
226 Point3df & normal, float & voronoiArea );
228 float & gaussianCurvature,
229 float & meanCurvature,
230 std::pair<float, float> & principalCurvatures,
231 float & orientedMeanCurvature,
232 float & orientedGaussianCurvature,
233 Point3df & normal, float & voronoiArea );
234 };
235
236
245 {
246 public: // typedefs
247
250
251 // constructors
252
255 bool verbose() const { return _verbose; }
256 void setVerbose( bool v ) { _verbose = v; }
257
258 // set & get
259
261 { return *_geom; }
263
264 // functions
265
266// bool operator()( size_t i );
268
270 static void cleanMesh( AimsSurfaceTriangle & mesh, float maxCurv = 0.5,
271 bool verbose=false );
272
273 private: // functions
274
275 // NB: neighbors should be a std::vector so far
276 // template < typename Neighborhood >
277 std::vector<Point2df>
278 simple_neighborhood_flattening(
279 const Point3df & point,
280 const GeometricProperties::Neighborhood & neighbors );
281
282 std::vector<Point2df>
283 simple_neighborhood_flattening(
284 const Point3df & point,
285 const std::vector<VertexPointer> & neighbors );
286
287 // data, input
289 bool _verbose;
290
291 };
292
293
302 std::list<AimsVector<uint, 3> >
303 simple_delaunay_triangulation( const std::vector<Point2df> & points,
304 bool verbose = false );
305
306}
307
308
309
310#endif
BarycenterCurvature(carto::rc_ptr< AimsSurfaceTriangle > mesh)
virtual Texture< float > doIt()
BarycenterCurvature(const AimsSurfaceTriangle &mesh)
BoixCurvature(carto::rc_ptr< AimsSurfaceTriangle > mesh)
virtual ~BoixCurvature()
virtual Texture< float > doIt()
BoixCurvature(const AimsSurfaceTriangle &mesh)
BoixGaussianCurvature(carto::rc_ptr< AimsSurfaceTriangle > mesh)
BoixGaussianCurvature(const AimsSurfaceTriangle &mesh)
virtual Texture< float > doIt()
Curvature * createCurvature(carto::rc_ptr< AimsSurfaceTriangle > mesh, const std::string &method)
Curvature * createCurvature(const AimsSurfaceTriangle &mesh, const std::string &method)
Curvature(carto::rc_ptr< AimsSurfaceTriangle > mesh)
static void getTextureProperties(const Texture< float > &tex)
virtual Texture< float > doIt()=0
Curvature(const AimsSurfaceTriangle &mesh)
virtual ~Curvature()
static void regularize(Texture< float > &tex, float ratio)
virtual Texture< float > doIt()
FiniteElementCurvature(carto::rc_ptr< AimsSurfaceTriangle > mesh)
FiniteElementCurvature(const AimsSurfaceTriangle &mesh)
void localProcess(size_t i_vert, float &gaussianCurvature, float &meanCurvature, std::pair< float, float > &principalCurvatures, float &orientedMeanCurvature, float &orientedGaussianCurvature, Point3df &normal, float &voronoiArea)
void localProcess(const VertexPointer &i, float &gaussianCurvature, float &meanCurvature, std::pair< float, float > &principalCurvatures, float &orientedMeanCurvature, float &orientedGaussianCurvature, Point3df &normal, float &voronoiArea)
virtual Texture< float > doIt()
GaussianCurvature(const AimsSurfaceTriangle &mesh)
GaussianCurvature(carto::rc_ptr< AimsSurfaceTriangle > mesh)
const WeightNeighborList & getSurface() const
NeighborList & getTriangleNeighbor()
std::list< unsigned > Neighborhood
Definition geometric.h:80
friend class VertexRemover
Definition geometric.h:146
GeometricProperties(carto::rc_ptr< AimsSurfaceTriangle > mesh)
constructor working on a non-const mesh
const NeighborList & getTriangleNeighbor() const
NeighborList & getNeighbor()
const WeightList & getSimpleAlpha() const
const NeighborList & getNeighbor() const
const WeightNeighborList & getDot() const
std::vector< float > WeightList
Definition geometric.h:83
std::vector< Neighborhood > NeighborList
Definition geometric.h:81
const AimsSurfaceTriangle & getMesh() const
meshgraph::MeshGraphFaces & getFaces()
Definition geometric.h:111
void sortPolygons(Neighborhood &npoly)
const meshgraph::MeshGraphVertices & getVertices() const
Definition geometric.h:109
const WeightList & getAlpha() const
meshgraph::MeshGraphVertices & getVertices()
Definition geometric.h:107
const WeightNeighborList & getPhi() const
const meshgraph::MeshGraphFaces & getFaces() const
Definition geometric.h:112
meshgraph::MeshVertexNode< uint >::VertexIndexCollection::value_type VertexPointer
Definition geometric.h:86
carto::rc_ptr< AimsSurfaceTriangle > getRcMesh()
void buildSortVerticesNeighborhood(size_t i)
const WeightNeighborList & getTheta() const
const WeightList & getBeta() const
GeometricProperties(const AimsSurfaceTriangle &mesh)
constructor working on a const mesh
std::vector< std::list< float > > WeightNeighborList
Definition geometric.h:82
VertexRemover(carto::rc_ptr< AimsSurfaceTriangle > mesh)
GeometricProperties & geometricProperties()
Definition geometric.h:262
void setVerbose(bool v)
Definition geometric.h:256
static void cleanMesh(AimsSurfaceTriangle &mesh, float maxCurv=0.5, bool verbose=false)
clean a whole mesh
const GeometricProperties & geometricProperties() const
Definition geometric.h:260
meshgraph::MeshVertexNode< uint >::VertexIndexCollection::value_type VertexPointer
Definition geometric.h:249
VertexRemover(carto::rc_ptr< GeometricProperties > geom)
bool verbose() const
Definition geometric.h:255
bool operator()(VertexPointer &i)
Mesh described as a graph, with nodes and edges.
Definition mesh_graph.h:64
Point3df cross(const Point3df &a, const Point3df &b)
Definition geometric.h:58
float sign(T x)
Definition geometric.h:46
std::list< MeshGraphFace > MeshGraphFaces
Definition mesh_graph.h:105
std::list< MeshGraphVertex > MeshGraphVertices
Definition mesh_graph.h:104
std::list< AimsVector< uint, 3 > > simple_delaunay_triangulation(const std::vector< Point2df > &points, bool verbose=false)
SimpleDelaunayTriangulation.
AIMSDATA_API AimsTimeSurface< 3, Void > AimsSurfaceTriangle
AimsVector< float, 3 > Point3df
AimsVector< float, 2 > Point2df