Script Editor

MRISpin SpinLab
MRISpin v2.5 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

Step-by-step terminal commands for setting up FSL, FreeSurfer, ANTs, AFNI, MRtrix3, dcm2niix and Python packages via WSL 2 (Windows Subsystem for Linux) — the recommended approach for Windows users.

Recommended method: All major neuroimaging tools run natively on Linux. On Windows, install WSL 2 first (Step 1), then follow the Linux commands inside your WSL terminal. This gives you a full Ubuntu environment.
1
Enable WSL 2 & Install Ubuntu
Windows 10 (build 19041+) or Windows 11 required. Run PowerShell as Administrator.
PowerShell (Administrator)
wsl --install
wsl --set-default-version 2
# Restart your PC when prompted, then open Ubuntu from Start Menu

After restart, Ubuntu launches automatically and asks you to create a username/password. Then open Ubuntu from the Start Menu for all subsequent steps.

2
Update System & Install Dependencies
Run inside your Ubuntu (WSL) terminal.
Ubuntu / WSL terminal
sudo apt update && sudo apt upgrade -y
sudo apt install -y wget curl git unzip python3 python3-pip \
    python3-venv build-essential libgl1 libglu1-mesa \
    libgomp1 dc bc libxext6 libxt6 libxrender1 \
    libquadmath0 tcsh libopenblas-dev
3
FSL — FMRIB Software Library
Comprehensive MRI analysis toolkit from Oxford. Includes BET, FLIRT, FEAT, eddy, randomise and more.
Ubuntu / WSL terminal
# Download FSL installer
wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py

# Run installer (will ask for install directory, default: /usr/local/fsl)
python3 fslinstaller.py

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

# Verify
bet --help | head -3
4
FreeSurfer
Cortical surface reconstruction and parcellation. Requires a free license key from MGH.
Ubuntu / WSL terminal
# Download FreeSurfer 7.4 (Ubuntu 22.04 build)
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

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

# Place your license file (download free from MGH website)
# Copy license.txt to $FREESURFER_HOME/license.txt
source ~/.bashrc
recon-all --version
5
ANTs — Advanced Normalization Tools
State-of-the-art non-linear registration, segmentation and cortical thickness.
Ubuntu / WSL terminal
# Install pre-built binaries
wget https://github.com/ANTsX/ANTs/releases/download/v2.5.3/ants-2.5.3-ubuntu-22.04-X64-gcc.zip
unzip ants-2.5.3-ubuntu-22.04-X64-gcc.zip
sudo mv ants-2.5.3 /opt/ants

echo 'export ANTSPATH=/opt/ants/bin' >> ~/.bashrc
echo 'export PATH=${ANTSPATH}:${PATH}' >> ~/.bashrc
source ~/.bashrc

# Verify
antsRegistration --version
6
MRtrix3
DWI tractography, connectome generation and FOD estimation.
Ubuntu / WSL terminal
sudo apt install -y mrtrix3

# OR install latest from source:
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/MRtrix3/macos-installer/master/install)"

mrconvert --version
7
dcm2niix — DICOM to NIfTI Converter
Fast, reliable DICOM conversion with BIDS JSON sidecar generation.
Ubuntu / WSL terminal
sudo apt install -y dcm2niix

# OR install latest binary:
wget https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zip
unzip dcm2niix_lnx.zip
sudo mv dcm2niix /usr/local/bin/
dcm2niix --version
8
Python Neuroimaging Packages
nibabel, nilearn, nipype, DIPY — core Python libraries for neuroimaging analysis.
Ubuntu / WSL terminal
# Create a virtual environment (recommended)
python3 -m venv ~/neuro-env
source ~/neuro-env/bin/activate

# Install core packages
pip install --upgrade pip
pip install nibabel nilearn nipype dipy \
            pandas numpy scipy matplotlib \
            scikit-learn jupyter

# Add activation to shell
echo 'source ~/neuro-env/bin/activate' >> ~/.bashrc

