Script Editor

MRISpin/SpinLab
MRISpin SpinCalc v7.8 Guest
FSL FSL Tools
BET Brain Extraction
FEAT First-Level GLM
FLIRT Registration
FNIRT Non-linear Reg
Eddy Correction
MELODIC ICA
Randomise
FDT Tractography
FS FreeSurfer
recon-all
asegstats2table
aparcstats2table
mri_convert
ANTs ANTs
SyN Registration
Cortical Thickness
Apply Transforms
AFNI AFNI
3dDeconvolve
align_epi_anat
afni_proc.py
MRtrix MRtrix3
DWI Preprocessing
Tractography
Connectome
PY Python
nibabel NIfTI
Nipype Workflow
nilearn GLM
Func. Connectivity
DIPY DTI
DCM DICOM
dcm2niix
HeuDiConv → BIDS
BIDS BIDS & QC
BIDS Validator
MRIQC
fMRIPrep
HPC HPC / Cluster
SLURM Array
GNU Parallel
Singularity
pipeline.sh
Quick:
1
Lines: 38 Col: 1 Chars: 0 bash
Global Config
Click Add Step or load a preset above.
Execution Mode
Generated Script
-- Load a preset or add steps to generate a script --
DICOM → BIDS Heuristic Builder
Describe your scan protocols and we generate the complete HeuDiConv heuristic.py, the dcm2niix conversion script, and a BIDS folder structure preview — all in one place.
Project Paths
Scan Protocols Enter each series exactly as it appears in the DICOM header
DICOM Series Description
Modality
BIDS Datatype
BIDS Suffix
Task/Run label
Quick Presets Load common protocol sets
heuristic.py — HeuDiConv heuristic file
1
1
What type of study are you running?
Select your primary imaging modality and analysis goal
16 protocols
Select a protocol
Click any protocol card on the left to preview the full script and details here.
No subjects yet. Click Add Subject to begin.

Installing Neuroimaging Tools on Windows

Complete step-by-step guide — WSL 2, FSL, FreeSurfer, ANTs, AFNI, MRtrix3, dcm2niix, HeuDiConv, Python packages, and X server for GUI tools like FSLeyes.

How this works: Neuroimaging tools run on Linux. On Windows you install WSL 2 (Windows Subsystem for Linux) which gives you a full Ubuntu environment running inside Windows. All tools install inside WSL exactly as they would on a real Linux machine. You keep using Windows normally alongside it.
1
Enable WSL 2 and Install Ubuntu
Requires Windows 10 build 19041 or later, or Windows 11. Right-click the Start button → Windows PowerShell (Admin) or Terminal (Admin).
PowerShell — Run as Administrator
# Install WSL 2 with Ubuntu (one command does everything)
wsl --install

# If Ubuntu did not install automatically, install it explicitly:
wsl --install -d Ubuntu-22.04

# Set WSL 2 as the default version
wsl --set-default-version 2

# Check WSL version after restart
wsl --list --verbose

Restart your PC when prompted. After restart, Ubuntu opens automatically and asks you to create a Linux username and password — these do not need to match your Windows credentials. After setup, open Ubuntu from the Start Menu for all subsequent steps. Everything from Step 2 onwards runs inside Ubuntu, not PowerShell.

2
Update Ubuntu and Install System Dependencies
Open Ubuntu from Start Menu. Run these commands inside the Ubuntu terminal — not PowerShell.
Ubuntu (WSL) terminal
# Update all packages
sudo apt update && sudo apt upgrade -y

# Install all libraries that neuroimaging tools need
sudo apt install -y \
    wget curl git unzip vim htop tree \
    python3 python3-pip python3-venv python3-dev \
    build-essential gfortran gcc g++ cmake \
    libgl1-mesa-glx libgl1-mesa-dri \
    libglu1-mesa libglu1-mesa-dev \
    libxt6 libxext6 libxrender1 libxi6 \
    libxmu6 libxmuu1 \
    libgomp1 libquadmath0 libgfortran5 \
    libopenblas-dev liblapack-dev \
    dc bc tcsh csh \
    libeigen3-dev zlib1g-dev libfftw3-dev libpng-dev \
    nodejs npm \
    ffmpeg imagemagick

echo "Dependencies installed successfully"
3
X Server for GUI Tools (FSLeyes, AFNI, MRtrix3 viewer)
Required to run graphical tools like FSLeyes, fslview, MRview, and the AFNI GUI from WSL. Without this, only command-line tools work.
Windows — install VcXsrv (X server)
# Download and install VcXsrv on Windows (not in WSL):
# https://sourceforge.net/projects/vcxsrv/
# Install it with all default options

# After installing, launch XLaunch from the Start Menu:
# - Display settings: Multiple windows
# - Client startup: Start no client
# - Extra settings: tick "Disable access control"  ← important
# - Click Finish

# VcXsrv must be running before you launch any GUI tool from WSL
Ubuntu (WSL) terminal — configure DISPLAY
# Add DISPLAY variable so WSL apps know where to send the GUI
# This tells WSL to send the display to Windows via VcXsrv

echo 'export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '"'"'{print $2}'"'"'):0.0' >> ~/.bashrc
echo 'export LIBGL_ALWAYS_INDIRECT=1' >> ~/.bashrc
source ~/.bashrc

# Test X server connection (install xeyes first)
sudo apt install -y x11-apps
xeyes   # a small window with eyes should appear on Windows
# If xeyes opens, your X server is working correctly

Windows 11 users: WSLg is built into Windows 11 and handles GUI apps automatically — you do not need VcXsrv. Just run sudo apt install -y x11-apps && xeyes to verify it works. If it does, skip the VcXsrv steps above.

4
FSL — FMRIB Software Library
Comprehensive MRI toolkit from Oxford. Includes BET, FLIRT, FNIRT, FAST, FEAT, eddy, randomise, melodic and FSLeyes viewer.
Ubuntu (WSL) terminal
# Download the FSL installer
wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py

# Run installer — it downloads FSL (~2.5 GB) and installs to /usr/local/fsl
# When asked for install directory, press Enter to accept default
sudo python3 fslinstaller.py -d /usr/local/fsl

# Add FSL to your shell environment
echo 'export FSLDIR=/usr/local/fsl' >> ~/.bashrc
echo '. ${FSLDIR}/etc/fslconf/fsl.sh' >> ~/.bashrc
echo 'export PATH=${FSLDIR}/bin:${PATH}' >> ~/.bashrc
source ~/.bashrc

# Verify installation
bet --help | head -3
flirt -version
echo "FSLDIR: $FSLDIR"
Ubuntu (WSL) terminal — launch FSLeyes GUI
# FSLeyes is the FSL image viewer — requires X server running (Step 3)
# Install FSLeyes separately (not included in FSL installer by default)
pip install fsleyes

# Launch FSLeyes
fsleyes &

# Or open a NIfTI file directly
fsleyes /path/to/your/image.nii.gz &

# If FSLeyes crashes with OpenGL error, try:
LIBGL_ALWAYS_SOFTWARE=1 fsleyes &

FSLeyes requires VcXsrv to be running on Windows 10. On Windows 11 with WSLg it opens automatically. The LIBGL_ALWAYS_SOFTWARE=1 flag forces software rendering if your graphics card causes issues in WSL.

5
FreeSurfer
Cortical surface reconstruction and parcellation from MGH. Requires a free license key. recon-all takes 6–16 hours per subject.
Ubuntu (WSL) terminal
# Download FreeSurfer 7.4.1 for Ubuntu 22.04
wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer_ubuntu22-7.4.1_amd64.deb

# Install
sudo dpkg -i freesurfer_ubuntu22-7.4.1_amd64.deb
sudo apt install -f -y   # resolve any missing dependencies

# Add to shell environment
echo 'export FREESURFER_HOME=/usr/local/freesurfer/7.4.1' >> ~/.bashrc
echo 'source $FREESURFER_HOME/SetUpFreeSurfer.sh' >> ~/.bashrc
source ~/.bashrc

# Verify
freesurfer --version
recon-all --version
FreeSurfer license key — required before use
# Get your free license from:
# https://surfer.nmr.mgh.harvard.edu/registration.html
# Fill in the form and the license.txt file is emailed to you

# Once you have license.txt, copy it to FreeSurfer home:
cp /mnt/c/Users/YourName/Downloads/license.txt \
   $FREESURFER_HOME/license.txt

# Verify license is in place
ls -la $FREESURFER_HOME/license.txt

# Test with a quick command (no license needed for this)
mri_info --version

The FreeSurfer GUI (Freeview) also requires VcXsrv. Launch it with freeview & after starting XLaunch.

6
ANTs — Advanced Normalization Tools
State-of-the-art non-linear registration, N4 bias correction and cortical thickness. Use pre-built binaries for fastest setup.
Ubuntu (WSL) terminal
# Download pre-built ANTs 2.5.3 for Ubuntu 22.04
wget https://github.com/ANTsX/ANTs/releases/download/v2.5.3/ants-2.5.3-ubuntu-22.04-X64-gcc.zip

# Extract and move to /opt
unzip ants-2.5.3-ubuntu-22.04-X64-gcc.zip
sudo mv ants-2.5.3 /opt/ants

# Add to shell environment
echo 'export ANTSPATH=/opt/ants/bin' >> ~/.bashrc
echo 'export PATH=${ANTSPATH}:${PATH}' >> ~/.bashrc
source ~/.bashrc

# Verify
antsRegistration --version
N4BiasFieldCorrection --version
antsRegistrationSyN.sh --help | head -3
7
AFNI
Comprehensive fMRI analysis from NIMH. Includes 3dDeconvolve, afni_proc.py, and an interactive GUI viewer. GUI requires X server.
Ubuntu (WSL) terminal
# Install AFNI dependencies
sudo apt install -y \
    libxp6 libglu1-mesa libmotif-dev r-base \
    python3-matplotlib python3-numpy \
    libgsl-dev libopenmpi-dev

# Download and run official AFNI installer
curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries
tcsh @update.afni.binaries -package linux_ubuntu_16_64 -do_extras

# Add to shell environment
echo 'export PATH=$HOME/abin:$PATH' >> ~/.bashrc
source ~/.bashrc

# Verify
afni --version
3dInfo --version

# Launch AFNI GUI (requires VcXsrv running on Windows 10)
afni &
8
MRtrix3
DWI preprocessing, FOD estimation, tractography and connectomics. MRview GUI requires X server.
Ubuntu (WSL) terminal
# Option A — apt package (easiest, Ubuntu 22.04+)
sudo apt install -y mrtrix3

# Option B — pip
pip install mrtrix3

# Option C — build from source (always latest version)
sudo apt install -y \
    libeigen3-dev zlib1g-dev libfftw3-dev \
    libpng-dev libgl1-mesa-dev libglu1-mesa-dev \
    libqt5opengl5-dev qtbase5-dev

git clone https://github.com/MRtrix3/mrtrix3.git ~/mrtrix3
cd ~/mrtrix3
./configure
./build   # takes 10–20 minutes

echo 'export PATH=~/mrtrix3/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

# Verify
mrconvert --version
mrinfo --version

