File Exchange

image thumbnail

Field Mapping Toolbox

version (65.4 KB) by Simon Robinson
Methods for B0 Mapping with Multi-Channel RF Coils in MRI (Robinson and Jovicich, MRM, 2011)


Updated 08 Jul 2011

View Version History

View License

The main features of this B0 field mapping (FM) toolbox are described
in Robinson and Jovicich (MRM, 2011). In brief, they are
i) combination of phase information from multi-channel coils using the
Hermitian inner Product (HP) method, the Phase Match (PM) method or
the Separate Channel (SC) method.
ii) field map denoising either via the median replacement of outliers
or via the standard deviation over RF channels (SC method only).
iii) local thresholding of fieldmaps for the maximal achievable
geometric distortion correction if used to distortion-correct EPI.

The toolbox requires magnitude and phase multi-echo gradient echo
(MGE) MRI data, or a number of single-echo gradient echo (GE) MRI
scans acquired at separate echo times, in NIfTI format. FSL [3] should
be installed, as the this toolbox uses BET, for brain extraction and
PRELUDE for unwrapping. The fast unwrapping program PHUN (Stephan
Witoszynskyj et al., Medical Image Analysis, 2009) can be used as an
alternative to PRELUDE. This is freeware available on request from
stephan[döt]witoszynskyj[ät], and needs to be
installed separately.

Example GE and EPI data is available on [2]. Combined with the
examples in fm_caller.m, this should make it clear how to use the
toolbox for the most common cases.

User parameters which may change from analysis to analysis (input and
output directories, number of channels) are listed in
fm_caller.m. Other options, such as the method used for combining
phase images and thresholds for BET and PRELUDE, are listed in the
main function, fm_calc_main.m, under "%%%Start of User-defined
Parameters%%%". These may be modified in that section or moved to
fm_caller.m. If the same parameter is specified in fm_caller.m and
fm_calc_main.m, that in fm_caller.m takes precidence.

Users of Siemens MRI scanners might find it useful to convert their
DICOM data to NIfTI using dicom_sort_convert_main.m [4]
which reformats GE and MGE data into formats usable by this Field
Mapping Toolbox (4D, 5D and 6D NIfTI), as well as providing
acquisition parameter information in a file (text_header.txt) which
can be used by this toolbox, reducing the amount of information that
needs to be entered by the user. Alternatively, users may need to
prepare their data in a suitable format using MATLAB's "dicomread" or
the function "load_nii", then create a NIfTI structure similar to that
in case2 (one of the examples in fm_caller.m) with "make_nii" and save
this with "save_nii", all of which are part of the NIfTI toolbox for
MATLAB (Jimmy Shen, FEX ID 8797).

I've done my best to test this for NIfTI data with different
organisations of echoes, phase and magnitude and for sequence
parameters available through a text_header.txt or passed directly, but
inevitably some problems will crop up as this gets tested with a wider
variety of data from different scanners. Please get in touch at
simon[döt]robinson[ät] if you have problems and I'll
do my best to fix any bugs and add flexibility where that makes sense.

If you used this toolbox in your research, please cite the related
paper [1].




Cite As

Simon Robinson (2021). Field Mapping Toolbox (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

zoey yang

@John Cheng, have you found the PHUN code

zoey yang

try this one, professor stephan's email:

Nitish katoch

john Cheng

stephan[döt] can you give a correct E-mail address? I want to use the fast unwrapping program PHUN, thanks very much!


Thank you Simon, for the tool. It is very good.
However, with later versions of Matlab overwriting an existing variable to be a struct is no longer possible. In the beginning of set_nii_voxel_size function a line like this should be added: "old_hdr = struct;".
All the best,



Any way I can use this software for complex image data not in NIfTI format? My data is raw multi-channel GE data currently sitting around as a large matrix of data in matlab, and I can change the data matrix dimensions around however I want. I have the header information in a separate file. (data converted from GE p-files)



Frederick Bryan

medfil3 works as perfect extension to the MATLAB 1D and 2D versions.
Very fast implementation.
Good documentation (consistent with built-ins).

Very appreciative.


I work with a dicom files and I have my methode to create the field map, I want to use this map to correct my GE images from the phase shift between echos, for this I multiply my magnetude image like : M.*exp(i*gamma*te*B0)and after I take abs(M_corr) and I dont obtain any difference??
can you help me on this because I,m really a Beginner in this domain.

Simon Robinson

@Bong-Soo Han: The rating scale for MATLAB file exchange submissions goes from 1, the lowest, to 5, the highest. If you found shortcomings in this toolbox, please let me know what they were this submission can be improved for other users. If you found the toolbox to work well (as your comment suggests), you might reconsider your rating.

Bong-Soo Han

Good for the field map finding and correction!

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!