-
Notifications
You must be signed in to change notification settings - Fork 2
26. Coordinates of the template subject in FreeSurfer
Here are descriptions of the brain model for the 'fsaverage' subject (MNI atlas) in FreeSurfer.
The Matlab data file includes the vertices and faces of the brain surface (pial) of the brain models for left and right hemispheres.
lh_faces
and rh_faces
are faces for the left and right hemisphere model, respectively. These are 0-based indices (i.e., 0 indicates the first vertex).
lh_vertices
and rh_vertices
are vertices for the left and right hemisphere model, respectively.
Brain models can be shown in Matlab by the following script:
h=patch('faces',rh_faces+1,'vertices',rh_vertices,'facecolor',[1 1 1].*0.8,'edgecolor','none');
material dull;
axis off vis3d equal;
camlight;
set(gcf,'color','w');
view(90,0);
Coordinates of the first 10242 vertices, which are used for STC files after spatial morphing, can be viewed by the following command.
h=plot3(rh_vertices(1:10242,1),rh_vertices(1:10242,2),rh_vertices(1:10242,3),'r.');
Because a brain model can be represented in a "sphere" in FreeSurfer, Here is the script to shown the right hemisphere "brain sphere".
h=patch('faces',rh_faces+1,'vertices',rh_vertices_sph,'facecolor',[1 1 1].*0.8,'edgecolor','none');
material dull;
axis off vis3d equal;
camlight;
set(gcf,'color','w');
view(90,0);
The corresponding first 10,242 vertices can be visualized over a sphere.
h=plot3(rh_vertices_sph(1:10242,1),rh_vertices_sph(1:10242,2),rh_vertices_sph(1:10242,3),'r.');
Now it is clear that the carefully chosen vertices are organized in a very regular surface structure: Every vertices are surrounded by five neighboring vertices.
We use knnsearch
function in Matlab to search the nearest coordinates among the first 10,242 vertices. Take a look if we found them correctly.
[lh_neighbor_vertices,dist]=knnsearch(lh_vertices_sph(1:10242,:), lh_vertices_sph(1:10242,:),'K',6);
[rh_neighbor_vertices,dist]=knnsearch(rh_vertices_sph(1:10242,:), rh_vertices_sph(1:10242,:),'K',6);
hh=plot3(rh_vertices_sph(rh_neighbor_vertices(1,1:6),1),rh_vertices_sph(rh_neighbor_vertices(1,1:6),2),rh_vertices_sph(rh_neighbor_vertices(1,1:6),3),'gx');
Indeed we found them.
To transform neighboring vertices into 0-based indices, we need to subtract them by one.
lh_neighbor_vertices=lh_neighbor_vertices-1;
rh_neighbor_vertices=rh_neighbor_vertices-1;
Variables lh_neighbor_vertices
and rh_neighbor_vertices
includes the vertices (0-based) of the nearest neighbors. All vertices have the five nearest neighbors in approximate the same distance in the spherical coordinate representation.