# Launch MRview GUI (requires X server)
mrview &
9
dcm2niix and HeuDiConv
DICOM to NIfTI conversion and automated BIDS organisation. HeuDiConv uses your heuristic.py to rename files correctly.
Ubuntu (WSL) terminal
# dcm2niix — install latest binary (newer than apt version)
wget https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zip
unzip dcm2niix_lnx.zip
sudo mv dcm2niix /usr/local/bin/
dcm2niix --version

# HeuDiConv — BIDS converter that uses heuristic.py
pip install heudiconv
heudiconv --version

# BIDS validator — checks BIDS compliance after conversion
sudo npm install -g bids-validator
bids-validator --version
10
Python Neuroimaging Packages
Complete scientific Python stack for neuroimaging — nibabel, nilearn, nipype, DIPY, fMRIPrep and more.
Ubuntu (WSL) terminal
# Create a virtual environment (keeps packages isolated)
python3 -m venv ~/neuro-env
source ~/neuro-env/bin/activate

# Upgrade pip first
pip install --upgrade pip setuptools wheel

# Install all neuroimaging Python packages
pip install \
    nibabel \
    nilearn \
    nipype \
    dipy \
    pandas numpy scipy matplotlib seaborn \
    scikit-learn scikit-image \
    jupyter jupyterlab ipywidgets \
    fmriprep mriqc \
    pydeface templateflow \
    antspyx

# Auto-activate the environment in every new terminal
echo 'source ~/neuro-env/bin/activate' >> ~/.bashrc

# Verify key packages
python3 -c "import nibabel; print('nibabel', nibabel.__version__)"
python3 -c "import nilearn; print('nilearn', nilearn.__version__)"
python3 -c "import dipy; print('dipy', dipy.__version__)"
11
fMRIPrep and MRIQC via Docker
The most reliable way to run fMRIPrep and MRIQC. Docker Desktop for Windows integrates directly with WSL 2.
Windows — install Docker Desktop
# Download Docker Desktop for Windows:
# https://www.docker.com/products/docker-desktop
# Install it — it detects WSL 2 automatically
# Enable "Use WSL 2 based engine" in Docker Desktop settings

# After install, verify Docker works inside WSL:
docker --version
docker run hello-world
Ubuntu (WSL) terminal — pull and run containers
# Pull fMRIPrep and MRIQC images
docker pull nipreps/fmriprep:latest
docker pull nipreps/mriqc:latest

# Run MRIQC on a BIDS dataset
docker run --rm -it \
    -v /mnt/c/Users/YourName/data/bids:/data:ro \
    -v /mnt/c/Users/YourName/data/mriqc:/out \
    nipreps/mriqc:latest \
    /data /out participant \
    --participant-label 00001

# Run fMRIPrep
docker run --rm -it \
    -v /mnt/c/Users/YourName/data/bids:/data:ro \
    -v /mnt/c/Users/YourName/data/derivatives:/out \
    -v /mnt/c/Users/YourName/freesurfer_license.txt:/opt/freesurfer/license.txt:ro \
    nipreps/fmriprep:latest \
    /data /out participant \
    --participant-label 00001 \
    --fs-license-file /opt/freesurfer/license.txt
12
GNU Parallel
Run multiple subjects simultaneously using all your CPU cores. Useful when running BET, FLIRT, or FAST on many subjects on a local machine.
Ubuntu (WSL) terminal
sudo apt install -y parallel

# Verify
parallel --version

# Example: run BET on all subjects in parallel with 4 jobs at once
SUBJECTS=(sub-001 sub-002 sub-003 sub-004 sub-005)
printf '%s\n' "${SUBJECTS[@]}" | \
    parallel -j 4 \
    "bet /data/bids/{}/anat/{}_T1w.nii.gz \
         /data/derivatives/{}/{}_brain.nii.gz \
         -f 0.4 -B -m"
13
Verify All Installations
Run this block to check every tool is installed and accessible.
Ubuntu (WSL) terminal
echo "=== Checking all neuroimaging tools ==="

echo -n "FSL:         "; bet --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "FSLeyes:     "; fsleyes --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "FreeSurfer:  "; recon-all --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "ANTs:        "; antsRegistration --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "AFNI:        "; afni --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "MRtrix3:     "; mrconvert --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "dcm2niix:    "; dcm2niix --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "HeuDiConv:   "; heudiconv --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "BIDS-val:    "; bids-validator --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "Python:      "; python3 --version
echo -n "nibabel:     "; python3 -c "import nibabel; print(nibabel.__version__)" || echo "NOT FOUND"
echo -n "nilearn:     "; python3 -c "import nilearn; print(nilearn.__version__)" || echo "NOT FOUND"
echo -n "DIPY:        "; python3 -c "import dipy; print(dipy.__version__)" || echo "NOT FOUND"
echo -n "Docker:      "; docker --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "Parallel:    "; parallel --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "DISPLAY:     "; echo $DISPLAY

echo "=== Done ==="
Common Problems and Fixes
Solutions for the most frequent issues on WSL.
FSLeyes / GUI won't open
Make sure VcXsrv is running (XLaunch). Check echo $DISPLAY — should show an IP address like 172.x.x.x:0.0. On Windows 11 use WSLg instead.
FSLeyes OpenGL error
Run LIBGL_ALWAYS_SOFTWARE=1 fsleyes & to force software rendering. Add to ~/.bashrc to make permanent.
Cannot create /data — Permission denied
You used a default path like /data/bids which requires root. Always use your full Windows path: /mnt/c/Users/YourName/...
Command not found after installing
Run source ~/.bashrc or close and reopen Ubuntu. The PATH changes only take effect in new terminals.
FreeSurfer license error
Check ls $FREESURFER_HOME/license.txt — the file must exist. Register free at surfer.nmr.mgh.harvard.edu/registration.html
WSL runs out of memory
Create C:\Users\YourName\.wslconfig with:
[wsl2]
memory=16GB
processors=8
Windows path vs WSL path
Your Windows C:\Users\Name\Desktop is accessible in WSL at /mnt/c/Users/Name/Desktop

Installing Neuroimaging Tools on Linux

Complete native installation guide for Ubuntu 20.04 / 22.04 / 24.04 and Debian-based HPC clusters. Covers FSL, FreeSurfer, ANTs, AFNI, MRtrix3, dcm2niix, HeuDiConv, Python stack, Docker, and SLURM.

Recommended distribution: Ubuntu 22.04 LTS. All tools below are tested on Ubuntu 20.04, 22.04 and 24.04. Commands also work inside WSL 2 on Windows — see the Windows guide for X server setup if you need GUI tools there.
1
System Preparation
Update your system and install every library that neuroimaging tools depend on in one block.
bash
sudo apt update && sudo apt upgrade -y

sudo apt install -y \
    wget curl git unzip vim htop tree \
    python3 python3-pip python3-venv python3-dev \
    build-essential gfortran gcc g++ cmake ninja-build \
    libgl1-mesa-glx libgl1-mesa-dri mesa-utils \
    libglu1-mesa libglu1-mesa-dev \
    libxt6 libxext6 libxrender1 libxi6 libxmu6 \
    libgomp1 libquadmath0 libgfortran5 \
    libopenblas-dev liblapack-dev \
    libgsl-dev libgslcblas0 \
    libeigen3-dev zlib1g-dev libfftw3-dev libpng-dev \
    libjpeg-dev libtiff-dev \
    dc bc tcsh csh \
    nodejs npm \
    ffmpeg imagemagick parallel \
    singularity-container 2>/dev/null || true

echo "All system dependencies installed"
2
FSL — FMRIB Software Library
Full MRI analysis toolkit from Oxford. Includes BET, FLIRT, FNIRT, FAST, FEAT, eddy_openmp, randomise, melodic and FSLeyes viewer. Download is approximately 2.5 GB.
bash
# Download the official FSL installer
wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py

# Run installer — installs to /usr/local/fsl by default (~2.5 GB download)
# Press Enter to accept the default directory when prompted
sudo python3 fslinstaller.py -d /usr/local/fsl

# Add FSL to your shell environment
echo 'export FSLDIR=/usr/local/fsl' >> ~/.bashrc
echo '. ${FSLDIR}/etc/fslconf/fsl.sh' >> ~/.bashrc
echo 'export PATH=${FSLDIR}/bin:${PATH}' >> ~/.bashrc
source ~/.bashrc

# Verify
bet --help | head -2
flirt -version
echo "FSLDIR: $FSLDIR"
bash — install and launch FSLeyes image viewer
# FSLeyes is the FSL image viewer — install via pip
pip install fsleyes

# Launch FSLeyes
fsleyes &

# Open a specific image
fsleyes /path/to/image.nii.gz &

# If you get an OpenGL error on a headless server, use:
LIBGL_ALWAYS_SOFTWARE=1 fsleyes &

# On a remote server via SSH, enable X forwarding:
# Connect with: ssh -Y username@server
# Then launch: fsleyes &
3
FreeSurfer
Cortical surface reconstruction, parcellation and subcortical segmentation. recon-all takes 6–16 hours per subject. Requires a free license from MGH.
bash — Ubuntu 22.04
# Download the .deb package for Ubuntu 22.04 (~1.5 GB)
wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer_ubuntu22-7.4.1_amd64.deb

# Install the package
sudo dpkg -i freesurfer_ubuntu22-7.4.1_amd64.deb

# Fix any missing dependencies
sudo apt install -f -y

# Add to shell environment
echo 'export FREESURFER_HOME=/usr/local/freesurfer/7.4.1' >> ~/.bashrc
echo 'source $FREESURFER_HOME/SetUpFreeSurfer.sh' >> ~/.bashrc
source ~/.bashrc

# Verify
freesurfer --version
recon-all --version
bash — Ubuntu 20.04
# Use the Ubuntu 20.04 build instead
wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer_ubuntu20-7.4.1_amd64.deb
sudo dpkg -i freesurfer_ubuntu20-7.4.1_amd64.deb
sudo apt install -f -y
bash — FreeSurfer license (required)
# Register free at:
# https://surfer.nmr.mgh.harvard.edu/registration.html
# The license.txt file will be emailed to you

# Copy the license file to FreeSurfer home
cp ~/Downloads/license.txt $FREESURFER_HOME/license.txt

# Or create it manually from the email content:
# cat > $FREESURFER_HOME/license.txt << 'EOF'
# your.email@university.ac.uk
# 12345
# *AbCdEfGhIjKl
# EOF

# Verify the license works
mri_info $FREESURFER_HOME/subjects/bert/mri/T1.mgz

Freeview (FreeSurfer GUI) requires a display. On a remote server connect with ssh -Y user@server then run freeview &

4
ANTs — Advanced Normalization Tools
Best non-linear registration toolkit. N4 bias correction, SyN registration, cortical thickness. Use pre-built binaries to avoid a 2-hour compile.
bash — pre-built binaries (recommended)
# Download pre-built ANTs 2.5.3 for Ubuntu 22.04
wget https://github.com/ANTsX/ANTs/releases/download/v2.5.3/ants-2.5.3-ubuntu-22.04-X64-gcc.zip

# Extract and install
unzip ants-2.5.3-ubuntu-22.04-X64-gcc.zip
sudo mv ants-2.5.3 /opt/ants

