Differences between revisions 106 and 107
Deletions are marked like this. Additions are marked like this.
Line 14: Line 14:
source /path/to/local/freesurfer/
setenv SUBJECTS_DIR /path/to/your/subjects/directory
setenv QA_TOOLS /path/to/QA/Tools/scripts
<source freesurfer>

In tcsh:
setenv SUBJECTS_DIR /path/to/your/subjects_dir
setenv QA_TOOLS /path/to/QATools/scripts

In bash:
export SUBJECTS_DIR=/path/to/your/subjects_dir
export QA_TOOLS=/path/to/QATools/scripts
Line 18: Line 24:

FreeSurfer QA Tools

The QA Tools are intended to be used in assessing the quality of one or more FreeSurfer recons. These scripts are capable of verifying all steps in the FreeSurfer recon-all stream were executed and in the correct order, as well as verifying all files exist and were created in the correct order. Additionally, these scripts can be used to detect potential outlier regions in the aseg.mgz within a dataset, calculate SNR and WM intensity values, and collect detailed snapshots of various volumes. The following people have been major contributors in developing these scripts: David Koh, Stephanie Lee, Jenni Pacheco, Vasanth Pappu, and Louis Vinke.

The QA Tools scripts are a work-in-progress. Any feedback, bug reports, or feature requests are appreciated (email vinke[at]nmr.mgh.harvard.edu).

Click here to view steps for an alternate QA procedure using Qdec.


Click the link below to download the QA Tools scripts. Extract all the contents of the tar file into a new directory. Source your local version of FreeSurfer, set your subjects directory variable, and set the QA Tools path:

<source freesurfer>

In tcsh:
setenv SUBJECTS_DIR /path/to/your/subjects_dir
setenv QA_TOOLS /path/to/QATools/scripts

In bash:
export SUBJECTS_DIR=/path/to/your/subjects_dir
export QA_TOOLS=/path/to/QATools/scripts



QA Tools requires:

  • ImageMagick Studio version 6.2.8 or higher when using the snapshots option. This can be downloaded here.

  • The GNU awk (gawk) utility. This can be downloaded here.

Getting Started

Run the following command to view explanations for all the QA Tools options:

$QA_TOOLS/recon_checker -help

By default QA-Tools will check the status log, the order files were created, the aseg for any outliers, create snapshots of slices throughout various volumes, and calculate SNR and WM measures. See the flags below if you want to disable one or more of these options.


Required Flagged Arguments

-s <subject1> [<subject2>...]

Case ID for one or more subjects located in $SUBJECTS_DIR (use -s-file as alternative)

Optional Flagged Arguments

-subjid <subject1> [<subject2>...]

Specify subject(s) to process


Specify a file with a list of subjects. May be used instead of -s or -subjid


Full path and name of snapshots HTML file. Default: "$SUBJECTS_DIR/QA/QA_check.html"


Take a more detailed set of snapshots


Take all snapshots, overwriting any existing snapshots


Do not take snapshots


Only take snapshots

-outputFOF <file-order list>

Specify a file which lists the proper order of output files

-asegLUT <file>

Specify a file containing aseg outlier lookup table


Generate the file order list from the first subject

-gen-asegLUT <file>

Generate an aseg look up table from your subjects that can be used to identify aseg outliers


Do not check for aseg outliers


Do not check status log file for each subject


Do not check output order of files for each subject


Do not calculate SNR and WM measures for each subject

-completeStatusFile <file>

Compares each subject's status log file to the specified log file

-completeStatusFiles <file>

Compares each subject's status log file to each of the complete status logs listed in <file>

-ignore <process1> [<process2> ...]

Specify one or more FreeSurfer processes to ignore while checking status files

Future Directions

  • Implement -gen-status flag
  • Shorter alternative flags
  • Handle cases where FS ran multiple times (status_file_checker)
  • Generate status log file from specified subject
  • Create file order and status step lists for longitudinal QA
  • Snapshots taken using Freeview
  • Specify snapshots be taken of specific regions found in aparc+aseg.mgz with Freeview
  • Automatically adjust intensity/contrast of volumes before taking snapshots
  • Compile snapshots into GIF animations
  • Detect outliers in aparc and aparc2009 volumes
  • Handle cases where two files flip/flop in creation order (output_file_checker)
  • WM/SNR measurement outputs to seperate file (tab-delimited)
  • Make image & html links for snapshots relative so directory can be moved or renamed

Release Notes

v1.1 (3/5/2012)

  • Log and screen output modified
  • Created default file order list for *.long subject folders processed with FSv5.1 (default_FOF_FSv5.1_long)

Known Issues

  • To get the "-gen-asegLUT" flag of 'recon_checker' to work on FS 5.3 data, you need to change the helper 'gnicv' script to grep on "EstimatedTotalIntraCranialVol" rather than "ICV" (due to the name change of that variable in the stats/aseg.stats file relative to FS 5.1).

  • When taking snapshots, the tkmedit and tksurfer windows that appear can't be blocked by other windows, and the screensaver can't be activated while these scripts are running. Otherwise, the script will take snapshots of the screensaver or the interfering windows. The monitor can be physically turned off while the scripts are running, however, to save power.

For internal users

If you want to disable your screensaver so snaps can be taken overnight, set the value in

  • ~/.gconf/desktop/gnome/session/%gconf.xml

to the number of minutes you want to pass before your screensaver activates (eg 960 for 16 hours). Also, go to System Preferences -> Screensaver and click on Power Management. In the "On AC Power" tab, choose Never in both of the pull down menus.

QATools (last edited 2021-08-12 10:51:08 by AndrewHoopes)