Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

FSL course - BET

Run this notebook

This interactive demonstration is based on the official FSL course “Introductory FSL Practicals/ Introduction - BET”.

Brain extraction is a fundamental preprocessing step in neuroimaging analysis, particularly critical for structural image segmentation where precision matters most. While BET is straightforward to use, achieving optimal results often requires understanding how to fine-tune parameters for challenging datasets. This interactive version covers the core BET fundamentals, including parameter adjustment techniques for difficult images, and troubleshooting approaches for problematic cases. The hands-on format allows you to experiment with different settings and immediately see their effects on brain extraction quality.

Author: Monika Doerig

Date: 13 June 2025

License:

MIT License

Note: If this notebook uses neuroimaging tools from Neurocontainers, those tools retain their original licenses. Please see Neurodesk citation guidelines for details.

Citation/ Resources:

Tools included in this workflow

FSL - Brain Extraction Tool (BET)

  • M. Jenkinson, C.F. Beckmann, T.E. Behrens, M.W. Woolrich, S.M. Smith. FSL. NeuroImage, 62:782-90, 2012

  • Smith S. M. (2002). Fast robust automated brain extraction. Human brain mapping, 17(3), 143–155. Smith (2002)

Dataset

Educational resources

Load FSL

['fsl/6.0.7.16']

Download course material

Fetching long content....

BET basics

BET performs brain extraction by removing non-brain tissue from structural MRI images:

bet <input> <output> [options]

  • Input: Structural image (e.g., structural.nii.gz)

  • Output: Brain-extracted image

  • Options: Additional outputs like binary mask or skull surface (optional)

For detailed instructions, see the complete FSL tutorial and the help page.


Usage:    bet <input> <output> [options]

Main bet2 options:
  -o          generate brain surface outline overlaid onto original image
  -m          generate binary brain mask
  -s          generate approximate skull image
  -n          don't generate segmented brain image output
  -f <f>      fractional intensity threshold (0->1); default=0.5; smaller values give larger brain outline estimates
  -g <g>      vertical gradient in fractional intensity threshold (-1->1); default=0; positive values give larger brain outline at bottom, smaller at top
  -r <r>      head radius (mm not voxels); initial surface sphere is set to half of this
  -c <x y z>  centre-of-gravity (voxels not mm) of initial mesh surface.
  -t          apply thresholding to segmented brain image and mask
  -e          generates brain surface as mesh in .vtk format

Variations on default bet2 functionality (mutually exclusive options):
  (default)   just run bet2
  -R          robust brain centre estimation (iterates BET several times)
  -S          eye & optic nerve cleanup (can be useful in SIENA - disables -o option)
  -B          bias field & neck cleanup (can be useful in SIENA)
  -Z          improve BET if FOV is very small in Z (by temporarily padding end slices)
  -F          apply to 4D FMRI data (uses -f 0.3 and dilates brain mask slightly)
  -A          run bet2 and then betsurf to get additional skull and scalp surfaces (includes registrations)
  -A2 <T2>    as with -A, when also feeding in non-brain-extracted T2 (includes registrations)

Miscellaneous options:
  -v          verbose (switch on diagnostic messages)
  -h          display this help, then exits
  -d          debug (don't delete temporary intermediate images)

total 22436
-rw-rw-r-- 1 jovyan jovyan 3835998 May 27 23:57 structural_brain_f02.nii.gz
-rw-rw-r-- 1 jovyan jovyan   75293 May 27 23:57 structural_brain_f02_mask.nii.gz
-rw-rw-r-- 1 jovyan jovyan  125927 May 27 23:57 structural_brain_f02_skull.nii.gz
-rw-rw-r-- 1 jovyan jovyan 2508495 May 27 23:57 structural_brain_f08.nii.gz
-rw-rw-r-- 1 jovyan jovyan   58417 May 27 23:57 structural_brain_f08_mask.nii.gz
-rw-rw-r-- 1 jovyan jovyan   75207 May 27 23:57 structural_brain_f08_skull.nii.gz
-rw-rw-r-- 1 jovyan jovyan 1385878 May 27 23:57 sub3m0_brain.nii.gz
-rw-rw-r-- 1 jovyan jovyan 1476214 May 27 23:57 sub3m0_f03g02.nii.gz
-rw-rw-r-- 1 jovyan jovyan 1824515 May 27 23:57 bighead_brain.nii.gz
-rw-rw-r-- 1 jovyan jovyan 6193578 May 27 23:58 bighead_crop.nii.gz
-rw-rw-r-- 1 jovyan jovyan 1680987 May 27 23:58 bighead_crop_brain.nii.gz
-rw-rw-r-- 1 jovyan jovyan 3516911 May 27 23:58 structural_brain.nii.gz
-rw-rw-r-- 1 jovyan jovyan   73650 May 27 23:58 structural_brain_mask.nii.gz
-rw-rw-r-- 1 jovyan jovyan  114340 May 27 23:58 structural_brain_skull.nii.gz

Visualization with ipyniivue

Loading...

Varying the fractional intensity threshold parameter (-f)

The fractional intensity threshold is BET’s key parameter for distinguishing brain tissue from non-brain tissue. This interactive demonstration shows how different -f values affect brain extraction results:

  • Lower values (e.g., -f 0.2): More inclusive extraction - captures more tissue but may include non-brain areas

  • Higher values (e.g., -f 0.8): More conservative extraction - tighter brain boundary but may exclude brain tissue

  • Default (-f 0.5): Balanced approach suitable for most cases

The following visualization shows three different threshold results overlaid on the original image, demonstrating how this single parameter dramatically changes the extraction outcome.

Loading...

Troubleshooting Brain Extraction

Cerebellum Underestimation: Using the gradient threshold option (-g)

  • Problem: Lower brain regions (cerebellum) get cut off

Loading...
  • Solution: Use gradient threshold (-g) to vary the intensity threshold linearly by slice (getting smaller at the bottom and bigger at the top, or vice versa)

  • Example: Try -f 0.3 -g 0.2 for balanced results

Loading...

Dealing with large FOV images

  • Problem: Large amount of neck/extra tissue confuses brain detection (initial brain surface is initialised too low):

Loading...
  • Solutions:

    • Crop the image first to remove the neck: robustfov -i input -r output_crop (recommended)

    • Leave large FOV, but set brain centre-of-gravity: -c <x y z> option (manual coordinate specification)

    • Robust brain centre estimation: -R option (iterates BET several times)

Different images may need different approaches - having multiple strategies available is essential for handling problematic cases.

Recommended Practice: Combine cropping with -R option for most robust results across different image types:

Final FOV is: 
0.000000 160.000000 0.000000 224.000000 61.000000 170.000000 

Loading...
Loading...

Dependencies in Jupyter/Python

  • Using the package watermark to document system environment and software versions used in this notebook, alongside the Neurodesktop version extracted from the JUPYTER_IMAGE or NEURODESKTOP_VERSION environment variables.

Last updated: 2026-05-27T23:59:28.141511+00:00

Python implementation: CPython
Python version       : 3.13.13
IPython version      : 9.12.0

Compiler    : GCC 14.3.0
OS          : Linux
Release     : 6.8.0-111-generic
Machine     : x86_64
Processor   : x86_64
CPU cores   : 16
Architecture: 64bit

ipyniivue: 2.4.4

Neurodesktop version: 2026-04-28
References
  1. Smith, S. M. (2002). Fast robust automated brain extraction. Human Brain Mapping, 17(3), 143–155. 10.1002/hbm.10062