part of this code is to use the coordinate system that David van Essen has been advocating (pole at the ventral tip of the central sulcus, prime meridian along the fundus of the cs): x = mris->vertices[vindex].cx ;
static float e0[3] = {0.08, -0.73, 0.67} ; static float e1[3] = {0.57, 0.58, 0.57} ; static float e2[3] = {-0.82, 0.34, 0.47} ;
float sx, sy, sz, r, d, phi, theta ;
x = mris->vertices[vindex].cx ; y = mris->vertices[vindex].cy ; z = mris->vertices[vindex].cz ; sx = x*e0[0] + y*e0[1] + z*e0[2] ; sy = x*e1[0] + y*e1[1] + z*e1[2] ; sz = x*e2[0] + y*e2[1] + z*e2[2] ; x = sx ; y = sy ; z = sz ;
r = sqrt(x*x + y*y + z*z) ; d = r*r-z*z ; if (d < 0.0) d = 0.0 ;
phi = atan2(sqrt(d), z) ; theta = atan2(y/r, x/r) ; printf("SPHERICAL (%2.1f %2.1f %2.1f): (%2.1f, %2.1f)\n",sx,sy,sz, DEGREES(phi), DEGREES(theta));
where c[xyz] are the coordinates from the ?h.sphere.reg file
cheers, Bruce
On Thu, 6 Jan 2005, Sergey A Solovyev wrote:
Hello Bruce,
Could you please let me know which function to call to convert RAS->spherical(rho,theta)?
Thank you very much, --Serge
Bruce Fischl wrote:
Hi Serge,
convert the ?h.sphere.reg file to ascii format, and lookup the verices in it. That will give you (x,y,z) that you can convert to (rho,theta)
On Thu, 6 Jan 2005, Sergey A Solovyev wrote:
Many thanks, it works great.
The remaining problem is to convert vertex indexes/RAS coordinates into spherical coordinates (rho,theta), ascii text file, or print all spherical coordinates for a patch/label.
--Serge
Kevin Teich wrote:
That's true; you'll get an index, original RAS coordinates, and the overlay value for each vertex in the label.
On Thu, 6 Jan 2005, Bruce Fischl wrote:
if you save a label with a statistical overlay, the stat field in the label (the last field in each row) should have the statistic at that point. Isn't that right Kevin?
Bruce
On Thu, 6 Jan 2005, Kevin Teich wrote:
> I wonder if there is a way to save all information above (index, > spherical coordinates, overlaid functionals values) into an > ascii text > file for all vertexes located within a certain label (patch)?
The only thing close to this is the Save Summary function for time courses. But it's not going to save all the information you want, so, sorry, but no.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer