FSL

# Common Command-line Program Example Usage |

## FLIRT

1. The simplest usage of flirt is to register two images together as:

   `flirt -in invol -ref refvol -out outvol -omat invol2refvol.mat -dof 6`

   where `invol, refvol, outvol` are the input, reference and output volume filenames respectively, `invol2refvol.mat` is the filename for the saved ascii transformation matrix. Naturally, any filenames you wish to use can be chosen.

   Note that `-dof` was used as the default would otherwise be 12. The default cost function is Correlation Ratio, which normally works well for all images.

   Also note that the `.mat` extension is not compulsory and any filename and extension can be used. The transformation files are simply stored as ascii matrices, and so other conventions can be used (which might be better for MATLAB users to avoid confusion) although the `.mat` extension is the default within FEAT.

2. To apply a saved transformation to another image use:

   `flirt -in newvol -ref refvol -out outvol -init invol2refvol.mat -applyxfm`

   Note that the previous transformation matrix is used with the `-init` command and that the size of the otput volume is determined by `refvol` although its contents are not used.

3. To perform a 3 DOF 2D (single slice) registration:

   `flirt -in inslice -ref refslice -out outslice -omat i2r.mat -2D`

4. To perform a 6 DOF 2D registration:

   `flirt -in inslice -ref refslice -out outslice -omat i2r.mat -2D -schedule ${FSLDIR}/etc/flirtsch/sch2D_6dof`

   The schedule file specifies what transformations/DOF are allowed and how the optimisation is performed. Note that several other schedule files could be used - including 3D translation only schedules etc. These are all stored in `${FSLDIR}/etc/flirtsch`

## CONVERT_XFM

1. To invert a saved transformation:

   `convert_xfm -omat refvol2invol.mat -inverse invol2refvol.mat`

2. To concatenate two transformations:

   `convert_xfm -omat AtoC.mat -concat BtoC.mat AtoB.mat`

   Note that the transform after the `-concat` is treated as the second transformation in the concatenation.

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