Differences between revisions 7 and 8
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 7: Line 6:
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. If the measure is thickness then the last column
is the mean cortical thickness.
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. If the measure is thickness then the last column is the mean cortical thickness.
Line 16: Line 9:
  1. Specify each subject after a -s flag
Line 18: Line 10:
            -s subject1 -s subject2 ... --hemi lh
  
  2. Specify all subjects after --subjects flag. --subjects does not have
     to be the last argument. Eg:
 1. Specify each subject after a -s flag
  . -s subject1 -s subject2 ... --hemi lh
Line 23: Line 13:
            --subject subject1 subject2 ... --hemi lh  1. Specify all subjects after --subjects flag. --subjects does not have
  . to be the last argument. Eg:
   . --subject subject1 subject2 ... --hemi lh
Line 25: Line 17:
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, 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.
Line 33: Line 19:
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, thicknessstd, or meancurv.
thicknessstd is the standard dev of thickness across space.
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, thicknessstd, or meancurv. thicknessstd is the standard dev of thickness across space.
Line 38: Line 21:
 --version show program's version number and exit
  -h, --help show this help message and exit
  --subjects (REQUIRED) subject1 <subject2 subject3..>
 
-s SUBJECTS subjectname
 
--subjectsfile=SUBJECTSFILE
                        name of the file which has the list of subjects ( one
                       
subject per line)
 . --version show program's version number and exit
  . -h, --help show this help message and exit
  --subjects (REQUIRED) subject1 <subject2 subject3..> -s SUBJECTS subjectname --subjectsfile=SUBJECTSFILE
   . name of the file which has the list of subjects ( one subject per line)
Line 46: Line 26:
                        subjects ids (fsid)    . subjects ids (fsid)
Line 48: Line 28:
                        column of tp ids (fsid) and subject templates (fsid-
                       
base)
   . column of tp ids (fsid) and subject templates (fsid- base)
Line 51: Line 30:
  -t OUTPUTFILE, --tablefile=OUTPUTFILE
                       
(REQUIRED) output table file
  -p PARC, --parc=PARC parcellation.. default is aparc ( alt aparc.a2009s)
  -m MEAS, --measure=MEAS
                        measure: default is area ( alt volume, thickness,
                       
thicknessstd, meancurv, gauscurv, foldind, curvind)
  . -t OUTPUTFILE, --tablefile=OUTPUTFILE (REQUIRED) output table file
  -p PARC, --parc=PARC parcellation. default is aparc (alt: aparc.a2009s)
  . -m MEAS, --measure=MEAS
   . measure: default is area ( alt volume, thickness, thicknessstd, meancurv, gauscurv, foldind, curvind)
Line 58: Line 35:
                        delimiter between measures in the table. default is
                       
tab (alt comma, space, semicolon )
  --skip if a subject does not have input, skip it. Skips if it cant find a .stats file. Default behavior is to exit the program.
  --parcid-only do not pre/append hemi/meas to parcellation name
  --common-parcs output only the common parcellations of all the
                       
subjects given
   . delimiter between measures in the table. default is tab (alt: comma, space, semicolon )
  --skip if a subject does not have input, skip it. Skips if it can't find a .stats file. Default behavior is to exit the program.
  . --parcid-only do not pre/append hemi/meas to parcellation name 
  . --common-parcs output only the common parcellations of all the subjects given
Line 65: Line 40:
                        filename: output parcellations specified in the file
  --report-rois print ROIs information for each subject, gives what ROIs that are present in at least one other subject is absent in current subject and also gives what ROIs are unique to the current subject
 
--transpose transpose the table ( default is subjects in rows and
                       
ROIs in cols). This might be a useful way to see the table when the number of subjects is relatively less than the number of ROIs. 
   . filename: output parcellations specified in the file
  --report-rois print ROIs information for each subject, gives what ROIs that are present in at least one other subject is absent in current subject and also gives what ROIs are unique to the current subject --transpose transpose the table ( default is subjects in rows and ROIs in cols). This might be a useful way to see the table when the number of subjects is relatively less than the number of ROIs.
Line 71: Line 44:
Line 73: Line 45:
Line 77: Line 48:
Line 85: Line 55:

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. If the measure is thickness then the last column is the mean cortical thickness.

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, thicknessstd, or meancurv. thicknessstd is the standard dev of thickness across space.

  • --version show program's version number and exit
    • -h, --help show this help message and exit

      --subjects (REQUIRED) subject1 <subject2 subject3..> -s SUBJECTS subjectname --subjectsfile=SUBJECTSFILE

      • name of the file which has the list of subjects ( one subject per line)
      --qdec=QDEC name of the qdec table which has the column of
      • subjects ids (fsid)
      --qdec-long=QDECLONG name of the longitudinal qdec table which has the
      • column of tp ids (fsid) and subject templates (fsid- base)
      --hemi=HEMI (REQUIRED) lh or rh
    • -t OUTPUTFILE, --tablefile=OUTPUTFILE (REQUIRED) output table file -p PARC, --parc=PARC parcellation. default is aparc (alt: aparc.a2009s)
    • -m MEAS, --measure=MEAS
      • measure: default is area ( alt volume, thickness, thicknessstd, meancurv, gauscurv, foldind, curvind)
      -d DELIMITER, --delimiter=DELIMITER
      • delimiter between measures in the table. default is tab (alt: comma, space, semicolon )
      --skip if a subject does not have input, skip it. Skips if it can't find a .stats file. Default behavior is to exit the program.
    • --parcid-only do not pre/append hemi/meas to parcellation name
    • --common-parcs output only the common parcellations of all the subjects given --parcs-from-file=PARCSFILE
      • filename: output parcellations specified in the file
      --report-rois print ROIs information for each subject, gives what ROIs that are present in at least one other subject is absent in current subject and also gives what ROIs are unique to the current subject --transpose transpose the table ( default is subjects in rows and ROIs in cols). This might be a useful way to see the table when the number of subjects is relatively less than the number of ROIs. -v, --debug increase verbosity

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

aparcstats2table (last edited 2021-09-11 14:37:37 by AllisonMoreau)