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. Graphical User Interface (FSLeyes)

shimming-toolbox features a graphical user interface (GUI) via a FSLeyes plugin.


2. Command Line

shimming-toolbox can be used on the 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 field maps are acquired across time
for the purpose of real-time shimming experiments. For non Siemens phase
data, see --autoscale-phase option.

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

--mag PATH                  Input path of mag nifti file  [required]
--unwrapper [prelude]       Algorithm for unwrapping  [default: prelude]
-o, --output PATH           Output filename for the fieldmap, supported types : '.nii', '.nii.gz'
--mask PATH                 Input path for a mask. Mask must be the same
                            shape as the array of each PHASE input.
--threshold FLOAT           Threshold for masking if no mask is provided.
                            Allowed range: [0, 1] where all scaled values
                            lower than the threshold are set to 0.
--gaussian-filter BOOLEAN   Gaussian filter for B0 map
--sigma FLOAT               Standard deviation of gaussian filter. Used for: gaussian_filter
-v, --verbose [info|debug]  Be more verbose
-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 Command Line Tools page.