DEV Community

Cover image for Installing FSL and FIX on Linux: Legacy R/MATLAB Setup and Modern Python FIX
Haruki Niwa
Haruki Niwa

Posted on Edited on

Installing FSL and FIX on Linux: Legacy R/MATLAB Setup and Modern Python FIX

Installing FSL on Linux is relatively straightforward, but the instructions for installing FIX have changed substantially. Older installations required a separate FIX download and dependencies in R and MATLAB. Current FSL releases include a Python-based implementation of FIX.

This guide starts with the recommended approach for a new installation. My earlier notes, which used fslinstaller.py and fix-1.06.15.tar.gz, are preserved in the appendix as a historical reference. The current-version examples follow the official FSL documentation and have not been tested as part of preparing this article.

What Are FSL and FIX?

FSL is a collection of tools for functional, structural, and diffusion MRI analysis.

FIX (FMRIB's ICA-based Xnoiseifier) is used to identify noise-related independent components in fMRI data and remove their contributions from the time series. It operates on single-session ICA results from MELODIC or FEAT and uses a trained classifier to distinguish signal from noise components.

There are now two distinct installation scenarios:

Version Installation Status
Python-based FIX Included with FSL 6.0.7.8 and newer Current version
R/MATLAB-based FIX Installed separately from a FIX archive Legacy version; no longer supported

1. Installing FSL on Linux

Current method: getfsl.sh

For a new Linux installation, the official FSL installation guide recommends getfsl.sh:

curl -Ls https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/getfsl.sh | sh -s
Enter fullscreen mode Exit fullscreen mode

The script normally installs FSL into your home directory. Follow the installer's messages, then close and reopen your terminal.

Check the resulting environment:

echo "$FSLDIR"
fslmaths
command -v fix
Enter fullscreen mode Exit fullscreen mode

echo "$FSLDIR" should display the FSL installation directory, and fslmaths should display its usage information. command -v fix shows which fix executable, if any, is selected by your shell. These checks do not, by themselves, demonstrate that an fMRI dataset can be processed successfully.

Alternative: custom installation with fslinstaller.py

For customized installations, the FSL installation page also provides the fslinstaller.py script. After downloading it, run:

python fslinstaller.py
Enter fullscreen mode Exit fullscreen mode

If the python command is unavailable but Python 3 is installed, use:

python3 fslinstaller.py
Enter fullscreen mode Exit fullscreen mode

2. Using the Modern Python-Based FIX

The official FIX guide provides an example that runs feature extraction, component classification, and data cleaning with a pretrained model.

Here, rest.ica refers to the complete single-session FEAT/MELODIC analysis directory, including structural registration and the supporting files required by FIX. The nested ICA decomposition directory, such as filtered_func_data.ica, is not sufficient on its own.

fix rest.ica UKBiobank 20 -m
Enter fullscreen mode Exit fullscreen mode

UKBiobank is a supplied pretrained classification model, and 20 is the classification threshold. The -m option additionally regresses out motion confounds; it does not perform motion correction.

Choose a model appropriate for your acquisition and preprocessing protocol. The official guide recommends checking the resulting component labels and, for major studies, training a classifier on representative study data.

The cleaned time series is saved as filtered_func_data_clean.nii.gz in the analysis directory.

3. Avoiding Version Conflicts and Migrating Models

If both versions are installed, confirm which executable will run:

command -v fix
echo "$FSLDIR"
Enter fullscreen mode Exit fullscreen mode

The shell selects the first matching executable on PATH, which may be the legacy /usr/local/fix/fix rather than the Python version bundled with FSL. Do not assume that the command named fix refers to the version you intended to use.

The model formats are also different: the older FIX uses .RData model files, whereas Python-based FIX uses .pyfix_model files. For users migrating a custom legacy model, the modern FSL documentation describes a conversion utility:

convert_fix_model mymodel.RData mymodel.pyfix_model
Enter fullscreen mode Exit fullscreen mode

Model conversion requires R, with Rscript available on your PATH.

Conclusion

For a new Linux environment, install the current FSL release and use its included Python-based FIX. Before processing data, confirm which executable will run and prepare a compatible analysis directory and classification model. The legacy notes below are intended for readers investigating older installations.

Appendix: Historical Installation Notes for Legacy R/MATLAB FIX

Historical reference only: These notes are incomplete and have not been revalidated on a current Ubuntu release. The R/MATLAB version of FIX is no longer supported.

The notes describe installing FSL with fslinstaller.py and installing FIX separately. They do not record the Linux distribution or installed FSL version.

Archive and extraction

The recorded archive was fix-1.06.15.tar.gz, obtained from the older FIX installation materials. The extraction command assumed it had been placed in ~/Downloads:

cd ~/Downloads
tar -xvf fix-1.06.15.tar.gz
Enter fullscreen mode Exit fullscreen mode

The commands below assume the extracted directory is named fix. The legacy FIX documentation instead links to fix-master.tar.gz; inspect the archive contents because its directory layout may differ.

Recorded R packages

The commands in my notes were:

sudo apt-get install r-base r-cran-devtools
sudo apt-get install r-cran-party r-cran-modeltools r-cran-randomforest
Enter fullscreen mode Exit fullscreen mode

These are the packages recorded in the original procedure, not an exhaustive dependency list. According to the official documentation for the old version, FIX also depends on MATLAB with the Statistics and Signal Processing toolboxes, and on R (version 3.3.0 or newer) with the packages kernlab, ROCR, class, party, e1071, and randomForest.

Package availability and compatibility depend on the operating system, R version, and MATLAB installation. Follow the README bundled with the exact FIX archive for the remaining dependency and configuration steps.

Installation location

The notes record moving the extracted fix directory into /usr/local. This assumes that /usr/local/fix does not already exist; do not use this command to replace an existing installation:

sudo mv ~/Downloads/fix /usr/local/
Enter fullscreen mode Exit fullscreen mode

On systems that also contain Python-based FIX, keep the legacy executable outside the active PATH to avoid selecting it unintentionally.

Recorded executable check

The final command recorded in the original notes was:

/usr/local/fix/fix --help
Enter fullscreen mode Exit fullscreen mode

The original post did not include terminal output from this command or results demonstrating successful FIX processing.

References


AI disclosure: This article combines my historical installation notes with guidance from the official FSL documentation. I used an LLM to assist with drafting and language editing. I am responsible for the technical content.

Top comments (0)