Table Of Contents

How to build FLIRT in WindowsΒΆ

FLIRT is a part of FSL and it is not distributed in Windows. Here, we describe how to build FLIRT from the source code and run FLIRT in the command line in Windows. As we compile FLIRT on the Cygwin [32 bit] environment, install Cygwin before starting (confirm gcc version 4 is installed). After that, download FSL 3.3.11 source codes from here, and copy source code patch file located in /lib/fsl-3.3.11-sources-flirt-cygwin.patch of the package.

then follow the steps below in the Cygwin terminal.

Step 1. Extract source files:

tar xzf fsl-3.3.11-sources.tar.gz

Step 2. Apply patch:

patch -d fsl -p1 < fsl-3.3.11-sources-flirt-cygwin.patch


This patch only works on the source codes relevant to FLIRT. Other FSL modules may need additional patches.

Step 3. Change to the fsl folder and set environmental variables:

cd fsl
export FSLDIR=$PWD
export FSLCONFDIR=${FSLDIR}/config
export FSLMACHTYPE=`gcc -dumpmachine`-gcc`gcc -dumpversion`

Make sure gcc is linked to the gcc-4 binary.

Step 4. Copy config file:

mkdir ./config/`gcc -dumpmachine`-gcc`gcc -dumpversion`
cp ./config/i686-pc-cygwin-gcc3.4.4/* ./config/`gcc -dumpmachine`-gcc`gcc -dumpversion`

Step 5. Build:

./build newmat utils znzlib niftiio fslio miscmaths newimage flirt

Step 6. Install

Upon the success of the above build process, copy fsl/bin/flirt.exe and fsl/bin/convert_xfm.exe executables into the Cygwin’s bin folder (we assume it located in C:\cygwin\bin.). Also, add the Cygwin’s bin folder in the system path if it is not included:

setx Path "%Path%;C:\cygwin\bin" /m

If users don’t want to modify the path variable, copy fsl/bin/flirt.exe and fsl/bin/convert_xfm.exe executables into GLISTR’s installation bin folder (where GLISTR.exe is installed). Also, copy cygwin1.dll and its dependent dlls (in our case, cyggcc_s-1.dll, cyggfortran-3.dll, cygICE-6.dll, cygSM-6.dll, cygstdc++-6.dll, cyguuid-1.dll, cygX11-6.dll, cygXau-6.dll, cygxcb-1.dll, cygXdmcp-6.dll, cygXt-6.dll) into that folder. Before running flirt in the command line, the following environmental variable is needed to be set.: