Welcome to shimming-toolbox!

Releases GitHub Actions CI Coverage Status Documentation Status Twitter Follow License

shimming-toolbox is an open-source Python software package enabling a variety of MRI shimming (magnetic field homogenization) techniques such as static and real-time shimming for use with standard manufacturer-supplied gradient/shim coils or with custom "multi-coil" arrays. The toolbox provides useful set of command line tools as well as a fsleyes plugin dedicated to make shimming more accessible and more reproducible.



  • Built-in DICOM to NIfTI conversion

  • Masking tools for the brain and spinal cord

  • Create and use a variety of B0 shimming coil profiles: Spherical harmonics, shim-only arrays, "AC-DC" multi-coil, etc.

  • Supports different B0 shimming scenarios: dynamic (slicewise), realtime (shim modulation with respiration), gradient z-shimming, two-region shimming (e.g., fat and brain)

  • RF shimming for parallel transmit systems (a.k.a. B1+ shimming)

  • Powered by freely available software tools: dcm2niix, dcm2bids, FSL-prelude, SCT, FSLeyes.


See the Installing shimming-toolbox page.


1. Command Line

The primary way to use shimming-toolbox is through the command line. For example:

$ st_prepare_fieldmap --help

Usage: st_prepare_fieldmap [OPTIONS] PHASE...

Creates fieldmap (in Hz) from phase images. This function accommodates multiple
echoes (2 or more) and phase difference. This function also accommodates 4D phase
inputs, where the 4th dimension represents the time, in case multiple fieldmaps are
acquired across time for the purpose of real-time shimming experiments.

phase: Input path of phase nifti file(s), in ascending order: echo1,
echo2, etc.

-mag PATH             Input path of mag nifti file
-unwrapper [prelude]  Algorithm for unwrapping
-output PATH          Output filename for the fieldmap, supported types : '.nii', '.nii.gz'
-mask PATH            Input path for a mask. Used for PRELUDE
-threshold FLOAT      Threshold for masking. Used for: PRELUDE
-h, --help            Show this message and exit.


To facilitate reproducibility, commands can be chained together in a pipeline using multiple Shimming Toolbox commands. An example script is provided.

The different commands of Shimming Toolbox can be found in the CLI Reference page.

2. Graphical User Interface (FSLeyes)

shimming-toolbox also features a graphical user interface (GUI) via a FSLeyes plugin. See the plugin's installation page for more information.