35 #ifndef AIMS_DISTANCEMAP_PROJECTION_H 36 #define AIMS_DISTANCEMAP_PROJECTION_H 55 namespace meshdistance
69 float alpha,
float dmin,
71 const std::map <short,std::string> & trans,
72 const std::set<std::string> & labels,
73 float maxdil,
float maxdil_mesh,
float alpha_reg,
75 const std::vector<std::list<unsigned> > & neigho);
82 float demin,
float dpmin,
84 const std::map <short,std::string> & trans,
85 const std::set<std::string> & labels,
86 float maxdil,
float maxdil_mesh,
float alpha_reg,
88 const std::vector<std::list<unsigned> > & neigho);
95 std::set<short> &cc_sulci_labels,
96 std::map<short,short > &tri_sulci,
97 std::map<unsigned, Point3dfSet > &cc_sulci_coord,
99 Point3dfCompare > &initend,
101 float alpha,
float dmin);
107 std::set<short> &cc_sulci_labels,
108 std::map<short,short > &tri_sulci,
110 Point3dfCompare > &neigh,
111 std::map<unsigned, Point3dfSet > &cc_sulci_coord,
112 std::map<Point3df, Point3df, Point3dfCompare > &initend,
113 float demin,
float dpmin,
114 short label_insula_left,
short label_insula_right,
120 const std::map<Point3df, Point3df, Point3dfCompare >
124 float dmin,
float alpha_reg );
140 NeighbourInCC(std::map<Point3df, Point3dfSet, Point3dfCompare > &neigh,
143 short label,
const unsigned size_neigh,
144 unsigned max_points = 50);
155 std::pair<Point3df,Point3df> output;
156 unsigned inc = 0, i=0,j=0,n = init_point.size();
160 Point3dfSet::const_iterator is,es;
162 for (is = init_point.begin(), es = init_point.end(); is != es; ++is)
165 mean = mean / (float)n;
167 for (is = init_point.begin(), es = init_point.end(); is != es; ++is,
169 norm_point.insert(*is - mean);
172 for (is = norm_point.begin(), es = norm_point.end(); is != es; ++is,
178 cov(i,j) += temp[i] * temp[j];
183 eigen.
sort(cov,value);
190 output.second = temp;
200 unsigned inc = 0, i=0,j=0;
204 Point3dfSet::const_iterator is,es;
208 for (is = init_point.begin(), es = init_point.end(); is != es; ++is, ++inc)
209 norm_point.insert(*is - pt);
212 for (is = norm_point.begin(), es = norm_point.end(); is != es; ++is, ++inc)
217 cov(i,j) += temp[i] * temp[j];
222 eigen.
sort(cov,value);
237 C[0] = A[1] * B[2] - A[2] * B[1];
238 C[1] = A[2] * B[0] - A[0] * B[2];
239 C[2] = A[0] * B[1] - A[1] * B[0];
258 Point3df pt_intersection, normal_tri;
262 normal_tri =
cross(s1 - s2,s1 - s3);
276 a = direction_line[0];
277 b = direction_line[1];
278 c = direction_line[2];
285 pt_intersection[0] = (c * c0 * xm +
292 ( c * c0 + a * a0 + b0 * b);
295 pt_intersection[1] = ( b * c0 * zb +
302 (c * c0 + a * a0 + b0 * b);
304 pt_intersection[2] = ( c * c0 * zb
311 (c * c0 + a * a0 + b0 * b);
313 return (pt_intersection);
325 d = fabs( temp.
dot(plane.second) );
354 Point3dfNeigh::const_iterator is,es = neigh.
end();
355 std::vector<Point3df>::const_iterator icc,ecc = cc.end();
359 while (!ok1 && icc != ecc)
362 is = neigh.find(PtR);
365 if (is->second.size() > MIN_NEIGH)
372 std::cerr <<
"Pb1: cannot find the neighbours of the point " 378 for(icc = cc.begin(); icc != ecc; ++icc)
381 is = neigh.find(PtR);
384 if (is->second.size() > MIN_NEIGH)
388 std::cerr <<
"Pb2: cannot find the neighbours of the point " 390 normal_plan *= normal_plan.
dot(n1);
391 normal_plan.normalize();
396 std::cout <<
"CC mean normal : "<< n0 << std::endl;
const short MESHDISTANCE_FORBIDDEN
global variable...
Texture< short > VolumeParcellation2MeshParcellation(const AimsData< short > &initVol, const AimsSurface< 3, Void > &mesh, short back)
TimeTexture< short > SulcusVolume2Texture(const AimsSurface< 3, Void > &mesh, const Texture< float > &curvtex, const AimsData< short > &bottom_vol, const AimsData< short > &surface_vol, float alpha, float dmin, int MINCC, const std::map< short, std::string > &trans, const std::set< std::string > &labels, float maxdil, float maxdil_mesh, float alpha_reg, bool connexity, const std::vector< std::list< unsigned > > &neigho)
Projection of the voxels relative to the bottom of the sulci to the edges of a triangulation.
Point3df meanNormalofCC(const std::vector< Point3df > &cc, const Point3dfNeigh &neigh, unsigned MIN_NEIGH)
Point3df cross(const Point3df &A, const Point3df &B)
AimsVector< T, D > & normalize()
float DistancePointToPlane(const Point3df &A, const std::pair< Point3df, Point3df > &plane)
Texture< short > FirstSulciProjectionWithCurvatureMap(const AimsData< short > &ccvol, const AimsData< short > &sulcvol, const AimsSurface< 3, Void > &mesh, std::set< short > &cc_sulci_labels, std::map< short, short > &tri_sulci, std::map< unsigned, Point3dfSet > &cc_sulci_coord, std::map< Point3df, Point3df, Point3dfCompare > &initend, const Texture< float > &curvtex, float alpha, float dmin)
void NeighbourInCC(std::map< Point3df, Point3dfSet, Point3dfCompare > &neigh, const AimsData< short > &bvol, const AimsData< short > &svol, Connectivity::Type connectivity, short label, const unsigned size_neigh, unsigned max_points=50)
Give the neighbours of a point The neighbours have the same label as the point.
void AffinePointProjection(Texture< short > &tex, const AimsSurface< 3, Void > &mesh, const std::map< Point3df, Point3df, Point3dfCompare > &initend, const Point3dfSet &setpointi, short label, float dmin, float alpha_reg)
AimsData< T > doit(AimsData< T > &, AimsData< T > *wi=NULL)
Eigen system resolution function.
T dot(const AimsVector< T, D > &other) const
std::pair< Point3df, Point3df > NormalFromPoints(const Point3dfSet &init_point)
std::set< Point3df, Point3dfCompare > Point3dfSet
float DistancePointToLine(const Point3df &A, const std::pair< Point3df, Point3df > &line)
std::map< Point3df, Point3dfSet, Point3dfCompare > Point3dfNeigh
void sort(AimsData< T > &eigenvectors, AimsData< T > &eigenvalues, AimsData< T > *wi=NULL)
Sort the eigenvectors and eigenvalues in decreasing order.
Texture< short > FirstSulciProjectionWithInterpolationPlane(const AimsData< short > &ccvol, const AimsData< short > &sulcvol, const AimsSurface< 3, Void > &mesh, std::set< short > &cc_sulci_labels, std::map< short, short > &tri_sulci, const std::map< Point3df, Point3dfSet, Point3dfCompare > &neigh, std::map< unsigned, Point3dfSet > &cc_sulci_coord, std::map< Point3df, Point3df, Point3dfCompare > &initend, float demin, float dpmin, short label_insula_left, short label_insula_right, const Point3df &CA)
Point3df IntersectionPointOfPlanAndLine(const Point3df &s1, const Point3df &s2, const Point3df &s3, const Point3df &direction_line, const Point3df &pt)
const short MESHDISTANCE_UNREACHED
AimsData< short > MeshParcellation2Volume(const AimsData< short > &initVol, const Texture< short > &tex, const AimsSurface< 3, Void > &mesh, short val_domain, short back)