aparcstats2table

Introduction

This script will generate text/ascii tables of freesurfer parcellation stats data, ?h.aparc.stats. This can then be easily imported into a spreadsheet and/or stats program.

Usage

Converts a cortical stats file created by recon-all and or mris_anatomical_stats (eg, ?h.aparc.stats) into a table in which each line is a subject and each column is a parcellation. By default, the values are the area of the parcellation in mm2. The first row is a list of the parcellation names. The first column is the subject name.

The subjects list can be specified on either of two ways:

  1. Specify each subject after a -s flag
    • -s subject1 -s subject2 ... --hemi lh
  2. Specify all subjects after --subjects flag. --subjects does not have
    • to be the last argument. Eg:
      • --subject subject1 subject2 ... --hemi lh

By default, it looks for the ?h.aparc.stats file based on the Killiany/Desikan parcellation atlas. This can be changed with '--parc parcellation' where parcellation is the parcellation to use. An alternative is aparc.a2005s which was developed by Christophe Destrieux. If this file is not found, it will exit with an error unless --skip in which case it skips this subject and moves on to the next.

By default, the area (mm2) of each parcellation is reported. This can be changed with '--meas measure', where measure can be area, volume (ie, volume of gray matter), thickness, or meancurv.

The --common-parcs flag writes only the ROIs which are common to all the subjects. Default behavior is it puts 0.0 in the measure of an ROI which is not present in a subject.

The --report-rois flag, for each subject, gives what ROIs that are present in atleast one other subject is absent in current subject and also gives what ROIs are unique to the current subject.

The --transpose flag writes the transpose of the table. This might be a useful way to see the table when the number of subjects is relatively less than the number of ROIs.

The --delimiter option controls what character comes between the measures in the table. Default is tab. Alternate options are comma, space and semicolon.

The --skip option skips if it can't find a .stats file. Default behavior is exit the program.

The --parcid-only flag writes only the ROIs name in the 1st row 1st column of the table. Default is hemi_ROI_measure

The '-qdec and -qdec-long' flags pass a qdec table for subject selection

Sample Command line

aparcstats2table --subjects bert ernie fred margaret --hemi rh --meas thickness --tablefile aparc_stats.txt

This will combine the rh.aparc.stats files for the subjects bert, ernie, fred, and margaret to generate one table, aparc_stats.txt, that will report the thickness of all the structures labeled in rh.aparc.annot. The resulting file can be imported into any spreadsheet program.

If you'd rather get your information from the alternate parcellation, ?h.aparc.a2005s.annot, you can specify this on your command line with  --parc aparc.a2005s. Also, if you'd like something other than thickness you can specify this with --meas and specify area, volume, or meancurv.

 aparcstats2table --hemi lh --subjects 004 008 --parc aparc.a2005s --meas meancurv --tablefile lh.a2005s.meancurv.txt

lh.a2005s.meancurv.txt will have 3 rows: (1) 'header' with the name of each structure, (2) mean curvature for each structure for subject