FSL Motion Outliers

The tool fsl_motion_outliers is designed to detect timepoints in an fMRI dataset that have been corrupted by large motion. It creates a confound matrix that can be used in the GLM to completely remove the effects of these timepoints on the analysis, without any adverse affects in the statistics. This is intended to deal with the effects of intermediate to large motions, which corrupt images beyond anything that the linear motion parameter regression methods can fix.

It is strongly advised that "removal" of timepoints is only ever done using confound matrices, such as output by this script, as if timepoints are deleted then parts of the analysis are adversely affected, particularly the temporal filtering and autocorrelation estimation.

The current usage of the script is:

Usage: fsl_motion_outliers -i <input 4D image> -o <output confound file> [options]

Options: -m <mask image>      use supplied mask image for calculating metric
         -s <filename>        save metric values (e.g. DVARS) as text into specified file
         -p <filename>        save metric values (e.g. DVARS) as a graphical plot (png format)
         --refrms             use RMS intensity difference to reference volume as metric [default metric]
         --dvars              use DVARS as metric
         --refmse             Mean Square Error version of --refrms (used in original version of fsl_motion_outliers)
         --fd                 use FD (framewise displacement) as metric
         --fdrms              use FD with RMS matrix calculation as metric
         --thresh=<val>       specify absolute threshold value (otherwise use box-plot cutoff = P75 + 1.5*IQR)
         --nomoco             do not run motion correction (assumed already done)
         --dummy=<val>        number of dummy scans to delete (before running anything and creating EVs)
         -v                   verbose mode

Basic Operation

The simplest way to run this script is just to specify the input 4D dataset (prior to any processing, including motion correction) and the name of the output confound file. The script will then: (i) perform motion correction, (ii) calculate metric values for each timepoint (that indicate how affected by motion it is), (iii) threshold the metric values to look for outliers, and (iv) generate a confound matrix. The format of the confound matrix is a separate column for each timepoint that is deemed to be an outlier. Within each column the values are all zeros except for a value of one at the timepoint that is considered to be the outlier. The effect of adding this to the GLM is that it fully models all the influence of that timepoint with a separate parameter estimate (PE, or beta) which means that the intensities at that timepoint (in any voxel) have no influence on any of the other parameter estimates, effectively removing the effect of this timepoint from the estimation of all the effects of interest.

If no timepoints exceed the threshold, no confound matrix is output.

Using the output in FEAT

The confound matrix should be entered on the Stats tab via the Add additional confound EVs button.

The confounds generated by fsl_motion_outliers can be combined with other motion parameter regression in order to account for large and small motion effects, and can be advantageous. This is because using motion parameter regressors only corrects for linear (and maybe quadratic) changes in intensity induced by small motions, whereas fsl_motion_outliers accounts for changes of any type, however strong, induced by large motions. Therefore these confounds are able to deal with the non-linear artefacts and slice-by-slice movements generated when large, rapid motions take place. However, the standard problem of motion parameter regression removing all activation in the case of strongly stimulus correlated motion may still exist, although adding outlier confounds might help in some cases.


There are several types of metrics available:

The choice of metric is arbitrary and it is not known which is superior, and probably unlikely that one metric would be superior in all circumstances.

There is a big difference between the latter two metrics, which are based on the motion correction parameters, and the others, which are based on intensity differences within the realigned timeseries. In the case that the motion correction is not accurate, then using motion correction parameters (rotation angles and translations in mm) is a poor way to estimate the outliers. Whenever there is large motion in the series it is possible that the motion correction will fail to be accurate (due to the presence of physics artefacts and significant slice-by-slice changes in motion). For this reason it is generally recommended that one of the top two metrics (as refmse and refrms are equivalent) is used to estimate the presence of outliers.

Scaling of the metrics also varies: the dvars metric is scaled to approximately match what is done in Power et al. - dividing by the median brain intensity and then multiplying by 1000 - whereas refrms is scaled by the median brain but not multiplied by any factor after that. The refmse metric is simply the square of refrms.


By default the threshold used to define an outlier is the upper one used in when creating boxplots (the 75th percentile + 1.5 times the InterQuartile Range). The --threshold option can be used to specify an absolute value to be used as the threshold instead of the boxplot threshold.

No other options are available at this time, although the unthresholded metric values can be saved with the -s option for alternative thresholding and confound matrix generation, if desired.


It is possible to specify a mask to restrict the spatial region over which the calculations are done (for the top three metrics). This, when used, is usually a brain mask to avoid calculations based on non-brain regions. It is not necessary to use and results are usually very good without needing any masking.

Motion Correction

In order to calculate the top three metrics, the timeseries must be realigned (i.e. motion corrected). This is usually done automatically by the script by running mcflirt (the original file is not changed). However, if motion correction has already been done then the option --nomoco can be used.

Note that the option --nomoco cannot be used with either of the frame displacement metrics, as they require parameter values from the mcflirt run.

Dummy Scans

If you are using an input timeseries that contains dummy scans then you should use the --dummy option to remove them from the calculations here. The number of dummy scans you specify here should be the same as you would specify in the FEAT GUI when analysing this same dataset.

Other Outputs

If desired, the script can also save plots of the metric values (useful for QA) or text files containing the numerical metric values (unthresholded) for other types of analysis.


FSLMotionOutliers (last edited 08:37:27 21-03-2018 by MarkJenkinson)