# Add to shell environment
echo 'export ANTSPATH=/opt/ants/bin' >> ~/.bashrc
echo 'export PATH=${ANTSPATH}:${PATH}' >> ~/.bashrc
source ~/.bashrc

# Verify
antsRegistration --version
N4BiasFieldCorrection --version
antsRegistrationSyN.sh --help | head -3
bash — build from source (if pre-built does not work)
sudo apt install -y cmake git g++ zlib1g-dev
git clone https://github.com/ANTsX/ANTs.git ~/ANTs-src
mkdir ~/ANTs-build && cd ~/ANTs-build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_TESTING=OFF \
    ../ANTs-src
make -j$(nproc)   # uses all CPU cores — takes 60–120 minutes
sudo make install

echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
5
AFNI
Comprehensive fMRI analysis from NIMH. Includes 3dDeconvolve, afni_proc.py, 3dTproject, and a GUI viewer. Follow the official AFNI setup exactly.
bash
# Install AFNI system dependencies
sudo apt install -y \
    tcsh xfonts-base python3-qt5 \
    libmotif-dev motif-clients \
    xterm libxp6 \
    r-base r-base-dev \
    libglu1-mesa-dev \
    libgsl-dev

# Download and run official AFNI installer
curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries
tcsh @update.afni.binaries -package linux_ubuntu_16_64 -do_extras

# Add to shell environment
echo 'export PATH=$HOME/abin:$PATH' >> ~/.bashrc
source ~/.bashrc

# Run AFNI's own system check
afni_system_check.py -check_all

# Verify
afni --version
3dDeconvolve --help | head -3

# Launch AFNI GUI (requires display)
afni &
6
MRtrix3
DWI preprocessing, fibre orientation distribution estimation, tractography and structural connectomics. MRview is the GUI viewer.
bash — Option A: apt package (easiest)
sudo apt install -y mrtrix3
mrconvert --version
bash — Option B: build from source (latest version)
# Install build dependencies
sudo apt install -y \
    libeigen3-dev zlib1g-dev libfftw3-dev libpng-dev \
    libgl1-mesa-dev libglu1-mesa-dev \
    qtbase5-dev libqt5opengl5-dev \
    python3-numpy

# Clone and build MRtrix3
git clone https://github.com/MRtrix3/mrtrix3.git ~/mrtrix3
cd ~/mrtrix3
./configure
./build   # takes 10–20 minutes on a modern machine

# Add to shell environment
echo 'export PATH=~/mrtrix3/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

# Verify
mrconvert --version
mrinfo --version
tckgen --help | head -3

# Launch MRview GUI (requires display)
mrview &
7
dcm2niix and HeuDiConv
DICOM to NIfTI conversion and automated BIDS organisation. Install the latest dcm2niix binary for best Philips/Siemens/GE support.
bash
# dcm2niix — latest binary (newer than apt version, better scanner support)
wget https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zip
unzip dcm2niix_lnx.zip
sudo mv dcm2niix /usr/local/bin/
dcm2niix --version

# HeuDiConv — automated BIDS conversion with heuristic files
pip install heudiconv
heudiconv --version

# BIDS validator — check dataset compliance
sudo npm install -g bids-validator
bids-validator --version

# Test dcm2niix on a folder
# dcm2niix -z y -f "%p_%s" -b y -o /output /path/to/dicoms
8
Python Neuroimaging Stack
Complete scientific Python environment. Always use a virtual environment to keep packages isolated from system Python.
bash
# Create a virtual environment
python3 -m venv ~/neuro-env
source ~/neuro-env/bin/activate

# Upgrade pip
pip install --upgrade pip setuptools wheel

# Core neuroimaging packages
pip install \
    nibabel \
    nilearn \
    nipype \
    dipy \
    antspyx

# Scientific Python stack
pip install \
    pandas numpy scipy matplotlib seaborn \
    scikit-learn scikit-image \
    statsmodels pingouin

# Jupyter
pip install \
    jupyter jupyterlab ipywidgets \
    nbconvert

# BIDS apps and tools
pip install \
    fmriprep mriqc \
    pydeface templateflow \
    pybids

# Auto-activate environment in every new terminal
echo 'source ~/neuro-env/bin/activate' >> ~/.bashrc

# Verify
python3 -c "import nibabel; print('nibabel', nibabel.__version__)"
python3 -c "import nilearn; print('nilearn', nilearn.__version__)"
python3 -c "import dipy; print('dipy', dipy.__version__)"
python3 -c "import nipype; print('nipype', nipype.__version__)"
9
Docker — for fMRIPrep and MRIQC containers
The most reliable way to run fMRIPrep, MRIQC and other BIDS Apps. Containers include all dependencies — nothing else to install.
bash
# Install Docker Engine on Ubuntu
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
    sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) \
  signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io

# Add your user to docker group (avoids needing sudo for docker)
sudo usermod -aG docker $USER
newgrp docker

# Verify
docker --version
docker run hello-world

# Pull BIDS App images
docker pull nipreps/fmriprep:latest
docker pull nipreps/mriqc:latest
bash — run fMRIPrep and MRIQC via Docker
# Run MRIQC
docker run --rm -it \
    -v /data/bids:/data:ro \
    -v /data/derivatives/mriqc:/out \
    nipreps/mriqc:latest \
    /data /out participant \
    --participant-label 001 002 003 \
    --nprocs 8 --mem_gb 32

# Run fMRIPrep
docker run --rm -it \
    -v /data/bids:/data:ro \
    -v /data/derivatives/fmriprep:/out \
    -v /opt/freesurfer/license.txt:/opt/freesurfer/license.txt:ro \
    nipreps/fmriprep:latest \
    /data /out participant \
    --participant-label 001 \
    --fs-license-file /opt/freesurfer/license.txt \
    --nprocs 8 --mem-mb 24000 \
    --output-spaces MNI152NLin2009cAsym:res-2
10
Singularity / Apptainer — for HPC clusters
Docker is not available on most HPC clusters for security reasons. Singularity (now called Apptainer) is the container system used on clusters. Run fMRIPrep and MRIQC on SLURM this way.
bash — install Apptainer (newer name for Singularity)
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer

# Verify
apptainer --version

# Pull fMRIPrep image (converts Docker → Singularity .sif file)
# Run this on your HPC — takes ~20 minutes, creates a .sif file
apptainer pull fmriprep.sif docker://nipreps/fmriprep:latest
apptainer pull mriqc.sif docker://nipreps/mriqc:latest
bash — run fMRIPrep via Singularity on SLURM
#!/bin/bash
#SBATCH --job-name=fmriprep
#SBATCH --ntasks=1 --cpus-per-task=8
#SBATCH --mem=32G --time=12:00:00
#SBATCH --partition=standard

apptainer run --cleanenv fmriprep.sif \
    /data/bids /data/derivatives/fmriprep participant \
    --participant-label $SUBJ \
    --fs-license-file /data/license.txt \
    --nprocs 8 --mem-mb 30000 \
    --output-spaces MNI152NLin2009cAsym:res-2
11
GNU Parallel and SLURM Tools
For running pipelines across many subjects — locally with GNU Parallel or on an HPC cluster with SLURM.
bash — GNU Parallel (local multi-subject)
sudo apt install -y parallel

# Run BET on all subjects simultaneously (4 at a time)
SUBJECTS=($(ls -d /data/bids/sub-* | xargs -n1 basename))
printf '%s\n' "${SUBJECTS[@]}" | \
    parallel -j 4 --eta \
    "bet /data/bids/{}/anat/{}_T1w.nii.gz \
         /data/derivatives/{}/{}_brain.nii.gz \
         -f 0.4 -B -m && echo Done: {}"
bash — SLURM commands for HPC clusters
# Submit a job
sbatch pipeline.sh

# Submit with specific variables
sbatch --export=SUBJ=sub-001 pipeline.sh

# Check job status
squeue -u $USER
squeue -j 

# Check completed job stats (memory, CPU, time used)
sacct -j  --format=JobID,Elapsed,MaxRSS,CPUTime,State

# Cancel a job
scancel 

# Cancel all your jobs
scancel -u $USER

# Check available partitions and nodes
sinfo
sinfo -N --long

# View job output in real time
tail -f slurm_${SLURM_JOB_ID}.out
12
Running GUI Tools on a Remote Server
To run FSLeyes, MRview, AFNI or Freeview on a remote Linux server or HPC, you need X11 forwarding over SSH.
bash — SSH with X11 forwarding
# Connect to your remote server with X11 forwarding enabled
ssh -Y username@your.hpc.server.ac.uk

# The -Y flag enables trusted X11 forwarding
# Once connected, run any GUI tool normally:
fsleyes &
mrview &
afni &
freeview &
bash — faster alternative with VNC or X2Go
# Install X2Go server on the remote machine (much faster than SSH -Y)
sudo apt install -y x2goserver x2goserver-xsession

# On your local machine install X2Go client:
# https://wiki.x2go.org/doku.php/doc:installation:x2goclient
# Then connect to your server — you get a full desktop over the network

# Alternative: install a VNC server for full desktop access
sudo apt install -y tigervnc-standalone-server
vncserver :1 -geometry 1920x1080 -depth 24
# Then connect via VNC viewer from your local machine
13
Verify All Installations
Run this block to confirm every tool is installed and accessible from the terminal.
bash
echo "=== Checking all neuroimaging tools ==="

echo -n "FSL:          "; bet --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "FSLeyes:      "; fsleyes --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "FreeSurfer:   "; recon-all --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "ANTs:         "; antsRegistration --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "AFNI:         "; afni --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "MRtrix3:      "; mrconvert --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "dcm2niix:     "; dcm2niix --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "HeuDiConv:    "; heudiconv --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "BIDS-val:     "; bids-validator --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "Docker:       "; docker --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "Apptainer:    "; apptainer --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "GNU Parallel: "; parallel --version 2>&1 | head -1 || echo "NOT FOUND"
echo -n "Python:       "; python3 --version
echo -n "nibabel:      "; python3 -c "import nibabel; print(nibabel.__version__)" 2>/dev/null || echo "NOT FOUND"
echo -n "nilearn:      "; python3 -c "import nilearn; print(nilearn.__version__)" 2>/dev/null || echo "NOT FOUND"
echo -n "DIPY:         "; python3 -c "import dipy; print(dipy.__version__)" 2>/dev/null || echo "NOT FOUND"
echo -n "nipype:       "; python3 -c "import nipype; print(nipype.__version__)" 2>/dev/null || echo "NOT FOUND"

