Hello,
Here's what I did:
1) mris_convert ?h.inflated file.asc 2) extract vertices of interest into file2.asc
Here is what I want to do: I want to import the vertices from file2.asc into tksurfer and apply the *path_new_path_from_marked_vertices *function so that I can then create a label. How might I do this?
Thanks, Aaron
The path is going to try to connect the vertices and make a label out of the interior. Is that what you want? If you just want a label from your list, that would be pretty easy to create.
Aaron Shmookler wrote:
Hello,
Here's what I did:
- mris_convert ?h.inflated file.asc
- extract vertices of interest into file2.asc
Here is what I want to do: I want to import the vertices from file2.asc into tksurfer and apply the path_new_path_from_marked_vertices function so that I can then create a label. How might I do this?
Thanks, Aaron
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Can you elaborate on what you mean by making a label "out of the interior?" Also, how would you make a label from my list?
A list of vertices is made from a path by creating a closed curve from the points along the path and using all the points in the interior of this closed curve.
A label file (.label) is a text file where the first two lines are "header" and each line after that is a vertex. The first line has the form:
#label , from subject YOURSUBJECTNAME
The next line is the number of vertices in your label
The following lines all have 5 columns of the form:
1. verteix number 2. vertex x 3. vertex y 4. vertex z 5. stat
you can just set the stat to 0
See $FREESURFER_HOME/subjects/fsaverage/label/lh.cortex.label for example.
#label , from subject fsaverage 149955 88 -42.261 -81.724 -13.242 0.000000 445 -28.781 -85.827 -16.289 0.000000 446 -39.862 -74.518 -14.432 0.000000 616 -42.856 -74.239 -5.499 0.000000 979 -35.991 -88.051 -14.552 0.000000
Aaron Shmookler wrote:
Can you elaborate on what you mean by making a label "out of the interior?" Also, how would you make a label from my list?
Do the vertex numbers mean anything significant or can they be any number?
Also, it appears that there are two different sets of vertices in an mris_convert asc file of ?h.inflated. What are these vertices and what do they mean?
Hi Aaron,
no, they don't really mean anything. They are a side effect of a number of algorithms (tesselation and topology correction). The .asc lists all the vertices, then all the faces:
int MRISwriteAscii(MRI_SURFACE *mris, char *fname) { int vno, fno, n ; VERTEX *v ; FACE *face ; FILE *fp ;
fp = fopen(fname, "w") ; if (!fp) ErrorReturn(ERROR_NOFILE, (ERROR_NOFILE, "MRISwriteAscii: could not open file %s",fname));
fprintf(fp, "#!ascii version of %s\n", mris->fname) ; fprintf(fp, "%d %d\n", mris->nvertices, mris->nfaces) ;
for (vno = 0 ; vno < mris->nvertices ; vno++) { v = &mris->vertices[vno] ; fprintf(fp, "%f %f %f %d\n", v->x, v->y, v->z, v->ripflag) ; } for (fno = 0 ; fno < mris->nfaces ; fno++) { face = &mris->faces[fno] ; for (n = 0 ; n < VERTICES_PER_FACE ; n++) fprintf(fp, "%d ", face->v[n]) ; fprintf(fp, "%d\n", face->ripflag) ; }
fclose(fp) ; return(NO_ERROR) ; }
chers, Bruce
On Wed, 30 Jul 2008, Aaron Shmookler wrote:
Do the vertex numbers mean anything significant or can they be any number?
Also, it appears that there are two different sets of vertices in an mris_convert asc file of ?h.inflated. What are these vertices and what do they mean?
Well, they mean something in that they are an index into a vertex, and if you're going to use the surface-based registration with mri_label2label, then you'll need to get them right.
doug
Bruce Fischl wrote:
Hi Aaron,
no, they don't really mean anything. They are a side effect of a number of algorithms (tesselation and topology correction). The .asc lists all the vertices, then all the faces:
int MRISwriteAscii(MRI_SURFACE *mris, char *fname) { int vno, fno, n ; VERTEX *v ; FACE *face ; FILE *fp ;
fp = fopen(fname, "w") ; if (!fp) ErrorReturn(ERROR_NOFILE, (ERROR_NOFILE, "MRISwriteAscii: could not open file %s",fname));
fprintf(fp, "#!ascii version of %s\n", mris->fname) ; fprintf(fp, "%d %d\n", mris->nvertices, mris->nfaces) ;
for (vno = 0 ; vno < mris->nvertices ; vno++) { v = &mris->vertices[vno] ; fprintf(fp, "%f %f %f %d\n", v->x, v->y, v->z, v->ripflag) ; } for (fno = 0 ; fno < mris->nfaces ; fno++) { face = &mris->faces[fno] ; for (n = 0 ; n < VERTICES_PER_FACE ; n++) fprintf(fp, "%d ", face->v[n]) ; fprintf(fp, "%d\n", face->ripflag) ; }
fclose(fp) ; return(NO_ERROR) ; }
chers, Bruce
On Wed, 30 Jul 2008, Aaron Shmookler wrote:
Do the vertex numbers mean anything significant or can they be any number?
Also, it appears that there are two different sets of vertices in an mris_convert asc file of ?h.inflated. What are these vertices and what do they mean?
Hi,* * So far I have been able to take my ?h.inflated file and turn it into a label file from my vertices of interest. That is, what I thought are my vertices of interest, namely a closed path around the caudal temporal pole. Given one vertex point I manually choose I want to generate a list of vertices holding 'z' constant and ordered in a clock (-y to +y). While I am getting vertices, the label I am getting is in the occipital lobe. Even after manipulating the numbers and vertices I still cannot manage to put a label on the TP, let alone outside the occipital lobe. Any thoughts and comments you may have would be greatly appreciated. Thanks! ~Aaron
<---begin script here (I am trying to make this work for one subject)--->
#!/bin/tcsh -ef
# acquire all vertices from lh.inflated file (when I execute this script I replace $subj with the actual subject, so this line of code works) mris_convert $subj/surf/lh.inflated ~/Desktop/test.asc
# extract vertices outlining the temporal pole caudal border given constant 'z.' # The constant 'z' I think exists only once; other points along the path have a slightly different 'z'. # Therefore, I give a very small range of 'z' values that I hope are close enough to represent the caudal border # The 'z' coordinate is -61.0105, so search from -62 to -61 # sort the second column, which contains 'y' values cat ~/Desktop/test.asc | awk '{ if($3 > -62 && $3 < -61) print $1, $2, $3, $4}' | sort -n -k2 > ~/Desktop/extract.asc
#echo header 1st line, label information, into label file echo '#! label , from subject $SUBJ/ vox2ras=TkReg coords=white' > ~/Desktop/caudal_border.label
#echo header 2nd line, the number of ROI vertices, into label file cat ~/Desktop/extract.asc | awk 'END{print NR}' >> ~/Desktop/caudal_border.label
#echo ROI vertices into label file with number lines (cat -n) substituting for vertex numbers cat -n ~/Desktop/extract.asc >> ~/Desktop/caudal_border.label
#mris_anatomical_stats the label file -- to be written once appropriate label has been acquired
freesurfer@nmr.mgh.harvard.edu