cortical_surface  5.0.5
conformalMapping.h
Go to the documentation of this file.
1 /*
2  * This software and supporting documentation were developed by
3  * CNRS, labo LSIS, UMR6168, Marseille, France
4  * olivier.coulon@univmed.fr
5  */
6 
7 
8 
9 #ifndef AIMS_CONFORMALMAPPING_H
10 #define AIMS_CONFORMALMAPPING_H
11 
12 #include <aims/mesh/texture.h>
13 #include <aims/mesh/curv.h>
15 #include <aims/io/reader.h>
16 #include <aims/io/writer.h>
17 
18 
19 // This class implement the conformal mapping of a mesh to
20 // the unit sphere as defined in Gu et al., IEEE Tr on Med Im.
21 //, vol23, no8, pp 949-958, 2004
22 //
23 // the idea is to minimize the harmonic energy and add constraints
24 // such as zero-mass center and maybe landmarks
25 
26 
27 namespace aims
28 {
30  {
31  public:
32  ConformalMapping(std::string adr_mesh, float dt, float dE) :
33  _dt(dt), _dE(dE)
34  {
36  r.read( _mesh );
37  _nv=_mesh.vertex().size();
38  _tuetteMap=std::vector<Point3df>(_nv);
39  _conformalMap=std::vector<Point3df>(_nv);
40  _neigh= SurfaceManip::surfaceNeighbours(_mesh);
41  ComputeEdges();
43  }
44  ConformalMapping(AimsSurfaceTriangle mesh, float dt, float dE) :
45  _mesh(mesh), _dt(dt), _dE(dE)
46  {
47  _nv=_mesh.vertex().size();
48  _tuetteMap=std::vector<Point3df>(_nv);
49  _conformalMap=std::vector<Point3df>(_nv);
50  _neigh= SurfaceManip::surfaceNeighbours(_mesh);
51  ComputeEdges();
53  }
54 
55  void ComputeEdges();
57  void TuetteMap();
58  void ConformalMap(std::string adr_tuette);
59 
61  AimsSurfaceTriangle GetConformalMapping(std::string adr_tuette);
62  float TuetteEnergy();
63  float HarmonicEnergy();
64  void WriteConformalCoordinates(std::string latpath, std::string lonpath);
65 
66  private:
67  AimsSurfaceTriangle _mesh;
68  float _dt;
69  float _dE;
70 
71  uint _nv;
72  std::vector<std::set<uint> > _neigh;
73  std::vector<AimsVector<uint,2> > _edges;
74  std::vector<std::set<std::pair<uint, uint> > > _edgeMap;
75 
76  std::vector<float> _harmonicCoef;
77  std::vector<Point3df> _tuetteMap;
78  std::vector<Point3df> _conformalMap;
79  std::vector<float> _conformalLon;
80  std::vector<float> _conformalLat;
81 
82  void buildEdgeMap();
83  uint whichEdge(uint v1, uint v2);
84  Point3df getCenterOfMass(std::vector<Point3df> tmpMap);
85  void ComputeConformalCoordinates();
86  };
87 }
88 
89 #endif
AIMSDATA_API AimsTimeSurface< 3, Void > AimsSurfaceTriangle
void ConformalMap(std::string adr_tuette)
void ComputeHarmonicCoefficients()
AimsSurfaceTriangle GetTuetteMapping()
AimsSurfaceTriangle GetConformalMapping(std::string adr_tuette)
ConformalMapping(AimsSurfaceTriangle mesh, float dt, float dE)
static std::vector< std::set< uint > > surfaceNeighbours(const AimsSurface< D, T > &surf)
void WriteConformalCoordinates(std::string latpath, std::string lonpath)
ConformalMapping(std::string adr_mesh, float dt, float dE)
unsigned int uint
virtual bool read(T &obj, int border=0, const std::string *format=0, int frame=-1)