aimsalgo  5.0.5
Neuroimaging image processing
curv.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_MESHCURVATURE_H
37 #define AIMS_MESH_MESHCURVATURE_H
38 
39 #include <aims/mesh/texture.h>
40 #include <aims/mesh/surface.h>
41 #include <aims/data/data.h>
42 #include <list>
43 
44 inline float fsign(float x);
45 inline Point3df cross(Point3df a, Point3df b);
46 
47 
49 
50 //Estimation of the time step dt for the diffusion equation.
51 float AimsMeshFiniteElementDt( const Texture<float> &tex,
52  const Texture<float> &lapl,
53  float tmax);
54 
55 //Estimation of the curvature. Boix method
57  const std::vector<float> & ALPHA,
58  const std::vector<float> & BETA,
59  const std::vector<std::list<float> > & SURFACE);
60 
61 //Regularization of a texture map.
62 //Definition of the Outliers from the histogram
64  const AimsSurface<3,Void> & mesh,
65  float alpha );
66 
68  float ratio );
69 //Estimation of the curvature (finite element method)
71  const std::vector< std::list<unsigned> > & neighbourso,
72  const std::vector< std::list<float> > & PHI,
73  const std::vector< std::list<float> > & THETA,
74  const std::vector< std::list<float> > & SURFACE,
75  const std::vector< std::list<float> > & DOT);
76 
77 //Eequired for the curvature and the laplacian estimation (finite element method).
78 std::vector< std::list<float> > AimsMeshFiniteElementPhi( const AimsSurface<3,Void> & mesh,
79  const std::vector< std::list<unsigned> > & neighbourso,
80  const std::vector< std::list<float> > & surf);
81 
82 //Eequired for the curvature and the laplacian estimation (finite element method).
83 std::vector< std::list<float> > AimsMeshFiniteElementTheta( const AimsSurface<3,Void> & mesh,
84  const std::vector< std::list<unsigned> > & neighbourso,
85  const std::vector< std::list<float> > & surf);
86 //Eequired for the curvature and the laplacian estimation (finite element method).
87 std::vector<float> AimsMeshFiniteElementAlpha( const AimsSurface<3,Void> & mesh,
88  const std::vector< std::list<unsigned> > & neighbourso);
89 
90 //Eequired for the curvature estimation (boix method).
91 std::vector<float> AimsMeshFiniteElementBeta( const AimsSurface<3,Void> & mesh,
92  const std::vector< std::list<unsigned> > & neighbourso);
93 
94 //Required for the curvature and the laplacian estimation (finite element and boix method).
95 //The first list element for each coordinate i of the vector
96 //Correspond to the total surface of the patch surrounding the node i.
97 std::vector< std::list<float> > AimsMeshFiniteElementSurface( const AimsSurface<3,Void> & mesh,
98  const std::vector< std::list<unsigned> > & neighbourso);
99 
100 //Eequired for the curvature and the laplacian estimation (finite element method).
101 std::vector< std::list<float> > AimsMeshFiniteElementDot( const AimsSurface<3,Void> & mesh,
102  const std::vector< std::list<unsigned> > & neighbourso);
103 
104 
105 //Give for each node the clockwise ordered list of neighbours nodes
106 std::vector< std::list<unsigned> > AimsMeshOrderNode(const AimsSurface<3,Void> & mesh);
107 
108 //Give for each node the clockwise ordered list of neighbours triangles.
109 std::vector< std::list<unsigned> > AimsMeshOrderTriangle(const AimsSurface<3,Void> & mesh);
110 
111 //Estimation of the laplacian of a texture map; (finite element method).
112 
114  const std::map<unsigned,
115  std::set< std::pair<unsigned,
116  float> > > &lapl);
117 
118 template <typename T>
119 void AimsMeshLaplacian( const std::vector<T> &inittex,
120  std::vector<T> & outtex,
121  const std::map<unsigned,
122  std::set< std::pair<unsigned,float> > > &lapl);
123 
124 
125 std::map<unsigned, std::set< std::pair<unsigned,float> > > AimsMeshWeightFiniteElementLaplacian( const AimsSurface<3,Void> & mesh,
126  const float Wmax);
127 
128 namespace aims
129 {
130  typedef std::map<unsigned, std::set< std::pair<unsigned,float> > >
132 
133  void makeLaplacianMatrix( const LaplacianWeights & weights,
134  LaplacianWeights & lmat, float dt );
135 
137  const LaplacianWeights & in2,
138  float sparseThresh=0 );
139 
140  template <typename T>
141  void applyLaplacianMatrix( const std::vector<T> &inittex,
142  std::vector<T> & outtex,
143  const LaplacianWeights &lapl );
144 
145  void laplacianMatrixThreshold( LaplacianWeights & lmat, float threshold );
146 
155  const LaplacianWeights & weights, unsigned niter, float dt,
156  float sparseThresh=0 );
157 
158 }
159 
160 #endif
std::vector< std::list< float > > AimsMeshFiniteElementPhi(const AimsSurface< 3, Void > &mesh, const std::vector< std::list< unsigned > > &neighbourso, const std::vector< std::list< float > > &surf)
void makeLaplacianMatrix(const LaplacianWeights &weights, LaplacianWeights &lmat, float dt)
std::vector< std::list< float > > AimsMeshFiniteElementDot(const AimsSurface< 3, Void > &mesh, const std::vector< std::list< unsigned > > &neighbourso)
std::map< unsigned, std::set< std::pair< unsigned, float > > > LaplacianWeights
Definition: curv.h:131
std::vector< std::list< float > > AimsMeshFiniteElementSurface(const AimsSurface< 3, Void > &mesh, const std::vector< std::list< unsigned > > &neighbourso)
Texture< float > AimsMeshBoixCurvature(const AimsSurface< 3, Void > &mesh, const std::vector< float > &ALPHA, const std::vector< float > &BETA, const std::vector< std::list< float > > &SURFACE)
float fsign(float x)
std::map< unsigned, std::set< std::pair< unsigned, float > > > AimsMeshWeightFiniteElementLaplacian(const AimsSurface< 3, Void > &mesh, const float Wmax)
TimeTexture< float > AimsMeshCurvature(const AimsSurface< 3, Void > &mesh)
void applyLaplacianMatrix(const std::vector< T > &inittex, std::vector< T > &outtex, const LaplacianWeights &lapl)
std::vector< float > AimsMeshFiniteElementBeta(const AimsSurface< 3, Void > &mesh, const std::vector< std::list< unsigned > > &neighbourso)
std::vector< std::list< float > > AimsMeshFiniteElementTheta(const AimsSurface< 3, Void > &mesh, const std::vector< std::list< unsigned > > &neighbourso, const std::vector< std::list< float > > &surf)
float AimsMeshFiniteElementDt(const Texture< float > &tex, const Texture< float > &lapl, float tmax)
Texture< float > AimsMeshLaplacian(const Texture< float > &inittex, const std::map< unsigned, std::set< std::pair< unsigned, float > > > &lapl)
Point3df cross(Point3df a, Point3df b)
Definition: geometric.h:56
Texture< float > AimsRegularizeTexture(const Texture< float > &tex, const AimsSurface< 3, Void > &mesh, float alpha)
std::vector< std::list< unsigned > > AimsMeshOrderNode(const AimsSurface< 3, Void > &mesh)
Texture< float > AimsMeshFiniteElementCurvature(const AimsSurface< 3, Void > &mesh, const std::vector< std::list< unsigned > > &neighbourso, const std::vector< std::list< float > > &PHI, const std::vector< std::list< float > > &THETA, const std::vector< std::list< float > > &SURFACE, const std::vector< std::list< float > > &DOT)
LaplacianWeights * sparseMult(const LaplacianWeights &in1, const LaplacianWeights &in2, float sparseThresh=0)
void laplacianMatrixThreshold(LaplacianWeights &lmat, float threshold)
std::vector< std::list< unsigned > > AimsMeshOrderTriangle(const AimsSurface< 3, Void > &mesh)
LaplacianWeights * makeLaplacianSmoothingCoefficients(const LaplacianWeights &weights, unsigned niter, float dt, float sparseThresh=0)
Compute Laplacian smoothing coefficients matrix for niter smoothing iterations.
std::vector< float > AimsMeshFiniteElementAlpha(const AimsSurface< 3, Void > &mesh, const std::vector< std::list< unsigned > > &neighbourso)