# Verify
python3 -c "import nibabel, nilearn, nipype, dipy; print('All packages OK')"
9
fMRIPrep & MRIQC (via Docker or pip)
Recommended via Docker Desktop for Windows. Docker integrates with WSL 2 automatically.
Ubuntu / WSL terminal
# Option A — pip install (lighter, no Docker needed)
pip install fmriprep mriqc

# Option B — Docker (most reliable, requires Docker Desktop for Windows)
# Download Docker Desktop: https://www.docker.com/products/docker-desktop
docker pull nipreps/fmriprep:latest
docker pull nipreps/mriqc:latest

# Verify pip install
fmriprep --version
mriqc --version

Installing Neuroimaging Tools on Linux

Native installation on Ubuntu 20.04 / 22.04 / 24.04 (recommended) or Debian-based HPC clusters. Commands also apply inside WSL 2 on Windows.

Best environment: Ubuntu 22.04 LTS is the most compatible distribution for all neuroimaging tools. These commands are tested on Ubuntu 20.04, 22.04 and 24.04.
1
System Preparation
Update packages and install all common dependencies in one command.
bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y \
    wget curl git unzip vim htop \
    python3 python3-pip python3-venv python3-dev \
    build-essential gfortran liblapack-dev libopenblas-dev \
    libgl1-mesa-glx libglu1-mesa libxt6 libxext6 \
    libxrender1 libgomp1 dc bc tcsh \
    libquadmath0 libgfortran5 \
    gcc g++ cmake ninja-build
2
FSL — FMRIB Software Library
Full MRI analysis suite. Install via the official Python installer.
bash
wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py
sudo python3 fslinstaller.py -d /usr/local/fsl

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

# Test
flirt -version
bet --help | head -2
3
FreeSurfer
Choose the .deb package matching your Ubuntu version. Requires a free MGH license.
bash
# Ubuntu 22.04
wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer_ubuntu22-7.4.1_amd64.deb
sudo dpkg -i freesurfer_ubuntu22-7.4.1_amd64.deb
sudo apt install -f -y   # fix any missing deps

echo 'export FREESURFER_HOME=/usr/local/freesurfer/7.4.1' >> ~/.bashrc
echo 'source $FREESURFER_HOME/SetUpFreeSurfer.sh' >> ~/.bashrc

# Get free license: https://surfer.nmr.mgh.harvard.edu/registration.html
# Copy license.txt to $FREESURFER_HOME/license.txt
source ~/.bashrc
freesurfer --version
4
ANTs — Advanced Normalization Tools
Best non-linear registration toolkit. Use pre-built binaries for fastest setup.
bash
# Pre-built binary (fastest)
wget https://github.com/ANTsX/ANTs/releases/download/v2.5.3/ants-2.5.3-ubuntu-22.04-X64-gcc.zip
unzip ants-2.5.3-ubuntu-22.04-X64-gcc.zip
sudo mv ants-2.5.3 /opt/ants

echo 'export ANTSPATH=/opt/ants/bin' >> ~/.bashrc
echo 'export PATH=${ANTSPATH}:${PATH}' >> ~/.bashrc
source ~/.bashrc

# Verify
antsRegistration --version
antsRegistrationSyN.sh --help | head -5
5
AFNI
Comprehensive fMRI analysis from NIMH. Includes 3dDeconvolve, afni_proc.py and more.
bash
# Official 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

# Or via apt (older version)
sudo add-apt-repository ppa:brains/afni
sudo apt update && sudo apt install -y afni

echo 'export PATH=$HOME/abin:$PATH' >> ~/.bashrc
echo 'source /etc/afni/afni_login' >> ~/.bashrc 2>/dev/null || true
source ~/.bashrc
afni --version
6
MRtrix3
DWI analysis, tractography and structural connectomics.
bash
# Option A — apt (Ubuntu 22.04+)
sudo apt install -y mrtrix3

