FSL

# flirt Command-line Program and Utilities |

## INTRODUCTION

This document gives a brief description of flirt and the various command-line programs available in the FLIRT component of FSL. A description of the available GUI interfaces is also available.

For each of the programs described here, a usage message which describes the full list of available options can be obtained by running the program with no options.

See also the list of common example usages.

## flirt

flirt is the main program that performs affine registration. The main options are: an input (-in) and a reference (-ref) volume; the calculated affine transformation that registers the input to the reference which is saved as a 4x4 affine matrix (-omat); and output volume (-out) where the transform is applied to the input volume to align it with the reference volume.

In addition, FLIRT can also be used to apply a saved transformation to a volume (-applyxfm, -init and -out). For this usage the reference volume must still be specified as this sets the voxel and image dimensions of the resulting volume.

Features:

Cost Function Weighting
  Weighting volumes can be specified using -refweight, -inweight (or both). This allows the cost function to have a different weighting at each voxel, which is useful for excluding areas (weight=0) of no interest, or increasing the weighting around important structures such as the ventricles. Note that this is different from masking the original images, as masking introduces artificial boundaries whereas weighting does not.
Degrees of Freedom
  Choose from 6,7,9 or 12 Degrees of Freedom (DOF) for full 3D registrations. Also includes a 3DOF 2D-to-2D registration mode which is selected using the -2D option. Note that it does not perform any search in 2D mode, and cannot deal with 2D to 3D registrations. More flexible DOF options are provided by the specific schedule files provided in `$FSLDIR/etc/flirtsch`.
Interpolation Methods
  This includes Nearest Neighbour and a family of Sinc-based methods (three window types - rectangular, Hanning and Blackman) with configurable window width. The interpolation is only used for the final transformation (and in applyxfm), not in the registration calculations.
Cost Functions
  This includes the within-modality functions Least Squares and Normalised Correlation, as well as the between-modality functions Correlation Ratio (the default), Mutual Information and Normalised Mutual Information.

## convert_xfm

convert_xfm is a utility that is used to convert between different transformation file formats. It can read and write ascii 4x4 matrices. In addition, it can be used to concatenate two transforms (using -concat with the second transform) or to find the inverse transformation (using -inverse).

## img2imgcoord

img2imgcoord is a utility that calculates the corresponding coordinate positions (in voxels or mm) within a destination volume given the original coordinates in the source volume and the transformation from the source to the destination volume. This is useful for finding corresponding anatomical/functional locations. Note that the source coordinates need to be stored in a file as three numbers per line, space separated.

## img2stdcoord

img2stdcoord is a similar utility to img2imgcoord except that the destination volume coordinates are treated as standard space coordinates. This requires the standard space image to have the origin coordinates and voxel dimensions entered in the correct analyse header fields. This is more complicated for nifti - see the FSL FAQ.

## std2imgcoord

std2imgcoord is the complementary utility to img2stdcoord. It works the same way but transfers coordinates from standard space to the other image (IMG) space.

## applyxfm4d

applyxfm4D is a utility that transforms a 4D time series by applying known affine transformations to them. It can be used with a single transformation applied to all, or using a directory of transformation files in the form MAT_XXXX (where XXXX stands for the volume number, starting with 0000). Note that it always uses trilinear interpolation, while appropriate options (-applyxfm and -init) to FLIRT can be used to apply transformations to single volumes with other interpolation methods. A reference volume is required in order to determine the matrix size and FOV for the final volume. If the required matrices do not start with MAT_ a different prefix can be specified with the -userprefix option.

## rmsdiff

rmsdiff is a utility that calculates the Root Mean Square deviation (in millimetres) between two transformations. That is, it compares two transformations (normally two possible registrations of the same volume pair) to see how much they differ. This is useful to compare alternative registrations. It calculates the average using an analytic formula applied over an 80mm sphere with the origin at the centre of the image (for which it requires the input image to be specified).

## avscale

avscale is a utility that displays the decomposed elements of an affine matrix. It displays the rotation/translation matrix, the individual axis scalings, the individual skews, the average scaling, and the forward and backward halfway transformations. In order to set the centre of rotation it requires the input volume (also called the reslice volume).

#### Mark Jenkinson
Copyright © 2000-2003, University of Oxford