I have created some python and bash scripts to pull items from FreeSurfer data. I've found tools like aparcstats2table and asegstats2table to be very useful, and I'm grateful for them, but I've had some more specific needs. My scripts are available at https://github.com/mfschmidt/freesurfer-management. I recommend reading the source code before using them to make sure they'll suit your needs. As all home-built software, this is written for my own purposes and may not suit yours.

I mostly use "fs411" (importing mrs_dicts.py and fs_fxns.py in the same folder) as follows:

    $ fs411 -h
    displays options

-i for "item" to retrieve, it will pull anything in aseg.stats, lh.aparc.stats, rh.aparc.stats or wmparc.stats
Due to left and right in aparcs, you can query for paracentral_L or paracentral_R
    $ fs411 -i eTIV /path/to/subject/001
    001 : eTIV = 1850532.139065
    $ fs411 -i Left-Hippocampus /path/to/subject/001
    001 : Left-Hippocampus = 3985.2
    $ fs411 -i paracentral_L /path/to/subject/001
    001 : paracentral_L = 3286

-s for "sparse" just returns the value alone, useful for scripting
    $ fs411 -s -i eTIV /path/to/subject/001
    1850532.139065

Or to get all aseg data into a comma separated value (csv) file:
    $ fs411 /path/to/subject/001 --outfile /home/me/stuff.csv --filetype aseg

And it's smart enough to only write the header row once, then append only data if you do something like this (in bash shell). You'll get all aparc data from all subjects in that folder in a single "allsubjects.csv" file with one header row on top.
    $ cd /path/to/subject
    $ for id in $(ls -1d *); do fs411 $id --outfile /home/me/allsubjects.csv --filetype aparc; done

Feel free to download it and use it if you find it helpful. The csv file generated at the end will load beautifully into any stats program or spreadsheet and allow you to calculate averages, etc.


On Mon, Apr 24, 2017 at 11:08 AM, shi yao wang <wangshiyao2009@gmail.com> wrote:
Dear FS expert, 
We have running around 500 samples by FS. I am wondering if there are easy way to summary these data. i.e., generate mean of cortical thickness. 

thanks
Shiyao




_______________________________________________
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.