Re: [Freesurfer] How to use aparcstats2table and asegstats2table for rois generated from QDEC group analyses
Try asegstats2table --stats=lh.roi.stats--meas volume --skip --tablefile $OUTFILE doug On 05/17/2012 04:04 PM, Vy Dinh wrote: Dear Freesurfer Experts, I've created a couple of ROIs from qdec comparisons of thickness and volume between two groups. We extracted the data from these ROIs for each subject using mris_anatomical_stats. The stat files are located within each subjects folder: sub/stats/rh.roi.stats Now, we would like to combine the data from each stat file to a text file using aparcstats2table and asegstats2table (for volume measures). I already have batch scripts that call these functions for multiple subjects. The script basically concatenates all of the subject ids and inputs the concatenated string into the aparcstats2table (or asegstats2table) command. EX: asegstats2table -s s1 -s s2 -s s3 -s s4 --hemi lh --meas volume -tablefile test_stats.txt I would like to modify my script so that I can extract the data from the roi.stats file. This is only a matter of entering the correct inputs for aparcstats2table and asegstats2table but I have tried with little success. The problems with each command are explained below. *For asegstats2table:* According to documentation (http://surfer.nmr.mgh.harvard.edu/fswiki/asegstats2table), I have tried running asegstats2table $STRING --meas volume --skip --tablefile $OUTFILE where string is -i s1/stats/lh.roi.stats -i s2/stats/lh.roi.stats ..etc but get the error message: Building the table.. Traceback (most recent call last): File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 513, in module rows, columns, table = sanitize_table(options, pretable) File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 412, in sanitize_table _specs, _id_name_map, _measl = _t[0] IndexError: list index out of range *For aparcstats2table: * when I run the command: aparcstats2table $STRING --hemi lh --parc roi_name --skip --tablefile $OUTFILE where string is-s s1 -s s2 -s s3 , I get a text file with 3 columns. The first column lists the subject ids, but what are the values for the 2nd and 3rd columns? Also, is it possible to input more than 2 .stats file for the command? Looking forward to your responses, Vy Vy T.U. Dinh Neurological Sciences Rush University Medical Center Phone: (312) 563-3853 tel:%28312%29%20563-3853 Fax: (312) 563-4660 tel:%28312%29%20563-4660 Email: vy_d...@rush.edu mailto:vy_d...@rush.edu ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer -- Douglas N. Greve, Ph.D. MGH-NMR Center gr...@nmr.mgh.harvard.edu Phone Number: 617-724-2358 Fax: 617-726-7422 Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu 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.
Re: [Freesurfer] How to use aparcstats2table and asegstats2table for rois generated from QDEC group analyses
How did I miss this asegstats2table script? It looks great...and here I've been writing my own bash scripts to get the data out. - J On Fri, May 18, 2012 at 1:59 PM, Douglas N Greve gr...@nmr.mgh.harvard.eduwrote: Try asegstats2table --stats=lh.roi.stats--meas volume --skip --tablefile $OUTFILE doug On 05/17/2012 04:04 PM, Vy Dinh wrote: Dear Freesurfer Experts, I've created a couple of ROIs from qdec comparisons of thickness and volume between two groups. We extracted the data from these ROIs for each subject using mris_anatomical_stats. The stat files are located within each subjects folder: sub/stats/rh.roi.stats Now, we would like to combine the data from each stat file to a text file using aparcstats2table and asegstats2table (for volume measures). I already have batch scripts that call these functions for multiple subjects. The script basically concatenates all of the subject ids and inputs the concatenated string into the aparcstats2table (or asegstats2table) command. EX: asegstats2table -s s1 -s s2 -s s3 -s s4 --hemi lh --meas volume -tablefile test_stats.txt I would like to modify my script so that I can extract the data from the roi.stats file. This is only a matter of entering the correct inputs for aparcstats2table and asegstats2table but I have tried with little success. The problems with each command are explained below. *For asegstats2table:* According to documentation (http://surfer.nmr.mgh.harvard.edu/fswiki/asegstats2table), I have tried running asegstats2table $STRING --meas volume --skip --tablefile $OUTFILE where string is -i s1/stats/lh.roi.stats -i s2/stats/lh.roi.stats ..etc but get the error message: Building the table.. Traceback (most recent call last): File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 513, in module rows, columns, table = sanitize_table(options, pretable) File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 412, in sanitize_table _specs, _id_name_map, _measl = _t[0] IndexError: list index out of range *For aparcstats2table: * when I run the command: aparcstats2table $STRING --hemi lh --parc roi_name --skip --tablefile $OUTFILE where string is-s s1 -s s2 -s s3 , I get a text file with 3 columns. The first column lists the subject ids, but what are the values for the 2nd and 3rd columns? Also, is it possible to input more than 2 .stats file for the command? Looking forward to your responses, Vy Vy T.U. Dinh Neurological Sciences Rush University Medical Center Phone: (312) 563-3853 tel:%28312%29%20563-3853 Fax: (312) 563-4660 tel:%28312%29%20563-4660 Email: vy_d...@rush.edu mailto:vy_d...@rush.edu ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer -- Douglas N. Greve, Ph.D. MGH-NMR Center gr...@nmr.mgh.harvard.edu Phone Number: 617-724-2358 Fax: 617-726-7422 Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu 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. ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu 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.
Re: [Freesurfer] How to use aparcstats2table and asegstats2table for rois generated from QDEC group analyses
Why not use a bash or csh script that loops through your subjects stat files, and use grep read the appropriate lines to a single text file with . - Josh On Thu, May 17, 2012 at 1:04 PM, Vy Dinh vy_d...@rush.edu wrote: Dear Freesurfer Experts, I've created a couple of ROIs from qdec comparisons of thickness and volume between two groups. We extracted the data from these ROIs for each subject using mris_anatomical_stats. The stat files are located within each subjects folder: sub/stats/rh.roi.stats Now, we would like to combine the data from each stat file to a text file using aparcstats2table and asegstats2table (for volume measures). I already have batch scripts that call these functions for multiple subjects. The script basically concatenates all of the subject ids and inputs the concatenated string into the aparcstats2table (or asegstats2table) command. EX: asegstats2table -s s1 -s s2 -s s3 -s s4 --hemi lh --meas volume -tablefile test_stats.txt I would like to modify my script so that I can extract the data from the roi.stats file. This is only a matter of entering the correct inputs for aparcstats2table and asegstats2table but I have tried with little success. The problems with each command are explained below. For asegstats2table: According to documentation (http://surfer.nmr.mgh.harvard.edu/fswiki/asegstats2table), I have tried running asegstats2table $STRING --meas volume --skip --tablefile $OUTFILE where string is -i s1/stats/lh.roi.stats -i s2/stats/lh.roi.stats ..etc but get the error message: Building the table.. Traceback (most recent call last): File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 513, in module rows, columns, table = sanitize_table(options, pretable) File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 412, in sanitize_table _specs, _id_name_map, _measl = _t[0] IndexError: list index out of range For aparcstats2table: when I run the command: aparcstats2table $STRING --hemi lh --parc roi_name --skip --tablefile $OUTFILE where string is -s s1 -s s2 -s s3 , I get a text file with 3 columns. The first column lists the subject ids, but what are the values for the 2nd and 3rd columns? Also, is it possible to input more than 2 .stats file for the command? Looking forward to your responses, Vy Vy T.U. Dinh Neurological Sciences Rush University Medical Center Phone: (312) 563-3853 Fax: (312) 563-4660 Email: vy_d...@rush.edu ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu 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. ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] How to use aparcstats2table and asegstats2table for rois generated from QDEC group analyses
Thanks for the suggestion Josh! I have definitely thought about this, but since I'm a total novice bash programmer, I thought that it would be quicker to learn which option to add to asegstats2table and aparcstats2table. I would really appreciate it if you could help me come up with this code? What shell function could I use to open each .stats file? How do I use grep to call, say line 53 in the stats file? Many thanks, Vy On Thu, May 17, 2012 at 4:19 PM, Joshua Lee jki...@ucdavis.edu wrote: Why not use a bash or csh script that loops through your subjects stat files, and use grep read the appropriate lines to a single text file with . - Josh On Thu, May 17, 2012 at 1:04 PM, Vy Dinh vy_d...@rush.edu wrote: Dear Freesurfer Experts, I've created a couple of ROIs from qdec comparisons of thickness and volume between two groups. We extracted the data from these ROIs for each subject using mris_anatomical_stats. The stat files are located within each subjects folder: sub/stats/rh.roi.stats Now, we would like to combine the data from each stat file to a text file using aparcstats2table and asegstats2table (for volume measures). I already have batch scripts that call these functions for multiple subjects. The script basically concatenates all of the subject ids and inputs the concatenated string into the aparcstats2table (or asegstats2table) command. EX: asegstats2table -s s1 -s s2 -s s3 -s s4 --hemi lh --meas volume -tablefile test_stats.txt I would like to modify my script so that I can extract the data from the roi.stats file. This is only a matter of entering the correct inputs for aparcstats2table and asegstats2table but I have tried with little success. The problems with each command are explained below. For asegstats2table: According to documentation (http://surfer.nmr.mgh.harvard.edu/fswiki/asegstats2table), I have tried running asegstats2table $STRING --meas volume --skip --tablefile $OUTFILE where string is -i s1/stats/lh.roi.stats -i s2/stats/lh.roi.stats ..etc but get the error message: Building the table.. Traceback (most recent call last): File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 513, in module rows, columns, table = sanitize_table(options, pretable) File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 412, in sanitize_table _specs, _id_name_map, _measl = _t[0] IndexError: list index out of range For aparcstats2table: when I run the command: aparcstats2table $STRING --hemi lh --parc roi_name --skip --tablefile $OUTFILE where string is -s s1 -s s2 -s s3 , I get a text file with 3 columns. The first column lists the subject ids, but what are the values for the 2nd and 3rd columns? Also, is it possible to input more than 2 .stats file for the command? Looking forward to your responses, Vy Vy T.U. Dinh Neurological Sciences Rush University Medical Center Phone: (312) 563-3853 Fax: (312) 563-4660 Email: vy_d...@rush.edu ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu 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. ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu 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.
Re: [Freesurfer] How to use aparcstats2table and asegstats2table for rois generated from QDEC group analyses
Here is a little script I wrote. It isn't very refined, and can be improved. It is also attached. It references a file you muct make in which you put all your subject names, one on each line of the text file like this: sub001 sub002 sub003 ... Here is the script. #run this script from the Freesurfer Subjects Directory...alterntively, you can modify the script to work automatically #from the the FreeSurfer Subjects Directory Variable. However, since you might not be using the bash shell, maybe that variable wont be available. Anyway.. filename=/home/local/AD3/jlee31/Desktop/NORA/segmentz #This points to a file you will make in which every line contains a subject directory name. #The script will read this file line by line to get the data from each subject listed in the script statsfile=rh.curv.stats #Tells the scipt which kind of stat files you want to collect #Name the file you want to put your results into resultsFileName=results.txt #Ok here we go while read line; do sub=`echo $line | cut -d\. -f1` #gets the subject name from the file in the first line of this script currentStatsFile=./$sub/stats/$statsfile #puts together the fullpath of the stats file #Next Grep finds a line in the file (stored in the variable $myStatsFile) that mathces the criteria #(for example here I find the line Raw Total Surface Area: and echos that out to a result text file echo $sub`grep Raw Total Surface Area: $currentStatsFile` # $resultsFileName #creates a results txt file done $filename - Joshua Lee Graduate Student Center for Mind and Brain Department of Psychology University of California, Davis 530.747.3805 On Thu, May 17, 2012 at 2:37 PM, Vy Dinh vy_d...@rush.edu wrote: Thanks for the suggestion Josh! I have definitely thought about this, but since I'm a total novice bash programmer, I thought that it would be quicker to learn which option to add to asegstats2table and aparcstats2table. I would really appreciate it if you could help me come up with this code? What shell function could I use to open each .stats file? How do I use grep to call, say line 53 in the stats file? Many thanks, Vy On Thu, May 17, 2012 at 4:19 PM, Joshua Lee jki...@ucdavis.edu wrote: Why not use a bash or csh script that loops through your subjects stat files, and use grep read the appropriate lines to a single text file with . - Josh On Thu, May 17, 2012 at 1:04 PM, Vy Dinh vy_d...@rush.edu wrote: Dear Freesurfer Experts, I've created a couple of ROIs from qdec comparisons of thickness and volume between two groups. We extracted the data from these ROIs for each subject using mris_anatomical_stats. The stat files are located within each subjects folder: sub/stats/rh.roi.stats Now, we would like to combine the data from each stat file to a text file using aparcstats2table and asegstats2table (for volume measures). I already have batch scripts that call these functions for multiple subjects. The script basically concatenates all of the subject ids and inputs the concatenated string into the aparcstats2table (or asegstats2table) command. EX: asegstats2table -s s1 -s s2 -s s3 -s s4 --hemi lh --meas volume -tablefile test_stats.txt I would like to modify my script so that I can extract the data from the roi.stats file. This is only a matter of entering the correct inputs for aparcstats2table and asegstats2table but I have tried with little success. The problems with each command are explained below. For asegstats2table: According to documentation (http://surfer.nmr.mgh.harvard.edu/fswiki/asegstats2table), I have tried running asegstats2table $STRING --meas volume --skip --tablefile $OUTFILE where string is -i s1/stats/lh.roi.stats -i s2/stats/lh.roi.stats ..etc but get the error message: Building the table.. Traceback (most recent call last): File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 513, in module rows, columns, table = sanitize_table(options, pretable) File /Users/skip/Desktop/harlow_mount/apps/fmri_progs/freesurfer_v51/freesurfer/bin/asegstats2table, line 412, in sanitize_table _specs, _id_name_map, _measl = _t[0] IndexError: list index out of range For aparcstats2table: when I run the command: aparcstats2table $STRING --hemi lh --parc roi_name --skip --tablefile $OUTFILE where string is -s s1 -s s2 -s s3 , I get a text file with 3 columns. The first column lists the subject ids, but what are the values for the 2nd and 3rd columns? Also, is it possible to input more than 2 .stats file for the command? Looking forward to your responses, Vy Vy T.U. Dinh Neurological Sciences Rush University Medical Center Phone: (312) 563-3853 Fax: (312) 563-4660 Email: vy_d...@rush.edu ___ Freesurfer
Re: [Freesurfer] How to use aparcstats2table and asegstats2table for rois generated from QDEC group analyses
Hi Josh, Thanks for the sample script. With a few modifications to the variable definitions I got your script to work. However, my stats file looks like this: # Table of FreeSurfer cortical parcellation anatomical statistics # # CreationTime 2012/05/10-17:03:40-GMT # generating_program mris_anatomical_stats # cvs_version $Id: mris_anatomical_stats.c,v 1.72 2011/03/02 00:04:26 nicks Exp $ # mrisurf.c-cvs_version $Id: mrisurf.c,v 1.693.2.2 2011/04/27 19:21:05 nicks Exp $ # cmdline mris_anatomical_stats -l 051012_thickness_halluc_fwhm10_lh.fusiform.label -t lh.thickness -b -f 1014/stats/*051012_thickness_halluc_fwhm10_lh.fusiform.stats* 1014 lh # sysname Darwin # hostname skip-macpro-lab.rush.edu # machine i386 # user skip # # SUBJECTS_DIR /Users/skip/Desktop/harlow_mount/JenG/ResearchAssistant/data/freesurfer_v5.1 # anatomy_type surface # subjectname 1014 # hemi lh # AnnotationFile *051012_thickness_halluc_fwhm10_lh.fusiform.label* # AnnotationFileTimeStamp 2012/05/10 10:18:26 # Measure Cortex, NumVert, Number of Vertices, 119152, unitless # Measure Cortex, WhiteSurfArea, White Surface Total Area, 76575.4, mm^2 # NTableCols 10 # TableCol 1 ColHeader StructName # TableCol 1 FieldName Structure Name # TableCol 1 Units NA # TableCol 2 ColHeader NumVert # TableCol 2 FieldName Number of Vertices # TableCol 2 Units unitless # TableCol 3 ColHeader SurfArea # TableCol 3 FieldName Surface Area # TableCol 3 Units mm^2 # TableCol 4 ColHeader GrayVol # TableCol 4 FieldName Gray Matter Volume # TableCol 4 Units mm^3 # TableCol 5 ColHeader ThickAvg # TableCol 5 FieldName Average Thickness # TableCol 5 Units mm # TableCol 6 ColHeader ThickStd # TableCol 6 FieldName Thickness StdDev # TableCol 6 Units mm # TableCol 7 ColHeader MeanCurv # TableCol 7 FieldName Integrated Rectified Mean Curvature # TableCol 7 Units mm^-1 # TableCol 8 ColHeader GausCurv # TableCol 8 FieldName Integrated Rectified Gaussian Curvature # TableCol 8 Units mm^-2 # TableCol 9 ColHeader FoldInd # TableCol 9 FieldName Folding Index # TableCol 9 Units unitless # TableCol 10 ColHeader CurvInd # TableCol 10 FieldName Intrinsic Curvature Index # TableCol 10 Units unitless # ColHeaders StructName NumVert SurfArea GrayVol ThickAvg ThickStd MeanCurv GausCurv FoldInd CurvInd *051012_thickness_halluc_fwhm10_lh.fusiform.label* 85 76435 3.697 0.350 0.325 0.1296 0.5 I want to concatenate the last line for each subject, but since the string shows up 3 times in the stat file, I get more output info than I need. Is there a way to echo a line in the script only (using grep or some other command)? In other words, how can I only extract the last line from the stats file? Thanks, Vy On Thu, May 17, 2012 at 5:32 PM, Joshua Lee jki...@ucdavis.edu wrote: Here is a little script I wrote. It isn't very refined, and can be improved. It is also attached. It references a file you muct make in which you put all your subject names, one on each line of the text file like this: sub001 sub002 sub003 ... Here is the script. #run this script from the Freesurfer Subjects Directory...alterntively, you can modify the script to work automatically #from the the FreeSurfer Subjects Directory Variable. However, since you might not be using the bash shell, maybe that variable wont be available. Anyway.. filename=/home/local/AD3/jlee31/Desktop/NORA/segmentz #This points to a file you will make in which every line contains a subject directory name. #The script will read this file line by line to get the data from each subject listed in the script statsfile=rh.curv.stats #Tells the scipt which kind of stat files you want to collect #Name the file you want to put your results into resultsFileName=results.txt #Ok here we go while read line; do sub=`echo $line | cut -d\. -f1` #gets the subject name from the file in the first line of this script currentStatsFile=./$sub/stats/$statsfile #puts together the fullpath of the stats file #Next Grep finds a line in the file (stored in the variable $myStatsFile) that mathces the criteria #(for example here I find the line Raw Total Surface Area: and echos that out to a result text file echo $sub`grep Raw Total Surface Area: $currentStatsFile` # $resultsFileName #creates a results txt file done $filename - Joshua Lee Graduate Student Center for Mind and Brain Department of Psychology University of California, Davis 530.747.3805 On Thu, May 17, 2012 at 2:37 PM, Vy Dinh vy_d...@rush.edu wrote: Thanks for the suggestion Josh! I have definitely thought about this, but since I'm a total novice bash programmer, I thought that it would be quicker to learn which option to add to asegstats2table and aparcstats2table. I would really appreciate it if you could help me come up with this code? What shell function could I use to open each .stats file?
Re: [Freesurfer] How to use aparcstats2table and asegstats2table for rois generated from QDEC group analyses
In the grep command, this regular expression at the start of the search string: ^ The carot should tell grep to only return lines to start with your search string. From the data file it appears that the only time that a line starts with 051012_thickness_halluc_fwhm10_lh.fusiform.label is the one you want. - Joshua Lee Graduate Student Center for Mind and Brain Department of Psychology University of California, Davis 530.747.3805 On Thu, May 17, 2012 at 4:29 PM, Vy Dinh vy_d...@rush.edu wrote: Hi Josh, Thanks for the sample script. With a few modifications to the variable definitions I got your script to work. However, my stats file looks like this: # Table of FreeSurfer cortical parcellation anatomical statistics # # CreationTime 2012/05/10-17:03:40-GMT # generating_program mris_anatomical_stats # cvs_version $Id: mris_anatomical_stats.c,v 1.72 2011/03/02 00:04:26 nicks Exp $ # mrisurf.c-cvs_version $Id: mrisurf.c,v 1.693.2.2 2011/04/27 19:21:05 nicks Exp $ # cmdline mris_anatomical_stats -l 051012_thickness_halluc_fwhm10_lh.fusiform.label -t lh.thickness -b -f 1014/stats/051012_thickness_halluc_fwhm10_lh.fusiform.stats 1014 lh # sysname Darwin # hostname skip-macpro-lab.rush.edu # machine i386 # user skip # # SUBJECTS_DIR /Users/skip/Desktop/harlow_mount/JenG/ResearchAssistant/data/freesurfer_v5.1 # anatomy_type surface # subjectname 1014 # hemi lh # AnnotationFile 051012_thickness_halluc_fwhm10_lh.fusiform.label # AnnotationFileTimeStamp 2012/05/10 10:18:26 # Measure Cortex, NumVert, Number of Vertices, 119152, unitless # Measure Cortex, WhiteSurfArea, White Surface Total Area, 76575.4, mm^2 # NTableCols 10 # TableCol 1 ColHeader StructName # TableCol 1 FieldName Structure Name # TableCol 1 Units NA # TableCol 2 ColHeader NumVert # TableCol 2 FieldName Number of Vertices # TableCol 2 Units unitless # TableCol 3 ColHeader SurfArea # TableCol 3 FieldName Surface Area # TableCol 3 Units mm^2 # TableCol 4 ColHeader GrayVol # TableCol 4 FieldName Gray Matter Volume # TableCol 4 Units mm^3 # TableCol 5 ColHeader ThickAvg # TableCol 5 FieldName Average Thickness # TableCol 5 Units mm # TableCol 6 ColHeader ThickStd # TableCol 6 FieldName Thickness StdDev # TableCol 6 Units mm # TableCol 7 ColHeader MeanCurv # TableCol 7 FieldName Integrated Rectified Mean Curvature # TableCol 7 Units mm^-1 # TableCol 8 ColHeader GausCurv # TableCol 8 FieldName Integrated Rectified Gaussian Curvature # TableCol 8 Units mm^-2 # TableCol 9 ColHeader FoldInd # TableCol 9 FieldName Folding Index # TableCol 9 Units unitless # TableCol 10 ColHeader CurvInd # TableCol 10 FieldName Intrinsic Curvature Index # TableCol 10 Units unitless # ColHeaders StructName NumVert SurfArea GrayVol ThickAvg ThickStd MeanCurv GausCurv FoldInd CurvInd 051012_thickness_halluc_fwhm10_lh.fusiform.label 85 76 435 3.697 0.350 0.325 0.129 6 0.5 I want to concatenate the last line for each subject, but since the string shows up 3 times in the stat file, I get more output info than I need. Is there a way to echo a line in the script only (using grep or some other command)? In other words, how can I only extract the last line from the stats file? Thanks, Vy On Thu, May 17, 2012 at 5:32 PM, Joshua Lee jki...@ucdavis.edu wrote: Here is a little script I wrote. It isn't very refined, and can be improved. It is also attached. It references a file you muct make in which you put all your subject names, one on each line of the text file like this: sub001 sub002 sub003 ... Here is the script. #run this script from the Freesurfer Subjects Directory...alterntively, you can modify the script to work automatically #from the the FreeSurfer Subjects Directory Variable. However, since you might not be using the bash shell, maybe that variable wont be available. Anyway.. filename=/home/local/AD3/jlee31/Desktop/NORA/segmentz #This points to a file you will make in which every line contains a subject directory name. #The script will read this file line by line to get the data from each subject listed in the script statsfile=rh.curv.stats #Tells the scipt which kind of stat files you want to collect #Name the file you want to put your results into resultsFileName=results.txt #Ok here we go while read line; do sub=`echo $line | cut -d\. -f1` #gets the subject name from the file in the first line of this script currentStatsFile=./$sub/stats/$statsfile #puts together the fullpath of the stats file #Next Grep finds a line in the file (stored in the variable $myStatsFile) that mathces the criteria #(for example here I find the line Raw Total Surface Area: and echos that out to a result text file echo $sub `grep Raw Total Surface Area: $currentStatsFile` # $resultsFileName #creates a results txt file done $filename -