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  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]meduniwien.ac.at, and needs to be
Example GE and EPI data is available on . 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 
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]meduniwien.ac.at 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
Simon Robinson (2019). Field Mapping Toolbox (https://www.mathworks.com/matlabcentral/fileexchange/30853-field-mapping-toolbox), MATLAB Central File Exchange. Retrieved .
@John Cheng, have you found the PHUN code
try this one, professor stephan's email: firstname.lastname@example.org
stephan[döt]email@example.com?? 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)
medfil3 works as perfect extension to the MATLAB 1D and 2D versions.
Very fast implementation.
Good documentation (consistent with built-ins).
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.
@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.
Good for the field map finding and correction!
v1.4: added fm_caller.m which passes parameters to the main function, fm_calc_main.m. fm_caller.m contains example calls for test data (see Description).
Inspired by: Tools for NIfTI and ANALYZE image