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.
  • <resultfile> = a tab-delimited text file with the QA result metrics
  • 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.
Version Info

The current distribution contains several versions of the QA scripts:

  • Version 1 — this is the original distribution that was reported in: Roalf DR, Quarmley M, Elliott MA, et al. The Impact of Quality Assurance Assessment on Diffusion Tensor Imaging Outcomes in a Large-Scale Population-Based Cohort. NeuroImage. 2016;125:903-919. doi:10.1016/j.neuroimage.2015.10.068.
  • Version 2 — includes several bug fixes but should give identical results to v1.
  • Version 4 — significantly revised the qa_dti script to handle multishell DTI data (i.e. multiple b != 0) shells.

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:

  • takes an optional -e <dicomfile> in order to read the Transmit Reference Voltage from the dicom file header.
  • requires the <bval> and <bvec> files in the format returned by dcm2nii and as used by FSL.
  • includes the option to round the <bval> file entries to a nearest integer multiple (designed to fix Siemens bval files)
    • syntax: <4Dniftifile> <bvals> <bvecs> <roundval> [<maskfile>] <resultfile>
    • examples:
      1. dti4D.nii bvals.txt bvecs.txt 100 dti_qa.txt    # this will round the bvalues to nearest integer multiple of 100
      2. dti4D.nii bvals.txt bvecs.txt 0 dti_qa.txt         # no rounding of the bvalues will be done

The QAscripts collection is available for download here in a .zip bundle (updated 05/2021).


For comments or questions, send e-mail to:

Mark Elliott at