echo "=== Done ==="
Common Problems and Fixes
Solutions to the most frequent installation issues on Linux.
FSLeyes OpenGL error
Run LIBGL_ALWAYS_SOFTWARE=1 fsleyes &. On a headless server ensure DISPLAY is set: export DISPLAY=:0
GUI tool shows blank window or crashes
X11 forwarding may be too slow over the network. Use X2Go or VNC for a full desktop session instead of ssh -Y
FreeSurfer license error on first run
Check echo $FREESURFER_HOME is set and ls $FREESURFER_HOME/license.txt exists. Source the setup script: source $FREESURFER_HOME/SetUpFreeSurfer.sh
Command not found after installing
Run source ~/.bashrc or open a new terminal. The PATH exports only take effect in new shells.
dpkg errors during FreeSurfer install
Run sudo apt install -f -y immediately after the failed dpkg command to auto-resolve missing dependencies.
Docker permission denied
Run sudo usermod -aG docker $USER then log out and back in, or run newgrp docker in the current terminal.
SLURM job runs out of memory
Increase --mem in your #SBATCH header. Check actual usage with sacct -j <jobID> --format=MaxRSS after the job completes.
MRtrix3 build fails
Make sure all Qt5 and Eigen3 headers are installed: sudo apt install -y qtbase5-dev libqt5opengl5-dev libeigen3-dev then re-run ./configure && ./build
Environment Checker Select tools then generate a bash script to check what is installed
Tool Groups
Generated Script
-- Select tool groups and click "Generate Selected", or click ▶ next to any group to generate just that one --
BIDS Dataset Browser

Enter your BIDS directory path and SpinLab will generate a script to analyse the dataset structure, check compliance, and produce a summary report.

BIDS Checklist
Enter a path above to see checklist.
Dataset Analyser Script
-- Enter a BIDS path and click Generate --
About BIDS Browser

The generated script scans your BIDS directory and produces: subject count and list, modalities present per subject, missing files detection, total storage size, and a participants.tsv summary. Run the script in your terminal to get an instant dataset overview before starting preprocessing.

Study Parameters
Processing Time
Hours per subject
Total wall-clock time
Total CPU hours
SLURM array config
Storage Requirements
Raw DICOM (GB)
BIDS NIfTI (GB)
Derivatives (GB)
Total (GB)
Memory Requirements
RAM per subject (GB)
Total if parallel (GB)
Recommended SLURM Configuration
-- Set parameters above to see recommendation --
Categories
Contribute a script
MRISpin SpinLab Documentation
v3.0 · mrispin.com/spinlab · © 2026 MRISpin.com
What is SpinLab?

MRISpin SpinLab is a browser-based neuroimaging pipeline platform. It generates real, complete, runnable bash and Python scripts for the full neuroimaging analysis workflow, and includes SpinAI intelligence features — including Pipeline DNA fingerprinting, live Methods section generation, an Error Decoder, and a Study Replication Assistant. SpinLab is not a processing engine — it generates the scripts that you run on your own machine, server, or HPC cluster.

SpinLab works without an account. Sign in only to save scripts across sessions. All panels are fully functional immediately.
What SpinLab covers
Script Editor — write, search 30+ snippets, find & replace, quick actions, Tab indent
Pipeline Builder — 32 steps, live script, 4 execution modes, subject list, Pipeline DNA fingerprinting
Study Setup Wizard — answer 4 questions, get a fully pre-configured pipeline instantly
Heuristic Builder — generate heuristic.py + dcm2niix + HeuDiConv scripts automatically
Protocol Library — 10 full published protocols with DOI references, deploy to Pipeline Builder
QC Tracker — per-subject metrics, automatic pass/fail, methods export, CSV download
Command Hub — 37 commands across 9 tool families, full flag tables and copy-ready examples
Environment Checker — 13 tool groups with individual generate buttons, checkboxes, and Select All/None. Works offline.
BIDS Dataset Browser — generates an analyser script for your BIDS directory structure and compliance
Study Design Calculator — estimate time, storage, memory and SLURM config. Field strength (1.5T/3T/7T) adjustments included.
Shared Script Library — curated community pipeline scripts across 8 categories with Send to Editor
NIfTI Viewer — full browser-based viewer (Niivue/WebGL2). Layers, QC contact sheet, ROI drawing, compare, 4D timeseries, intensity profile, mosaic, annotations, histogram, header inspector. Files stay local.
Cohort Manager — track subjects, demographics, groups, visits, exclusions. Import CSV, export participants.tsv.
BIDS Validator — validate any BIDS dataset in the browser. Checks structure, naming, sidecars, events.tsv. No upload needed.
Citation Generator — select tools used, get a formatted bibliography (APA/Vancouver/BibTeX) and acknowledgement sentence. 26 tools covered. From Pipeline auto-selects.
FSL Design Builder — visual GLM design matrix builder. Define conditions, timings, contrasts, nuisance regressors. Export design.mat, .con, .fsf.
Protocol Checker — enter MRI parameters, get pass/fail checks vs published recommendations for rsfMRI, task fMRI, structural, DWI, ASL at 1.5T/3T/7T.
DICOM Inspector — load any DICOM file, inspect all tags, filter by category, export JSON/CSV. Multi-file navigator. Nothing uploaded.
Power Calculator — 7 test types, solve for n/power/effect size. Live power curve, dropout adjustment, ready-to-paste methods text.
Pipeline DNA — every pipeline gets a unique reproducibility fingerprint. Share one code, anyone reproduces your exact pipeline
SpinAI Parameter Guide — click ? on any Pipeline Builder parameter for an AI explanation with literature citations
Live Methods Section — a complete academic Methods paragraph writes itself in real time as you build your pipeline
Error Decoder — paste any neuroimaging error message, get ranked causes with probabilities and exact fix commands
Replication Assistant — paste a paper's Methods section and SpinLab extracts, builds and deploys the pipeline
Pipeline Diff Viewer — compare two pipelines with AI-explained scientific impact of each difference
Result Sanity Checker — enter QC metrics, check against normative ranges from HCP, UK Biobank and 50+ studies
Helpdesk — contact and support for the MRISpin team
Quick Start
Path 1 — Single snippet (fastest)
1
Open Script Editor → search or browse snippets in the left sidebar → click one (e.g. BET Brain Extraction)
2
Edit the path variables at the top (SUBJ, BIDS_DIR, OUT_DIR)
3
Click Download .sh → run: bash spinlab_pipeline.sh
Path 2 — Full pipeline via wizard
1
Open Study Setup Wizard → pick your modality, scanner, analysis options
2
Click Open Pipeline Builder — all steps pre-loaded with your parameters
3
Expand any step card to fine-tune individual parameters. Script updates live on the right.
4
Set execution mode (Single / For loop / SLURM), then Download .sh
Path 3 — DICOM to BIDS
1
Open Heuristic Builder → enter your DICOM series descriptions, assign BIDS types
2
Click Generate All Files → download heuristic.py, dcm2niix.sh, heudiconv.sh
3
Place heuristic.py at /data/bids/code/heuristic.py, run heudiconv.sh
Script Editor
Overview

A full-page code editor with line numbers, syntax-aware quick actions, and a 30+ snippet library. Load snippets, write freely, find & replace paths, and download the finished script.

Snippet search

Search works across snippet titles and keyword tags — typing warp finds FNIRT and ANTs, typing brain finds BET. Filter pills (FSL / FS / ANTs / MRtrix / PY / BIDS / HPC) restrict the list to one tool family. Clicking a snippet on the default boilerplate loads silently; if you have written something real it asks for confirmation first.