# Option B — pip
pip install mrtrix3

# Option C — build from source (latest)
sudo apt install -y libeigen3-dev zlib1g-dev libfftw3-dev libpng-dev
git clone https://github.com/MRtrix3/mrtrix3.git
cd mrtrix3 && ./configure && ./build
echo 'export PATH=/path/to/mrtrix3/bin:$PATH' >> ~/.bashrc

mrconvert --version
7
dcm2niix & HeuDiConv
DICOM conversion and BIDS organisation tools.
bash
sudo apt install -y dcm2niix

# HeuDiConv (BIDS converter)
pip install heudiconv

# BIDS validator (requires Node.js)
sudo apt install -y nodejs npm
npm install -g bids-validator

dcm2niix --version
heudiconv --version
8
Python Neuroimaging Stack
Full scientific Python environment for neuroimaging.
bash
python3 -m venv ~/neuro-env
source ~/neuro-env/bin/activate

pip install --upgrade pip setuptools wheel
pip install \
    nibabel nilearn nipype dipy \
    pandas numpy scipy matplotlib seaborn \
    scikit-learn scikit-image \
    jupyter jupyterlab ipywidgets \
    fmriprep mriqc \
    pydeface templateflow

echo 'source ~/neuro-env/bin/activate' >> ~/.bashrc
python3 -c "import nibabel; print('nibabel', nibabel.__version__)"
python3 -c "import nilearn; print('nilearn', nilearn.__version__)"
9
SLURM & HPC Tools (Cluster environments)
For running pipelines on university clusters or local HPC nodes.
bash
# GNU Parallel (parallelise subjects locally)
sudo apt install -y parallel

# Check SLURM is available on your HPC
sinfo --version
sbatch --version

# Singularity (for containerised pipelines)
sudo apt install -y singularity-container

# Or Apptainer (newer name)
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update && sudo apt install -y apptainer
MRISpin SpinLab Documentation
v2.5 · mrispin.com/spinlab · © 2026 MRISpin
What is SpinLab?

MRISpin SpinLab is a browser-based scripting and pipeline tool for neuroimaging researchers. It generates real, complete, runnable bash and Python scripts — not templates with placeholders — for the full neuroimaging analysis workflow.

SpinLab is not a processing engine. It does not run MRI analysis itself. It generates the scripts that you run on your own computer, server, or HPC cluster. Think of it as a smart code generator and reference tool.

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
Pipeline Builder — 18 real steps, live script, configurable parameters
Study Setup Wizard — answer 4 questions, get a pre-configured pipeline
Heuristic Builder — generate heuristic.py + dcm2niix + HeuDiConv scripts
Protocol Library — 9 full published protocols with DOI references
QC Tracker — per-subject metrics with automatic pass/fail, CSV export
Command Hub — 37 fully documented commands with flags and examples
Install Guides — step-by-step FSL/FreeSurfer/ANTs for Windows & Linux
Tools covered
FSL 6.0+ FreeSurfer 7+ ANTs 2.4+ AFNI MRtrix3 nibabel nilearn nipype DIPY dcm2niix HeuDiConv fMRIPrep MRIQC SLURM GNU Parallel Singularity
Quick Start
Fastest path — single snippet
1
Open Script Editor → click any snippet in the left sidebar (e.g. BET Brain Extraction)
2
Edit the paths at the top of the script (SUBJ, BIDS_DIR, OUT_DIR)
3
Click Download .sh → run it on your machine: bash spinlab_pipeline.sh
Recommended path — full pipeline
1
Open Study Setup Wizard → select your modality (e.g. Task fMRI), scanner (3T Siemens), analysis options (TR, FWHM, FD threshold)
2
Click Open Pipeline Builder — all steps are pre-loaded with your parameters
3
Click any step to expand and fine-tune individual parameters. Watch the live script update on the right.
4
Change the execution mode to SLURM array if running on a cluster, or For loop for local multi-subject
5
Click Download .sh → upload to your server and run
DICOM path — raw scanner data to BIDS
1
Open Heuristic Builder → enter your DICOM series descriptions exactly as they appear in the scanner protocol
2
Assign each series its BIDS datatype, suffix, task and run labels
3
Click Generate All Files → download heuristic.py, dcm2niix.sh, and heudiconv.sh
4
Place heuristic.py in your BIDS code/ folder, run heudiconv.sh
5
BIDS Tree tab shows the exact folder structure you will get before running
Script Editor
Overview

