Perelman School of Medicine at the University of Pennsylvania

Center for Magnetic Resonance & Optical Imaging



QAscripts is a collection of BASH scripts which perform automated image quality checks on BOLD, DTI, and perfusion data sets. The scripts are written in BASH and intended to run in a Linux environment. AFNI and FSL must also be installed. The scripts output to text files using a tab-delimited format suitable for insertion into spreadsheets.

  • Run any of the scripts w/o arguments to see the calling syntax.
  • The general syntax of each script is:

<scriptname> [-append] [-keep] <4Dniftifile> [<maskfile>] <resultfile>

  • –keep = do not delete intermediate files
  • –append = append results to <resultfile> (if it exists)
  • <maskfile> = optional 3D brain mask. If not provided one is automatically generated.
  • AFNI and FSL must be installed and in your PATH environment.
Installation Instructions
  • Download the .zip file (see Downloading section below).
  • Unzip the files somewhere and add the location to your PATH.
  • In a terminal window, type the QA script name that you want to run.

All of the scripts operate on NIFTI format image files for input and output. The input data set is expected to be a 4D (3D + time) NIFTI. The main routines are:

  • – QA for Arterial Spin Labelled (ASL) data
  • – QA for Diffusion Tensor Imaging (DTI) data
  • – QA for fMRI (i.e BOLD) data

Several common sub-routine scripts are also included, but they can also be called individually if only certain QA metrics are desired. These include:

  • – compute the temporal SNR (tSNR) of a 4D NIFTI data set
  • – compute absolute and relative motion metrics from a 4D NIFTI

Additional notes:

  • requires the <bval> and <bvec> files in the format returned by dcm2nii and as used by FSL.
  • takes an optional -e <dicomfile> in order to read the Transmit Reference Voltage from the dicom file header.

The QAscripts collection is available for download here in a .zip bundle.


For comments or questions, send e-mail to:

Mark Elliott at