Hi Don

mris_convert -n lh.white lh.white.normals.asc

should do the trick. And this is the way that the area is computed (from mrisurf.c):

static float
mrisTriangleArea(MRIS *mris, int fac, int n)
{
  int n0,n1;
  face_type *f;
  float v0[3],v1[3],d1,d2,d3;

  n0 = (n == 0)                   ? VERTICES_PER_FACE-1 : n-1;
  n1 = (n == VERTICES_PER_FACE-1) ? 0                   : n+1;
  f = &mris->faces[fac];
  v0[0] = mris->vertices[f->v[n]].x - mris->vertices[f->v[n0]].x;
  v0[1] = mris->vertices[f->v[n]].y - mris->vertices[f->v[n0]].y;
  v0[2] = mris->vertices[f->v[n]].z - mris->vertices[f->v[n0]].z;
  v1[0] = mris->vertices[f->v[n1]].x - mris->vertices[f->v[n]].x;
  v1[1] = mris->vertices[f->v[n1]].y - mris->vertices[f->v[n]].y;
  v1[2] = mris->vertices[f->v[n1]].z - mris->vertices[f->v[n]].z;
  d1 = -v1[1]*v0[2] + v0[1]*v1[2];
  d2 = v1[0]*v0[2] - v0[0]*v1[2];
  d3 = -v1[0]*v0[1] + v0[0]*v1[1];
  return sqrt(d1*d1+d2*d2+d3*d3)/2;
}



cheers
Bruce


On Tue, 13 Oct 2015, Krieger, Donald N. wrote:


Hi everyone,

 

I need to create the vector normal to the surface at each “white” vertex.

I would like to end up with 7 fields in each entry:

1         Vertex number

2-4  RAS coordinates

5-7 RAS components of the normal vector pointed from ctx à wm

 

mri_annotation2label gets me the first 4.

I just don’t want to reinvent the wheel getting the normal.

If there’s a way to get freesurfer to kick out the normals, that would be
best.

Here are naïve questions that arise out of this problem:

1.       Is there a simple way to identify which vertices are “nearest
neighbors” other than measuring and sorting the distances between each and
all the others i.e. which ones form a triangle?  I understand to use the
normalized average of the 6 triangles which include the vertex.

2.       Is there a simple way to identify the order of the sides of each triangle so that their cross product is ordered correctly to produce ctx à wm?

 

Thanks for your help with this.

 

Don

 


_______________________________________________
Freesurfer mailing list
[email protected]
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Reply via email to