The Script Editor is a full-page code editor with syntax-appropriate highlighting, line numbers, and a permanent quick-action bar. It is the destination for snippets loaded from the sidebar, scripts sent from the Pipeline Builder, and your own written code.

Snippet library

The left sidebar contains 30+ snippets grouped by tool. Search works across snippet titles and keyword tags — typing "warp" finds FNIRT and ANTs. Filter pills (FSL, FS, ANTs…) restrict the list to one tool family. Clicking a snippet asks confirmation only if you have written something that differs from the default boilerplate.

Quick action bar
Subject Loop
Wraps your selected lines in a complete for SUBJ in... loop that auto-discovers all sub-* folders. If nothing is selected, appends a loop template.
SLURM Wrap
Prepends a complete #SBATCH header. Detects if one already exists and skips to avoid duplicating.
Error Handling
Adds set -euo pipefail and a trap that reports the exact line number on failure.
Logging
Redirects all stdout/stderr to a timestamped log file via tee.
Parallelise
Appends a GNU Parallel block that runs this script for all subjects with 4 parallel jobs.
Keyboard shortcuts
Tab
Insert 4 spaces. On a multi-line selection, indents all lines.
Shift+Tab
De-indent selection.
Ctrl+H / Cmd+H
Open Find & Replace modal.
Ctrl+/ / Cmd+/
Toggle line comment (# for bash/python, // otherwise).
Esc
Close Find & Replace modal.
Find & Replace

Click the Find button or press Ctrl+H. Type your search term — the match count updates live. Use Replace Next to step through occurrences one at a time, or Replace All for a global substitution. Useful for changing paths like /data/bids/scratch/project across 40 lines.

Pipeline Builder
Overview

The Pipeline Builder generates complete, runnable neuroimaging pipeline scripts step by step. Every step produces real code — not placeholders. The generated script appears live on the right and updates instantly as you change parameters.

Adding and configuring steps

Steps can be added from the dropdown at the bottom, or loaded via a preset. Click any step card to expand it and edit its parameters. Each parameter has a sensible default but can be overridden — BET fractional threshold, registration DOF, tractogram size, etc. The generated script always reflects the current parameter values.

Variable chaining

Steps pass outputs to subsequent inputs automatically via shell variables:

BET →
sets $T1_BRAIN and $T1_MASK
FLIRT →
reads $T1_BRAIN, sets $AFF_MAT and $T1_MNI_LIN
FNIRT →
reads $AFF_MAT, sets $WARPFIELD
Eddy →
sets $DWI_EDDY
MRtrix preproc →
sets $DWI_PREPROC and $DWI_MASK
recon-all →
sets $FS_SUBJ_DIR
Execution modes
Single subject
Plain script. Run as bash pipeline.sh. Good for testing one subject.
For loop
Auto-discovers all sub-* folders and loops. Run as bash pipeline.sh.
GNU Parallel
Runs multiple subjects simultaneously. Best for multi-core workstations.
SLURM array
Adds full #SBATCH directives. Submit with sbatch pipeline.sh.
Study Setup Wizard
Purpose

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

Use the Wizard when starting a new study. Use the Pipeline Builder directly when you want fine-grained control over individual steps.
The 4 steps
1
Study type — Structural, Task fMRI, Resting-State, DWI, VBM, Cortical Thickness, DICOM→BIDS, or DTI only. Click to select and auto-advance.
2
Scanner settings — field strength (1.5/3/7T), manufacturer, TR, number of subjects, BIDS and derivatives paths, threads.
3
Analysis options — changes per study type. fMRI shows TR, smoothing, FD threshold, cluster z, permutations. DWI shows PE direction, track count, atlas. Structural shows BET threshold, registration tool, FreeSurfer yes/no.
4
Execution mode — Single, For loop, GNU Parallel, or SLURM (reveals partition/mem/time/email fields).
Smart adjustments

The wizard applies intelligent defaults based on your choices. Selecting 7T automatically lowers the BET threshold (7T images have different intensity profiles). Choosing "FLIRT only" removes the FNIRT step. Selecting "ANTs" adds the ANTs SyN step instead of FNIRT. All paths are substituted with your entered BIDS/derivatives directories.

DICOM → BIDS Heuristic Builder
What it does

The Heuristic Builder generates the three files needed for a complete DICOM-to-BIDS conversion workflow: a HeuDiConv heuristic.py, a dcm2niix.sh batch conversion script, and a heudiconv.sh run script. It also shows you a BIDS Tree preview of what your output structure will look like before you run anything.

How to use it
1
Enter your DICOM source path pattern using {subject} as placeholder (e.g. /data/raw/{subject}/*/*/*.dcm)
2
Enter your subject IDs and session labels (leave sessions blank if no sessions)
3
Add a row for each scan series. Enter the exact series description as it appears in your DICOM header (e.g. T1_MPRAGE_1mm). Assign it a BIDS datatype (anat/func/dwi/fmap), suffix (T1w/bold/dwi), and task/run if applicable.
4
Or load a preset: Structural only, Structural+fMRI, Structural+DWI, or Full multimodal
5
Click Generate All Files → switch between the 4 output tabs to preview, then download each file
The series description must match exactly what HeuDiConv will see in the DICOM header. Find it with: dcm2niix -h | head or check the DICOM tag (0008,103E).
Protocol Library
Overview

The Protocol Library contains 9 full, publication-ready neuroimaging protocols — complete scripts following established methods from the literature. Each protocol includes a full script, a Details tab with inputs/outputs/requirements and DOI references, a Pipeline Steps tab showing the data flow, and a Deploy to Pipeline Builder button.

Available protocols
HCP-Style Structural
BET → FLIRT → FNIRT → ANTs Cortical Thickness → recon-all → parcstats (Glasser et al. 2013)
FSL VBM
BET → FAST tissue segmentation → FNIRT → modulated GM → randomise TFCE (Good et al. 2001)
fMRIPrep + FEAT
fMRIPrep preprocessing → FSL FEAT first-level GLM (Esteban et al. 2019)
Resting-State fMRI
fMRIPrep → bandpass filter → Schaefer parcellation → correlation matrix (nilearn)
MRtrix3 Full DWI
Denoise → Gibbs → topup/eddy → 5TT → SS3T-CSD → iFOD2 → SIFT2 → connectome (Tournier et al. 2019)
DTI Fitting (DIPY)
FSL eddy correction → DIPY WLS tensor fit → FA/MD/RD/AD maps
Seed-Based FC
fMRIPrep output → PCC seed → whole-brain correlation map → z-transform (nilearn)
SLURM Job Array
Production HPC template: auto-discovers subjects, logs per subject, email on failure
MRIQC Group QC
Participant-level IQMs → group report → Python outlier detection (Esteban et al. 2017)
Subject QC Tracker
Overview

The QC Tracker is a spreadsheet-style quality control table. Each row is a subject, each column is a QC metric. Enter the actual measured values and the cell colours green (pass), amber (warning), or red (fail) automatically based on published thresholds.

Three modalities with real thresholds
Structural (7 metrics)
SNR ≥15 · CNR ≥1.5 · EFC ≤0.4 · FBER ≥500 · WM2MAX 0.6–0.85 · BET pass/fail · Registration pass/fail
fMRI (8 metrics)
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 (8 metrics)
SNR b0 ≥15 · FA WM 0.35–0.60 · MD WM 0.6–0.9 · Outlier vols ≤5% · Motion max ≤2.0mm · Motion mean ≤0.8mm · Mask pass/fail · Tractography pass/fail
Methods text export

The Methods Text button generates a complete paragraph for your paper's Methods section describing your QC procedure, thresholds applied, and excluded subjects with reasons — ready to paste directly into your manuscript.

Command Hub
Overview

The Command Hub is a searchable interactive command reference for 37 neuroimaging commands across 9 tool families. It is not a manual — it is a practical quick reference with real working examples and flag explanations.

How to use it

Type anything in the search box — command names, flag names, or descriptions. Searching "brain" finds BET. Searching "permutation" finds randomise. Use the filter pills to restrict to a single tool. Click any command card to expand it and see: a full description, a key flags table, a real working example with a Copy button, and a link to the official documentation.

Commands covered

FSL (10): bet, flirt, fnirt, feat, randomise, eddy_openmp, fslmaths, fslstats, applywarp, melodic · FreeSurfer (4): recon-all, asegstats2table, aparcstats2table, mri_convert · ANTs (3): antsRegistrationSyN, antsApplyTransforms, N4BiasFieldCorrection · AFNI (2): 3dDeconvolve, afni_proc.py · MRtrix3 (5): mrconvert, dwidenoise, tckgen, tcksift2, tck2connectome · Python (4): nibabel, nilearn maskers, ConnectivityMeasure, DIPY TensorModel · DICOM (3): dcm2niix, heudiconv, bids-validator · BIDS Apps (2): fmriprep, mriqc · HPC (3): sbatch, GNU parallel, Singularity

Workflow: Structural MRI
Complete structural preprocessing workflow
1
Convert DICOM → BIDS — use Heuristic Builder to generate scripts. Run dcm2niix + HeuDiConv.
2
QC raw data — run MRIQC at participant level. Enter IQMs into QC Tracker, flag poor-quality scans.
3
Brain extraction — BET with f=0.35–0.4, -B for robust mode. Check mask visually in FSLeyes.
4
Linear registration — FLIRT 12-DOF to MNI152 2mm. Save .mat matrix for re-use.
5
Non-linear registration — FNIRT with T1_2_MNI152_2mm.cnf config. Or ANTs SyN for better accuracy.
6
Surface reconstruction — recon-all (6–16 hrs). Use -parallel -openmp 8 to speed up.
7
Export stats — asegstats2table for subcortical volumes, aparcstats2table for cortical thickness.
Use the Study Setup Wizard → Structural MRI to pre-configure all these steps automatically.
Workflow: Task fMRI
Complete task fMRI analysis workflow
1
BIDS conversion — include T1w, BOLD, and fieldmap series in your Heuristic Builder setup.
2
MRIQC — check tSNR, FD, DVARS before committing to preprocessing. Exclude outliers early.
3
fMRIPrep — handles fieldmap correction, motion correction, T1w co-registration, MNI normalisation, confound extraction. Use output-spaces MNI152NLin2009cAsym:res-2.
4
First-level GLM — FEAT with your events.tsv file. Set TR, HRF, HPF cutoff 128s, smoothing 6mm FWHM.
5
Group analysis — randomise with TFCE (5000 permutations). Threshold at p<0.05 FWE.
Load the fMRIPrep + FSL FEAT GLM protocol from the Protocol Library for a complete ready-to-run script.
Workflow: Diffusion MRI
Complete DWI tractography workflow
1
Acquire — collect DWI with reverse PE b0 (for topup). Save bvals, bvecs in BIDS.
2
Denoise — dwidenoise (Marchenko-Pastur PCA). Must be FIRST step on raw data.
3
Gibbs unringing — mrdegibbs to remove ringing artefacts.
4
Distortion correction — dwifslpreproc (wraps topup + eddy). Needs acqparams.txt with PE direction and TotalReadoutTime.
5
Bias correction — dwibiascorrect ants (N4 algorithm).
6
5TT segmentation — 5ttgen fsl on T1w for anatomically constrained tractography.
7
FOD estimation — dwi2response dhollander + ss3t_csd_beta1 for multi-shell or single-shell CSD.
8
Tractography — tckgen iFOD2, 10M streamlines, seeded from GMWMI.
9
SIFT2 — tcksift2 to weight streamlines. Use weights in tck2connectome.
10
Connectome — tck2connectome with parcellation (Schaefer/AAL/Desikan). Normalise by inverse node volume.
Workflow: DICOM → BIDS
Full DICOM to BIDS conversion
1
Open Heuristic Builder → load the preset matching your study (or add series manually)
2
Enter series descriptions exactly as they appear in your DICOM header (check with pydicom or dcm2niix -h)
3
Download heuristic.py → place at /data/bids/code/heuristic.py
4
Download and run dcm2niix.sh (optional — HeuDiConv calls dcm2niix internally)
5
Download and run heudiconv.sh — converts for all subjects and runs bids-validator
6
Verify the BIDS structure matches the Tree preview in SpinLab
Run HeuDiConv in --dry-run mode first for one subject to check the heuristic is mapping correctly before processing all subjects.
User Accounts
Do I need an account?

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

Saving scripts

Sign in → write or edit a script in the Script Editor → click Save → enter a name. Your saved scripts appear in the Account panel. Click Load to restore one to the editor at any time.

Registration

Registration may be enabled or disabled by the site administrator. If disabled, you will see a message on the Register tab. Contact your site admin to create an account.

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 FSL, FreeSurfer, etc. are installed.

Are the generated scripts safe to run?

Yes — all scripts use set -euo pipefail with error trapping by default. They do not delete data, only create new output directories. Always review the script before running on important data.

Can I use SpinLab without internet?

The tool requires an internet connection to load (fonts, icons from CDN), but once loaded, all panel generation and script building works offline. Saving scripts requires the database connection.

The sign in is not working

The database may not be configured. Check if a yellow banner appears at the top of the page saying "SpinLab needs to be installed." If so, run the installer at /spinlab/install/. If the tool is already installed, check that api/config.php exists on the server.

How do I change the default subject ID or paths?

Edit the variables at the top of any generated script — SUBJ, BIDS_DIR, OUT_DIR, NTHREADS. In the Pipeline Builder, set these in the Global Config Bar before generating. In the Wizard, enter paths in Step 2.

Which version of FSL/FreeSurfer should I use?

SpinLab generates scripts tested against FSL 6.0.7, FreeSurfer 7.4.1, ANTs 2.5.3, MRtrix3 3.0.4. Earlier versions will generally work but specific flags may differ. The Install Guides specify exact recommended versions.

Tips & Shortcuts
Editor shortcuts
Tab
Insert 4 spaces (never jumps focus)
Shift+Tab
De-indent selected lines
Ctrl+H
Find & Replace
Ctrl+/
Toggle line comment
Esc
Close any modal
Workflow tips
Chain panels
Wizard → Pipeline Builder → Script Editor is the fastest complete workflow. Each panel can send output to the next.
Deploy protocols
Protocol Library → Deploy to Pipeline Builder pre-loads all steps. Then use the Pipeline Builder to adjust individual parameters.
Test single subject first
Always use "Single subject" execution mode to test. Switch to SLURM/For loop only after confirming the script works for one subject.
Find & Replace for paths
Use Ctrl+H to change /data/bids/scratch/project/bids across the whole script in one step.
QC before analysis
Always populate the QC Tracker before running group analysis. Export the CSV as a supplementary table.
BIDS Tree preview
Always check the Heuristic Builder BIDS Tree tab before running HeuDiConv. Confirm the naming matches what you expect.

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.
support@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.
bugs@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.