This guide provides step-by-step instructions to install Python3, dcm2niix, FSL, FreeSurfer, 3D Slicer, Graphviz, and SWANe on Ubuntu.
Ensure Python3 is installed and up-to-date:
sudo apt update
sudo apt install python3 python3-pippython3 --version
pip3 --version- Update Python packages:
pip3 install --upgrade pip pip3 list --outdated | cut -d' ' -f1 | xargs -n1 pip3 install --upgrade
- Via
apt:sudo apt update sudo apt install dcm2niix
- Alternatively, build from source:
git clone https://github.com/rordenlab/dcm2niix.git cd dcm2niix/console mkdir build && cd build cmake .. make sudo make install
dcm2niix --versionTo update, repeat source installation steps.
-
Download and install the FSL installer:
wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py python3 fslinstaller.py
-
Add to
~/.bashrc:export FSLDIR=/usr/local/fsl . ${FSLDIR}/etc/fslconf/fsl.sh export PATH=${FSLDIR}/bin:$PATH
-
Reload the shell:
source ~/.bashrc
flirt -versionRun the installer script to update:
python3 fslinstaller.py-
Download the software from FreeSurfer's Website.
-
Extract and move it:
tar -xvzf freesurfer-Linux-<version>.tar.gz sudo mv freesurfer /usr/local/ sudo chmod -R 755 /usr/local/freesurfer
-
Add to
~/.bashrc:export FREESURFER_HOME=/usr/local/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.sh
-
Register for a license at this link, and copy
license.txt:cp /path/to/license.txt /usr/local/freesurfer/
-
Reload the shell:
source ~/.bashrc
recon-all -versionReinstall the latest version when required.
-
Download the latest release from 3D Slicer's website.
-
Extract and move it:
tar -xvzf Slicer-<version>-linux-amd64.tar.gz sudo mv Slicer-<version> /opt/slicer
-
Add to
PATHin~/.bashrc:export PATH=/opt/slicer/Slicer-<version>:$PATH
-
Reload the shell:
source ~/.bashrc
- Open Slicer, navigate to Extensions Manager.
- Search for "SlicerFreeSurfer" and install it.
sudo apt update
sudo apt install graphvizdot -version-
Create a virtual environment:
python3 -m venv swane_env
-
Activate the virtual environment:
source swane_env/bin/activate -
Install SWANe:
pip install swane
-
Run SWANe:
python3 -m swane
-
Exit the virtual environment:
deactivate
Ensure your ~/.bashrc includes the following environment variables:
# FreeSurfer
export FREESURFER_HOME=/usr/local/freesurfer
source $FREESURFER_HOME/SetUpFreeSurfer.sh
# FSL
export FSLDIR=/usr/local/fsl
. ${FSLDIR}/etc/fslconf/fsl.sh
export PATH=${FSLDIR}/bin:$PATH
# Slicer
export PATH=/opt/slicer/Slicer-<version>:$PATHReload the shell:
source ~/.bashrc-
Update Tools
Regularly visit the official websites for updates. -
Backup Configurations
Save~/.bashrcandlicense.txtfor FreeSurfer. -
Test Environment
Periodically check installations:which python3 which dcm2niix which flirt which recon-all which dot
-
System Updates
Keep your system up-to-date:sudo apt update && sudo apt upgrade