Quick action bar
Subject Loop
Wraps selected lines in a for SUBJ in... loop that auto-discovers all sub-* folders. Appends a template loop if nothing is selected.
SLURM Wrap
Prepends a complete #SBATCH header. Skips if one already exists.
Error Handling
Adds set -euo pipefail and a trap that prints the failing line number.
Logging
Redirects all output to a timestamped log file via tee.
Parallelise
Appends a GNU Parallel block for all subjects with 4 parallel jobs.
Keyboard shortcuts
Tab
Insert 4 spaces. On multi-line selection, indents all lines.
Shift+Tab
De-indent selection.
Ctrl+H
Open Find & Replace modal.
Ctrl+/
Toggle line comment (# for bash/python).
Pipeline Builder
Overview

The Pipeline Builder generates complete, runnable bash/Python pipeline scripts from real tool commands. Every step contains the actual flags and correct output paths — not placeholder calls. The generated script updates live on the right as you change any parameter.

The Pipeline Builder has two columns. Left: Global Config + step cards + execution mode. Right: live scrolling script preview with Copy, Send to Editor, and Download buttons.
Global Config bar

Four fields at the top of the left panel apply to every step in the pipeline:

Subject ID
Used as $SUBJ throughout. In loop/SLURM mode this is overridden automatically.
BIDS directory
Root of your BIDS dataset. Used by BET, FEAT, fMRIPrep etc. to find input files.
Derivatives dir
Where all output files are written. Used as $OUT_DIR.
CPU threads
Passed as $NTHREADS to recon-all, fMRIPrep, ANTs etc.
How to build a pipeline — example: DICOM → NIfTI → BET
1
Set Global Config paths (BIDS dir, Derivatives dir, Subject ID)
2
Click Add Step → dropdown group BIDS / QC → select DICOM → NIfTI (dcm2niix) → click Add Step
3
Click the dcm2niix card to expand it → set DICOM source dir to where your raw DICOMs live (e.g. /data/raw/{subject}) → set Series pattern to match your folder structure
4
Click Add Step → dropdown group Structural / Registration → select Brain Extraction (BET) → click Add Step
5
Expand the BET card → adjust Fractional threshold (0.3–0.5 for T1w, lower = keeps more). The script already reads $T1 which dcm2niix sets automatically.
6
Click Download .sh on the right panel, or Send to Editor to further customise
Variable chaining: dcm2niix sets $T1 pointing to the converted T1w NIfTI. BET reads $T1 automatically. You do not need to manually connect steps.
All 27 available steps
BIDS / QC
BIDS Validation · DICOM→NIfTI (dcm2niix) · MRIQC
Structural
N4 Bias Correction · BET · FLIRT · FNIRT · FAST · ANTs SyN
FreeSurfer
recon-all · asegstats2table · aparcstats2table
fMRI
fMRIPrep · FEAT GLM · MELODIC ICA · Randomise
Resting-State
Functional Connectivity (nilearn) · AFNI afni_proc.py
VBM
fslmaths GM modulation
DWI / Tractography
FSL eddy · MRtrix3 preprocessing · FOD estimation · 5TT · iFOD2 tractography · Connectome · DIPY DTI
HPC
SLURM array header
Variable chaining between steps
dcm2niix →
sets $T1 (T1w NIfTI path for BET/registration)
N4 Bias →
sets $T1_BRAIN (overrides input for next step)
BET →
sets $T1_BRAIN and $T1_MASK
FLIRT →
reads $T1_BRAIN, sets $AFF_MAT and $T1_MNI_LIN
FNIRT →
reads $AFF_MAT, sets $WARPFIELD
FAST →
sets $GM_PROB and $WM_PROB
recon-all →
sets $FS_SUBJ_DIR
eddy →
sets $DWI_EDDY and $DWI_BVEC_ROT
MRtrix preproc →
sets $DWI_PREPROC and $DWI_MASK
FOD estimation →
sets $FOD_WM
5TT →
sets $TT5 and $GMWMI
Tractography →
sets $TRACKS and $SIFT2_WEIGHTS
Execution modes
Single subject
Plain script using $SUBJ from Global Config. Run as bash pipeline.sh. Use this to test before scaling up.
For loop
Discovers all sub-* folders in BIDS_DIR and loops. Run as bash pipeline.sh. Sequential — one subject at a time.
GNU Parallel
Wraps all steps in a function, runs with parallel -j 4. Best for multi-core workstations.
SLURM array
Adds full #SBATCH directives. Extra fields appear for partition, memory, walltime, email. Submit with sbatch pipeline.sh.
5 presets
Structural
N4 Bias → BET → FLIRT → FNIRT → FAST → recon-all → asegstats → aparcstats
fMRI
BIDS Validate → MRIQC → fMRIPrep → FEAT GLM → Randomise
rs-fMRI
BIDS Validate → MRIQC → fMRIPrep → MELODIC ICA → Functional Connectivity
DWI
BIDS Validate → eddy → MRtrix preproc → FOD → 5TT → Tractography → Connectome → DTI
VBM
BIDS Validate → N4 Bias → BET → FLIRT → FNIRT → FAST → GM Modulation → Randomise
Study Setup Wizard
Purpose

The Study Setup Wizard is the fastest way to get a correctly-configured pipeline. Answer 4 questions and the Pipeline Builder opens pre-loaded with the right steps and parameters for your study type, field strength, and analysis goals.

Use the Wizard for new studies. Use the Pipeline Builder directly for fine-grained control.
The 4 steps
1
Study type — Structural, Task fMRI, Resting-State, DWI, VBM, Cortical Thickness, DICOM→BIDS, or DTI only.
2
Scanner settings — field strength (1.5/3/7T), manufacturer, TR, subjects, BIDS path, derivatives path, threads.
3
Analysis options — changes per modality. fMRI: TR, smoothing, FD threshold. DWI: PE direction, track count, atlas. Structural: BET threshold, registration tool.
4
Execution mode — Single, For loop, GNU Parallel, or SLURM (reveals partition/memory/walltime/email fields).
DICOM → BIDS Heuristic Builder
What it generates

Three files plus a BIDS Tree preview:

heuristic.py
Complete valid Python HeuDiConv heuristic with create_key(), infotodict(), and series→key mapping. Save at /data/bids/code/heuristic.py.
dcm2niix.sh
Batch conversion script for all subjects (and sessions if specified).
heudiconv.sh
Runs HeuDiConv for all subjects, checks heuristic.py exists, finishes with bids-validator.
BIDS Tree
Preview of expected output folder and filename structure for your first 3 subjects.
How to use it
1
Enter DICOM source pattern using {subject} placeholder and your BIDS output directory
2
Enter subject IDs (space-separated) and session labels (blank if no sessions)
3
Add a row for each scan series — enter the exact series description from your DICOM header, assign BIDS datatype and suffix
4
Or load a preset: Structural only · Structural+fMRI · Structural+DWI · Full multimodal
5
Click Generate All Files → switch tabs to preview each output → download
Series descriptions must match exactly what HeuDiConv sees in the DICOM header. Check with: dcm2niix -h or DICOM tag (0008,103E).
Protocol Library
9 full protocols
HCP-Style Structural
BET → FLIRT → FNIRT → ANTs CT → recon-all → parcstats
FSL VBM
BET → FAST → FNIRT → modulated GM → randomise TFCE
fMRIPrep + FEAT
fMRIPrep preprocessing → FSL FEAT first-level GLM
Resting-State fMRI
fMRIPrep → bandpass → Schaefer parcellation → correlation matrix
MRtrix3 Full DWI
Denoise → Gibbs → topup/eddy → 5TT → SS3T-CSD → iFOD2 → SIFT2 → connectome
DTI Fitting (DIPY)
FSL eddy + DIPY WLS tensor → FA/MD/RD/AD maps
Seed-Based FC
fMRIPrep → PCC seed → whole-brain correlation → z-transform
SLURM Job Array
Production HPC template with auto subject discovery and per-subject logging
MRIQC Group QC
Participant IQMs → group report → Python outlier detection
Using a protocol

Click any protocol card to open a preview with three tabs: Full Script (complete code with line numbers), Details (inputs/outputs, requirements, DOI references), and Pipeline Steps (step-by-step data flow). Use Deploy to Pipeline Builder to load all steps with correct parameters.

Subject QC Tracker
Overview

A spreadsheet-style QC table. Each row is a subject, each column is a QC metric. Enter measured values and cells colour automatically — green (pass), amber (warning), red (fail) — based on published thresholds. Choose the modality (Structural / fMRI / DWI) to switch metric sets.

Thresholds by modality
Structural
SNR ≥15 · CNR ≥1.5 · EFC ≤0.4 · FBER ≥500 · WM2MAX 0.6–0.85 · BET pass/fail · Registration pass/fail
fMRI
FD mean ≤0.3mm · FD max ≤2.0mm · Scrubbed ≤20% · tSNR ≥40 · DVARS ≤1.3 · AOR ≤0.2 · Vols ≥150 · EPI Reg pass/fail
DWI
SNR b0 ≥15 · FA WM 0.35–0.60 · MD 0.6–0.9 · Outlier vols ≤5% · Motion max ≤2.0mm · Mean motion ≤0.8mm · Mask pass/fail · Tractography pass/fail
Exports

Export CSV produces a publication-ready table with all subjects, metrics, and pass/fail status. Methods Text generates a complete paragraph for your paper's Methods section — thresholds used, subjects assessed, subjects excluded with reasons, and final N. Ready to paste directly into your manuscript.

Command Hub
37 commands across 9 tool families

Search by command name, flag name, or description keyword. Filter pills restrict to one tool. Each card shows a full explanation, a key flags table, a real working example with a Copy button, and the official documentation link. The match count updates live as you type.

FSL (10)
bet · flirt · fnirt · feat · randomise · eddy_openmp · fslmaths · fslstats · applywarp · melodic
FreeSurfer (4)
recon-all · asegstats2table · aparcstats2table · mri_convert
ANTs (3)
antsRegistrationSyN.sh · antsApplyTransforms · N4BiasFieldCorrection
AFNI (2)
3dDeconvolve · afni_proc.py
MRtrix3 (5)
mrconvert · dwidenoise · tckgen · tcksift2 · tck2connectome
Python (4)
nibabel.load() · NiftiLabelsMasker · ConnectivityMeasure · TensorModel (DIPY)
DICOM (3)
dcm2niix · heudiconv · bids-validator
BIDS Apps (2)
fmriprep · mriqc
HPC (3)
sbatch · GNU parallel · singularity run
Workflow: DICOM → BIDS
Option A — Heuristic Builder (recommended)
1
Open Heuristic Builder → enter series descriptions, subject IDs, paths
2
Click Generate → download heuristic.py, save to /data/bids/code/
3
Download heudiconv.sh → run it — converts all subjects and validates
4
Check BIDS Tree tab first to verify the expected structure before running
Option B — Pipeline Builder (dcm2niix only)
1
Open Pipeline Builder → Add Step → BIDS/QC → DICOM → NIfTI (dcm2niix)
2
Expand the card → set DICOM source dir and series pattern
3
Add further steps (BET, FLIRT etc.) — they will chain from dcm2niix output automatically
4
Download and run the script. Note: this does raw NIfTI conversion only, not full BIDS organisation. Use Option A for proper BIDS.
For a proper BIDS-compliant dataset (required by fMRIPrep, MRIQC, BIDS Apps) use Option A (Heuristic Builder). Option B is for quick raw conversions only.
Workflow: Structural MRI
Complete structural preprocessing
1
DICOM → BIDS — use Heuristic Builder. Include T1w (and T2w if available).
2
QC raw data — run MRIQC, enter IQMs into QC Tracker, flag poor scans early.
3
N4 Bias correction — correct intensity inhomogeneity before brain extraction.
4
Brain extraction — BET with f=0.35–0.4, -B robust mode. Check mask in FSLeyes.
5
Linear registration — FLIRT 12-DOF to MNI152. Save .mat for re-use.
6
Non-linear registration — FNIRT or ANTs SyN for better accuracy.
7
Surface reconstruction — recon-all (6–16 hrs). Use -parallel -openmp.
8
Export stats — asegstats2table (subcortical volumes), aparcstats2table (cortical thickness).
Load the Structural preset in Pipeline Builder for steps 3–8 pre-configured.
Workflow: Task fMRI
Complete task fMRI analysis
1
BIDS conversion — include T1w, BOLD, fieldmap in Heuristic Builder setup.
2
MRIQC — check tSNR, FD, DVARS. Enter into QC Tracker. Exclude outliers early.
3
fMRIPrep — fieldmap correction, motion correction, MNI normalisation, confound extraction.
4
First-level GLM — FEAT with events.tsv. TR, HPF 128s, smoothing 6mm FWHM.
5
Group analysis — randomise with TFCE (5000 permutations), threshold at p<0.05 FWE.
Workflow: Diffusion MRI
MRtrix3 tractography pipeline
1
Acquire — DWI with reverse-PE b0 for topup. Save bvals/bvecs in BIDS.
2
Denoise — dwidenoise (must be the first step on raw data).
3
Gibbs unringingDistortion correction (topup + eddy) → Bias correction (N4).
4
5TT segmentation — 5ttgen fsl for anatomically constrained tractography.
5
FOD estimation — dwi2response dhollander + dwi2fod msmt_csd.
6
Tractography — tckgen iFOD2, 10M streamlines, seeded from GMWMI.
7
SIFT2 — tcksift2 to weight streamlines by FOD amplitude.
8
Connectome — tck2connectome with parcellation atlas, normalised by node volume.
Load the DWI preset in Pipeline Builder for steps 2–8 in one click.
User Accounts
Do I need an account?

No. All panels work without signing in. An account lets you save scripts to the database so they persist across sessions and devices.

Saving scripts

Sign in → write or edit a script → click Save → enter a name. Saved scripts appear in the Account panel. Click Load to restore to the editor. Registration may be disabled by the site admin — if so the Register tab is hidden.

FAQ
Does SpinLab process my MRI data?

No. SpinLab generates scripts. You download the script and run it on your own machine, server, or HPC cluster where the neuroimaging tools are installed. No data is uploaded to SpinLab at any point.

Do I need an account to use SpinLab?

No. All panels — Pipeline Builder, Heuristic Builder, Protocol Library, QC Tracker, Command Hub — are fully functional without signing in. An account only lets you save scripts to the database so they persist across sessions and devices.

The Pipeline Builder steps don't chain — dcm2niix output isn't used by BET

Make sure dcm2niix is step 1 and BET is step 2. The dcm2niix step sets $T1 at the end of its code block — BET reads $T1 automatically from the same script scope. If you add BET before dcm2niix, $T1 is not yet set. Order matters.

The generated script fails with "Permission denied" on /data

The default placeholder paths like /data/bids and /data/derivatives require root access on most systems. Replace them with your actual paths in the Pipeline Builder Global Config bar before downloading — for example /home/yourname/project/bids on Linux or /mnt/c/Users/yourname/project/bids on WSL.

HeuDiConv fails with "IsADirectoryError"

The -d path must point to the files inside your DICOM folder, not the folder itself. Make sure the path ends with /* — for example /data/raw/{subject}/DICOM/*. SpinLab's Heuristic Builder generates this correctly automatically.

dcm2niix converted my DICOMs but BET can't find the T1w file

dcm2niix names output files from the DICOM protocol name stored in the scanner header (e.g. WIP_3DT1_301_phMag.nii.gz), not the BIDS convention. You need to rename it to sub-001_T1w.nii.gz before BET can find it. The best solution is to use the Heuristic Builder instead — it runs HeuDiConv which renames files to BIDS convention automatically.

Which tool versions are the scripts written for?

Scripts are tested against FSL 6.0.7, FreeSurfer 7.4.1, ANTs 2.5.3, MRtrix3 3.0.4, fMRIPrep 23+, HeuDiConv 1.3+. Earlier versions generally work but specific flags may differ. See the Install Guides for recommended versions.

Can I run the generated scripts on Windows?

Yes — through WSL 2 (Windows Subsystem for Linux). Install WSL 2 with Ubuntu, then install the neuroimaging tools inside WSL exactly as you would on Linux. Your Windows files are accessible inside WSL at /mnt/c/Users/yourname/. See the Install on Windows guide for step-by-step instructions including how to set up the X server for GUI tools like FSLeyes.

Environment Checker
What it does

The Environment Checker generates a bash script that verifies which neuroimaging tools are installed on your system — and which versions. Run it in any terminal (local, WSL, or HPC) to get a complete readiness report before starting your analysis. Each tool shows ✓ with version or ✗ if not found. A summary at the bottom shows total installed vs missing.

13 tool groups covered
FSL
bet, flirt, fnirt, fast, eddy, randomise, melodic, fslmaths, FSLeyes — FSLDIR env check
FreeSurfer
recon-all, mri_convert, asegstats2table, aparcstats2table — licence file check
ANTs
antsRegistration, antsRegistrationSyN.sh, N4BiasFieldCorrection, antsApplyTransforms
AFNI
afni, 3dDeconvolve, afni_proc.py
MRtrix3
mrconvert, dwidenoise, tckgen, tcksift2, tck2connectome, mrview
DICOM / BIDS
dcm2niix, heudiconv, bids-validator
fMRIPrep / MRIQC
fmriprep, mriqc — Python module check
Python stack
nibabel, nilearn, nipype, dipy, tedana, antspy, pybids, mne with version numbers
Nipype / Niflow
nipype, niflow, traits, networkx — workflow engine dependencies
SPM12 / CAT12
MATLAB, MCR standalone, SPM_HOME and CAT12_HOME environment variables
Connectome Workbench
wb_command, wb_view — HCP cifti/gifti tools
Defacing / QC
pydeface, mri_deface, mriqc Python module
HPC / Cluster
sbatch, GNU parallel, singularity, apptainer, docker
Usage
All groups
All groups are checked by default. Click Generate Selected to create a script for all checked groups.
Single group
Click the button on any group row to generate a script for that tool only — your other checkboxes are preserved.
Select All / None
Quick toggles at the top of the group list to check or uncheck all groups at once.
Run the script
bash spinlab_env_check.sh — works in any bash terminal: local Linux, WSL, macOS, or HPC login node.
BIDS Dataset Browser
What it does

Enter your BIDS directory path and the Browser generates a bash analyser script that scans your dataset and produces a complete report: subject count, modality coverage per subject, missing file detection, total storage size, participants.tsv summary, and bids-validator output. Run it before preprocessing to confirm your dataset is ready.

What the report covers

Required root files (dataset_description.json, participants.tsv, README, .bidsignore), subject folder detection (sub-* count), modality coverage (anat/, func/, dwi/, fmap/, perf/) with per-subject breakdown, subjects missing anatomical data, NIfTI and JSON sidecar counts, total dataset size, and bids-validator output if installed.

Study Design Calculator
What it does

Input your study parameters and the calculator estimates compute and storage requirements across all standard pipeline types. Results update live as you change any input.

Inputs
Subjects
Total number of subjects in your study
Pipeline
Structural MRI, Task fMRI, Resting-state fMRI, DWI, VBM, TBSS, or ASL
Field strength
1.5T, 3T, or 7T — adjusts time (+30% for 7T), memory, and storage estimates accordingly
Environment
Local laptop, workstation, or HPC — affects parallelism and SLURM config
CPU cores / parallel jobs
Per-subject CPU allocation and number of simultaneous subjects
Outputs
Time estimates
Hours per subject and total wall-clock time (displayed as hours or days)
CPU hours
Total compute hours — useful for HPC allocation requests and cost estimation
Storage
Raw DICOM, BIDS NIfTI, and derivatives separately — all in GB
Memory
Per-subject and peak parallel memory requirements
SLURM config
Ready-to-paste #SBATCH block with --array, --cpus-per-task, --mem, --time and GNU Parallel fallback for local/workstation
Warnings
Automatic alerts for storage > 1TB, memory > 128GB, walltime > 1 week, or 7T-specific QC requirements
SpinAI Intelligence Features
Pipeline DNA — Reproducibility Fingerprinting

Every pipeline you build in the Pipeline Builder can be converted to a unique DNA fingerprint — a short code like SL-BET-FLIT-FNIT-E7A3C2F1 that encodes every step, every parameter, and every configuration value. Click the DNA button in the Pipeline Builder toolbar.

Share the DNA code in your paper's Methods section. Anyone who enters it into SpinLab gets your exact pipeline automatically loaded — same steps, same parameters, same order. A full reproducibility URL is also generated that can be shared directly. This is the neuroimaging equivalent of a git commit hash.

SpinAI Parameter Guide

Every parameter in the Pipeline Builder has a small ? button. Clicking it opens the SpinAI panel with a contextual explanation of what the parameter does, whether your current value is appropriate for your pipeline, when to go higher or lower, and a specific literature citation. SpinAI is aware of your other pipeline steps and adapts its recommendation accordingly.

No API key required — a built-in knowledge base covers 60+ parameters across all Pipeline Builder steps: BET (f threshold, gradient, robust mode), FLIRT (DOF, cost function, interpolation, reference), FNIRT (config), FAST (tissue classes, type), FreeSurfer (SUBJECTS_DIR, recon-all flags), dcm2niix (filename pattern, merge, BIDS sidecars), Eddy/DWI (acqp, index, repol), MRtrix3 (algorithm, streamlines, ACT, backtrack), SLURM (partition, memory, walltime, array), fMRIPrep (output spaces, FD threshold, license), ASL (PLD, tau, sequence type), tedana, MELODIC, Randomise, TBSS, and all QC metrics. If an API key is configured in the Admin panel, SpinAI upgrades to a full AI-powered response automatically.

Live Methods Section

Below the Generated Script in the Pipeline Builder, the Live Methods Section panel updates in real time as you add and configure steps. It generates a complete academic Methods paragraph in past tense, third person, with tool citations and specific parameter values — ready to paste directly into a manuscript. When you change a parameter, the text updates within a second.

Error Decoder

Paste any neuroimaging error message into the Error Decoder panel. SpinLab checks it against a built-in database of 40+ known neuroimaging errors — dcm2niix folder invalid, FNIRT convergence failure, matrix file not found, out-of-memory kills, bvec/bval mismatches, FreeSurfer licence missing, HeuDiConv path issues, and more.

For each match, three ranked causes are shown with probability percentages, a diagnostic command to confirm the cause, and the exact fix. For errors not in the database, SpinAI analyses the error message live.

Study Replication Assistant

Paste the Methods or Preprocessing section from any neuroimaging paper and SpinLab reads it, extracts every processing step and parameter mentioned, and deploys the pipeline to the Pipeline Builder with one click — with parameter values pre-filled from the paper.

A Reproducibility Gap Report is generated showing every parameter the paper did not specify — what was assumed and why. This makes invisible gaps in published methods visible, directly addressing the neuroimaging reproducibility crisis.

Pipeline Diff Viewer

Load your current pipeline alongside any built-in preset. SpinLab shows a three-column table: your pipeline | the preset | scientific impact. For every step that differs, SpinAI explains in one sentence what the difference means for your analysis results, citing the relevant paper where applicable. Colour-coded: green = added, red = removed, amber = changed parameter.

Result Sanity Checker

Enter your QC metrics — cortical thickness, WM FA, tSNR, framewise displacement, mean diffusivity, etc. — and SpinLab checks them against normative ranges derived from large datasets including HCP (n=1,200), UK Biobank (n=40,000), ABIDE (n=1,112), Cam-CAN (n=652), and 50+ published studies.

Each metric shows ✅ Normal / ⚠️ Outside range / 🚨 Abnormal with the exact normal range, and an explanation of what might be causing any abnormal value and what to check.

NIfTI Viewer
Overview

A fully browser-based neuroimaging viewer powered by Niivue (WebGL2). Supports NIfTI, NRRD, MIF, MGZ, GIfTI, FreeSurfer surfaces, and tractography files. All files are read locally — nothing is uploaded to any server.

Access via NIfTI Viewer in the left navigation. Load files using the Layers panel on the left or drag-and-drop directly onto the canvas — file type is auto-detected from the extension.

Supported file formats
Volumes
NIfTI (.nii, .nii.gz), NRRD, MRtrix MIF, MGH/MGZ, AFNI HEAD/BRIK, ITK MHD
Surfaces / Meshes
GIfTI (.gii), FreeSurfer (.pial, .white, .inflated, .sphere), MZ3, OBJ, STL, legacy VTK
Tractography
MRtrix TCK, TrackVis TRK, TRX, VTK tracts
Multi-file drop
Drop multiple files at once — each is detected by extension and added to the correct layer type
Layers panel

The Layers panel replaces separate Volume/Overlay/Mesh/Tract loaders. Every loaded file appears as a layer in a dynamic list. Each layer shows its type icon, a colormap gradient swatch, and two buttons:

👁 Eye button
Toggle layer visibility on/off without removing it
✕ Remove button
Permanently remove the layer
⠿ Grip handle
Drag to reorder layers — the list order reflects the rendering stack
Click layer row
Select the layer — shows per-layer controls below (colormap, opacity, threshold, blend mode)
🗑 Trash icon
Remove all layers and reset the viewer completely

First volume loaded becomes the base. Every subsequent volume is automatically set to Red-Yellow colormap at 70% opacity as an overlay. Surfaces and tractography files are added via separate loaders below the volume loaders.

Per-layer controls

Clicking a layer in the list opens its individual controls:

Colormap
12 options: Gray, Hot, Cool, Winter, Jet, HSV, Red-Yellow, Blue-Green, GE Color, Inferno, Viridis, Plasma
Opacity
Slider 0–1. For the base volume use 1. For overlays 0.5–0.8 is typical.
Threshold Min / Max
Clips the display range. Values outside this range are transparent. Essential for statistical maps.
Auto Range
Sets threshold to the robust min/max of that layer's data automatically
Blend Mode
Normal (default) / Add (brighten — intensities sum) / Subtract (darken — difference map)
View layouts
3-Plane
Axial + coronal + sagittal simultaneously — default view
Mosaic / Lightbox
Grid of axial slices. Set columns and rows to control how many slices appear. Essential for whole-brain QC.
Axial / Coronal / Sagittal
Single-plane full-canvas views
3D Render
Volumetric rendering. Clip plane slider cuts through to reveal internal structures.
QC Contact Sheet

Load many NIfTIs at once for rapid quality control. Click QC Contact Sheet (multi-file) and select any number of files. A full-screen grid opens showing one slice thumbnail per file rendered live. Controls at the top let you switch axis (Axial/Coronal/Sagittal) and slice position (10%–90%). Click any thumbnail to open that file in the main viewer. Use this instead of opening files one by one during subject-level QC.

Tools
Screenshot
Downloads the current view as a PNG named after the loaded file
Slices
Exports the middle axial slice as PNG. Full multi-slice export requires JSZip in js/.
Ruler
Click two points on any slice to measure distance in mm
Draw
ROI drawing mode — paint voxels on slices. Pen size slider controls thickness. Undo, Clear, and Save ROI (.nii) buttons. Requires Niivue ≥ 0.45.1.
Compare
Splits canvas 50/50 — load a second volume on the right with synchronised crosshair (orange). Essential for registration QC.
4D Timeseries

Appears automatically when a 4D NIfTI is loaded. Controls include: volume index slider, play/pause, and speed buttons (0.5× / 1× / 2× / 4×) and a loop toggle. Clicking any voxel plots its intensity across all time points as a live chart — use this to spot motion spikes, signal dropout, or confirm a clean BOLD signal.

Intensity Histogram

Shows voxel intensity distribution for the base volume (zeros excluded). The green highlighted region shows the current display range. Bars outside the range are dark. Updates when the intensity range changes. Use to set thresholds for statistical maps and check for bias field inhomogeneity.

Annotations

Click anywhere on the image to record MNI coordinates, voxel index, and intensity. Click Pin current location to save with a custom label. Each annotation shows a ⊕ jump button — clicking it moves the crosshair to that exact coordinate. Export all annotations as CSV. Useful for QC findings, lesion marking, and methods documentation.

Header Inspector

Full NIfTI header in human-readable form: dimensions, voxel size, TR, data type, spatial/temporal units, sform/qform codes (decoded), slice order, cal range, scl_slope/intercept, intent code, description, global/robust min/max. The copy icon in the header title copies the entire header as clean JSON — paste directly into lab notes or a methods section.

Keyboard shortcuts

Click the ⌨ keyboard icon in the viewer title bar for a full shortcut reference. Key bindings include: scroll slices, pan (middle-drag), zoom (pinch/+−), adjust contrast (right-drag), cycle views (V), toggle axis (A/C/S), prev/next slice (←/→), adjust opacity ([/]), and reset zoom (R).

Script Library
What it does

The Script Library is a curated collection of community pipeline scripts covering 8 neuroimaging categories. Scripts can be previewed, searched by keyword, and sent directly to the Script Editor with one click.

Categories
Structural
T1w preprocessing, VBM, cortical thickness, subcortical volumes
fMRI
Task fMRI GLM, resting-state FC, ICA denoising
DWI
Diffusion preprocessing, tractography, connectome construction
QC
MRIQC wrappers, manual QC scripts, outlier detection
HPC
SLURM array templates, GNU parallel wrappers, job monitoring
Utility
File renaming, BIDS conversion helpers, path utilities
Submitting a script

Click Contribute a Script in the library toolbar to open the submission guidelines. Scripts are reviewed by the MRISpin team before being added to the public library. Include: title, description, category, and the full script code.

Cohort Manager
What it does

A subject-level database for managing your study cohort. Replaces the spreadsheet most researchers use to track who has been scanned, who is excluded, and basic demographics. Data is saved in your browser and persists across sessions.

Subject fields
ID
Subject identifier — follows BIDS convention automatically (e.g. sub-001)
Age
Age in years — used in group statistics summary
Sex
M / F / O — counted in the stats bar
Group
Study group label (e.g. Control, Patient, HC, MDD)
Visit
Visit number for longitudinal studies (1, 2, 3...)
Date
Scan date
Status
included / excluded / pending — excluded subjects are greyed and struck through
Notes
Free text — motion issues, protocol deviations, exclusion reasons
Import and export
Import CSV
Load an existing spreadsheet — columns matched by header name (case-insensitive)
Export CSV
Download all subjects as a standard CSV file
participants.tsv
Export included subjects in BIDS participants.tsv format — drop directly into your BIDS dataset root
Stats bar

Shows live counts at the top: total subjects, included, excluded, male/female split, and mean age. Filters (All / Included / Excluded) and search apply instantly across all fields.

BIDS Validator
What it does

Validates a BIDS dataset entirely in the browser — no upload, no terminal, no internet required beyond loading the page. Click "Select BIDS Dataset Folder" and choose your dataset root. The validator scans all file paths and reports errors, warnings, and informational notes.

What is checked
dataset_description.json
Must be present in the root folder with required fields
participants.tsv
Recommended — warning if missing
README
Recommended — warning if missing
Subject folders
Must follow sub-<label> naming convention
Session folders
Must follow ses-<label> if sessions are used
NIfTI filenames
Checked for BIDS suffix (T1w, bold, dwi, fmap, etc.) and sub- prefix
JSON sidecars
Each NIfTI must have a matching .json sidecar
events.tsv
Task fMRI bold files should have a matching events.tsv
Unexpected files
Files in root that are not part of the BIDS specification are flagged
Report

Errors (red), Warnings (yellow), and Info (grey) are shown with the rule code, description, and file path. The score card shows total error and warning counts. Export the full report as a text file for documentation or sharing with collaborators.

Citation Generator
What it does

Generates a formatted bibliography for the neuroimaging tools used in your study. Select the tools from the list, choose your citation format, and copy the ready-to-paste bibliography and acknowledgement sentence for your manuscript.

Tools covered (26)

FSL core, BET, FLIRT, FNIRT, FAST, FEAT, MELODIC, randomise, TBSS, eddy, FreeSurfer, recon-all, ANTs/SyN, N4BiasFieldCorrection, fMRIPrep, MRIQC, dcm2niix, HeuDiConv, BIDS standard, MRtrix3, Nilearn, Nipype, AFNI, SPM, tedana, Niivue.

Output formats
APA 7th
Numbered reference list — standard for most neuroscience journals
Vancouver
Numbered, comma-separated — standard for medical journals
BibTeX
@article{} entries — paste into your .bib file for LaTeX documents
From Pipeline

Click From Pipeline to automatically select citations based on the steps currently in your Pipeline Builder. This matches pipeline step types to their corresponding tools and pre-selects them in the list.

Acknowledgement sentence

A ready-to-paste sentence is generated below the bibliography: "Data were processed using the following neuroimaging tools: [list]. We thank the developers of these open-source software packages." Copy it directly into your Methods or Acknowledgements section.

FSL Design Builder
What it does

A visual GUI for building FSL GLM design matrices without needing a desktop FSL installation or the FSL GUI. Define conditions (EVs), onset timings, contrasts, and nuisance regressors — then download the files needed for FEAT or film_gls.

Conditions (EVs)

Add conditions using the + Add button. For each condition set a name and colour, then enter onset timings in the text area — one row per block, format: onset_seconds duration_seconds. The design matrix preview updates live.

Contrasts

Add contrasts and set weights for each condition. For a simple A > B contrast: A=1, B=-1. For a main effect: set the target condition to 1 and all others to 0. Contrast names are included in the exported .con file.

Nuisance regressors

Tick boxes for: 6 motion parameters (standard), CSF signal, WM signal, global signal. These are added as additional columns in the design matrix with zero values — replace with your actual regressor timeseries before running FEAT.

Downloads
design.mat
Full design matrix — load into FEAT via "Custom (3-column format)" or pass to film_gls directly
design.con
Contrast file — all contrasts with weights and names
design.fsf
Partial FSF setup file — sets TR, volumes, number of EVs and contrasts. Complete in the FSL GUI.
Pipeline Export — Snakemake & Nextflow
What it does

The Pipeline Builder can export your pipeline as a Snakemake workflow or a Nextflow DSL2 pipeline in addition to the standard bash script. The same steps and parameters are used — just a different execution format suited for reproducible, HPC-scale pipelines.

Snakemake export

Click the Snakemake button in the Pipeline Builder toolbar. Downloads a Snakefile with one rule per pipeline step. Includes a SUBJECTS list from your subject list, BIDS_DIR and OUT_DIR from global config, and THREADS from your settings. Each rule has a touch output so Snakemake can track completion and re-run only failed steps.

Nextflow export

Click the Nextflow button. Downloads a pipeline.nf DSL2 file with one process per step, a Channel from your subject list, and a workflow block chaining all processes in order. Parameters (bids_dir, out_dir, threads, subjects) are exposed as params.* and can be overridden at runtime with --param value.

Usage
Snakemake run
snakemake --cores 8 --snakefile Snakefile
Nextflow run
nextflow run pipeline.nf --subjects sub-001,sub-002
Dry run (Snakemake)
snakemake -n --snakefile Snakefile — shows what would run without executing
Protocol Checker
What it does

Enter your MRI acquisition parameters and SpinLab checks them against published recommendations for that modality and field strength. Each parameter is scored as pass, warning, or fail with an explanation. The overall protocol score (0–100) summarises how well the protocol matches best-practice guidelines.

Modalities supported
Resting-state fMRI
TR, TE, flip angle, voxel size, number of slices checked against Biswal et al. and HCP recommendations
Task fMRI
Same parameters — slightly relaxed TR requirement for event-related designs
Structural T1w
TE, flip angle, voxel size checked — high resolution isotropic voxels recommended
DWI
TE, flip angle, voxel size; b-values field for multi-shell check
ASL Perfusion
TR, TE, PLD (post-labelling delay) checked against ISMRM consensus recommendations
Field strength

Recommended ranges change with field strength. Select 1.5T, 3T, or 7T and all thresholds update accordingly — for example, TE at 7T is shorter due to faster T2* decay, and flip angles are lower due to SAR constraints.

Isotropic voxel check

Always checks whether voxels are isotropic regardless of modality. Anisotropic voxels (e.g. 3×3×4mm) complicate registration and resampling and are flagged with a warning.

QC Tracker — Group Distribution View
What it does

Click Group View in the QC Tracker toolbar to open a dot plot showing every subject's value for a chosen metric. Each dot represents one subject. Outliers more than 2 standard deviations from the mean are highlighted in red — these are candidates for exclusion or closer manual inspection.

Controls
Metric selector
Choose any numeric QC metric from the current modality to plot
Show excluded
Toggle whether excluded subjects appear as faded dots
Mean line
Green vertical line marks the group mean
2 SD lines
Yellow dashed lines mark ±2 SD — dots outside are red outliers
Stats bar
Shows n, mean, SD, min, max, and outlier count below the chart
NIfTI Viewer — Intensity Profile
What it does

Click Profile in the NIfTI Viewer tools section to enter profile mode. Then click and drag a line across any slice. SpinLab samples 80 voxels along that line and plots their intensity values as a chart. Useful for checking bias field (should be smooth and gradual), signal dropout, or intensity uniformity across a region.

Reading the chart
X axis
Position along the drawn line (start → end)
Y axis
Raw voxel intensity value
Stats bar
Shows min, max, mean intensity and number of samples below the chart
Typical use cases

Draw a horizontal line from left to right across an axial slice — a flat profile suggests good uniformity. A slow ramp indicates bias field. A sudden drop suggests signal dropout or susceptibility artefact. Draw across the brain edge to check skull-stripping accuracy.

DICOM Inspector
What it does

Load any DICOM file and inspect every tag it contains — scanner model, sequence, TE, TR, flip angle, slice thickness, dimensions, patient parameters, and more. Everything is read locally in the browser. No file is uploaded anywhere.

Key parameters summary

When a file loads, a summary card immediately shows the most important acquisition parameters: modality, field strength, TR, TE, TI, flip angle, matrix size, pixel spacing, slice thickness, protocol name, sequence name, manufacturer, model, and software version.

Full tag table

All DICOM tags are listed in a searchable table with tag address, name, VR (value representation), and value. Known neuroimaging tags are highlighted. Use the category filter buttons to show only Patient, Study, Series, Image, Acquisition, or MRI-specific tags.

Multi-file navigator

Load multiple DICOM files at once. Use the ← → buttons to step through files without re-opening the dialog. Useful for checking whether tags are consistent across a series.

Export
Export JSON
All tags as a structured JSON file — useful for scripting or documentation
Export CSV
All tags as a CSV — open in Excel or Python pandas
Copy JSON
Copies the full tag set to clipboard as JSON
Power / Sample Size Calculator
What it does

Calculates statistical power and required sample size for neuroimaging study designs. All calculations run in the browser — no server, no data sent anywhere. Results update live as you adjust any slider.

Test types
Independent t-test
Two independent groups — patients vs controls, treatment vs placebo
Paired t-test
Within-subject — pre vs post, longitudinal change
One-sample t-test
Compare group mean to a fixed reference value
Pearson correlation
Brain-behaviour relationships — symptom score vs brain measure
One-way ANOVA
Three or more independent groups
Repeated-measures ANOVA
Multiple time points within subjects
Chi-squared
Categorical outcomes — proportion comparisons
Solve for any unknown
Sample size (n)
Given effect size, α, and desired power — returns required n per group
Power (1-β)
Given n, effect size, and α — returns achieved statistical power
Effect size
Given n, α, and desired power — returns minimum detectable effect size
Dropout / attrition

Enter an expected dropout percentage. The calculator automatically inflates the required sample size: enrolled n = required n ÷ (1 − dropout rate). For a study needing 30 subjects with 15% expected dropout, you would need to enrol 36.

Power curve and methods text

A live chart shows power across the full range of sample sizes, with a yellow 80% reference line. Below the chart, a ready-to-paste methods paragraph is generated describing the power analysis — copy it directly into your ethics application or manuscript methods section.

Effect size reference guide

Each test type shows neuroimaging-specific effect size benchmarks. For example: hippocampal volume differences in Alzheimer's disease are typically d ≈ 0.8; brain-behaviour correlations are typically r ≈ 0.2–0.4; cortical thickness group differences are typically d ≈ 0.4.

Tips & Shortcuts
Editor shortcuts
Tab
Insert 4 spaces (never jumps focus)
Shift+Tab
De-indent selected lines
Ctrl+H
Find & Replace modal
Ctrl+/
Toggle line comment
Esc
Close any modal
Workflow tips
Test single first
Always use Single subject mode to test your pipeline on one subject before switching to For loop or SLURM.
Chain panels
Wizard → Pipeline Builder → Script Editor is the fastest complete workflow.
Deploy protocols
Protocol Library → Deploy loads all steps into Pipeline Builder pre-configured. Then fine-tune parameters.
Find & Replace paths
Use Ctrl+H to change /data/bids/scratch/project/bids across all 40 lines at once.
QC before analysis
Always populate the QC Tracker before group analysis. Export CSV as a supplementary table.
BIDS Tree preview
Check the Heuristic Builder BIDS Tree tab before running HeuDiConv to verify filename structure.
Order matters
In Pipeline Builder, steps must be in logical order. dcm2niix before BET, BET before FLIRT, N4 before BET.

Sources & References

All commands, code snippets and documentation in MRISpin SpinLab are derived from the original open-source tools and publications listed below. We acknowledge all authors and respect their licensing terms.

All tools listed below are open-source software distributed under their respective licences (Apache 2.0, BSD, GPL, MIT etc.). MRISpin provides convenience wrappers and templates only — we do not distribute or modify any third-party binaries. Users must download and install each tool directly from its official source.
FSL
FSL — FMRIB Software Library

Brain extraction (BET), linear/non-linear registration (FLIRT/FNIRT), GLM analysis (FEAT), ICA (MELODIC), DWI correction (eddy), tractography (FDT), permutation testing (randomise).

Licence: FSL open-source licence (non-commercial academic use)
FreeSurfer
FreeSurfer

Cortical surface reconstruction (recon-all), subcortical segmentation, parcellation statistics (asegstats2table, aparcstats2table), mri_convert.

Licence: FreeSurfer Software License Agreement (free for research)
ANTs
ANTs — Advanced Normalization Tools

SyN non-linear registration, cortical thickness (antsCorticalThickness.sh), N4 bias field correction, antsApplyTransforms.

Licence: Apache License 2.0
AFNI
AFNI — Analysis of Functional NeuroImages

3dDeconvolve GLM, afni_proc.py preprocessing pipeline, align_epi_anat.py, 3dBlurToFWHM, motion censoring.

Licence: Public Domain (US government work)
MRtrix3
MRtrix3

DWI preprocessing (dwidenoise, dwifslpreproc), CSD fibre orientation distribution, iFOD2 tractography, SIFT2 filtering, structural connectome (tck2connectome).

Licence: Mozilla Public License 2.0
Python
nibabel

Reading, writing and manipulating neuroimaging file formats (NIfTI, MGZ, GIFTI, CIFTI). Used in all Python-based neuroimaging scripts.

Licence: MIT License
Python
nilearn

Statistical learning and machine learning for neuroimaging. First-level GLM, functional connectivity, seed-based correlation, parcellation, plotting.

Licence: New BSD License
Python
Nipype

Workflow engine for building reproducible neuroimaging pipelines. Wraps FSL, FreeSurfer, SPM, ANTs, AFNI interfaces into portable Python workflows.

Licence: Apache License 2.0
Python
DIPY — Diffusion Imaging in Python

DTI tensor fitting, FA/MD/RD/AD maps, fibre tracking, noise estimation, gradient table handling.

Licence: BSD 3-Clause
DICOM
dcm2niix

Fast, reliable DICOM to NIfTI converter with automatic BIDS JSON sidecar generation. By Chris Rorden (University of South Carolina).

Licence: BSD 2-Clause
BIDS
fMRIPrep

Robust, standardised fMRI preprocessing pipeline. Handles fieldmap correction, motion correction, confound extraction, ICA-AROMA, and multi-space outputs.

Licence: Apache License 2.0
BIDS
MRIQC

MRI quality control: computes image quality metrics (IQMs) for T1w and BOLD data, generates visual reports for participant and group levels.

Licence: Apache License 2.0
BIDS
HeuDiConv

Heuristic-driven DICOM to BIDS conversion tool. Automates session/run labelling via user-defined heuristic Python scripts.

Licence: Apache License 2.0
HPC
SLURM Workload Manager

Open-source cluster management and job scheduling. Used for submitting neuroimaging pipelines as job arrays across HPC systems.

Licence: GNU General Public License v2
BIDS
Brain Imaging Data Structure (BIDS)

Standard for organising neuroimaging datasets. All BIDS-related commands in MRISpin follow the official BIDS specification v1.8+.

Specification: CC0 Public Domain
MRISpin SpinLab — Disclaimer

MRISpin SpinLab (© 2026 MRISpin) is an independent tool that provides code templates, pipeline builders and reference documentation to assist neuroimaging researchers. It is not affiliated with, endorsed by, or a product of any of the tool developers listed above.

All code snippets are original compositions inspired by official documentation and best-practice examples from the neuroimaging community. They are provided as educational templates under fair-use principles. Users are responsible for citing the appropriate original tools and publications in their research outputs.

If you use any of the above tools in your research, please cite them according to their official citation guidelines.

Helpdesk & Support

Get help with SpinLab, report issues, or contact the MRISpin team. We are happy to assist with setup, scripting questions, and tool feedback.

Email Support
Send us an email for help with SpinLab, installation issues, or scripting questions. We aim to reply within 1–2 working days.
spinlab@mrispin.com
MRISpin Website
Visit the MRISpin website for news, updates, and additional neuroimaging resources.
www.mrispin.com
Report a Bug
Found something broken? Report it and we will look into it as soon as possible. Include your browser, OS, and what you were doing.
spinlab@mrispin.com
Feature Requests
Have an idea for a new panel, snippet, or workflow? We would love to hear it. SpinLab is built around real researcher needs.
feedback@mrispin.com
SpinLab is maintained by the MRISpin team. Response times may vary. For urgent setup issues, check the Documentation and Install Guides panels first — most common problems are covered there.
NIfTI Viewer files stay local
No layers loaded
Drop any neuroimaging file here
NIfTI · NRRD · MIF · GIfTI · TCK · TRK
or use the loaders on the left
Result Sanity Checker

Enter your QC metrics and SpinLab checks them against normative ranges from 50+ published studies.

Normative Sources

Ranges derived from: HCP (n=1200), UK Biobank (n=40,000), ABIDE (n=1112), Cam-CAN (n=652), and 50+ published papers. Values are for healthy adults unless specified.

Enter your metrics and click Check to see how they compare to published normative ranges.
DICOM Inspector Read DICOM tags — files stay local, nothing uploaded
No file loaded
DICOM Tags
Load a DICOM file to inspect its tags
Supports any DICOM modality: MRI, CT, PET, X-ray
Power / Sample Size Calculator For neuroimaging study design
Test Type
Solve For
Effect size (Cohen's d / f / r) 0.50
Small (0.2)Medium (0.5)Large (0.8)
Significance level (α) 0.05
Power (1 − β) 0.80
50%80% (standard)95%+
Sample size (n per group) 32
550100200
Tails
Expected dropout / attrition (%)
Enrolled n = required n ÷ (1 − dropout)
Effect size reference
Result
Full Breakdown
Power Curve
Sample size per group → Power (1-β)
Methods Text
Cohort Manager
BIDS Validator browser-side · nothing uploaded

Select your BIDS dataset folder. The validator checks structure, naming, sidecars and events files against the BIDS specification — no internet connection or terminal needed.

No dataset selected
Checks performed
✓ dataset_description.json present
✓ participants.tsv present
✓ Subject folders (sub-<label>)
✓ Session folders (ses-<label>)
✓ NIfTI filename BIDS suffixes
✓ JSON sidecar for every NIfTI
✓ events.tsv for task bold runs
✓ Unexpected root-level files
Validation Report
Select a BIDS folder to begin validation
Citation Generator

Select the tools used in your study. Generates a formatted bibliography and acknowledgement sentence ready to paste into your manuscript.

Output format
Tools used
Bibliography
Acknowledgement Sentence
FSL Design Builder
Design Preview
design.mat preview

        
Protocol Checker

Enter your MRI acquisition parameters. SpinLab checks them against published recommendations and scores your protocol.

Protocol score / 100
Parameter checks