In the help for epi_b0_correct.py there are a couple of areas that I think are confusing. First, in the section listing options we find the following:
-in_epi_json FJSON : (opt) Several parameters about the EPI dset must be known for processing; these MIGHT be encoded in a JSON file accompanying the frequency dset.
I believe this should say 'JSON file accompanying the epi dset" rather than the freq dataset. The JSON associated with the frequency dataset may be of use, but will not contain the parameters needed for correcting the EPI image.
Second, later in the Siemens section, there is a (very useful) discussion of scaling output:
Therefore, we also want to divide by the EPI's echo time difference (which might be saved as 'EchoTimeDifference' in an EPI's JSON sidecar). For example, the standard value of this at 3T is about 2.46 ms (= 0.00246 s), but check what it is in your own data!
Here, I believe we have the opposite problem. The echo time difference should refer to the echo time difference between the two magnitude images that were collected as part of the fieldmap. That will be in the FREQ JSON sidecar (if you are lucky), or more likely can be calculated from A) looking at the sequence or B) comparing the EchoTime values of the first and second magnitude image. In any case, the provided difference (2.46 ms) is right for a typical fieldmap sequence.
Finally - a request, would it be possible to augment how masking and smoothing are performed? At the moment, the mask is created, used on the the frequency dataset and then the result is smoothed. This leads to the outside-of-brain zeros attenuating the magnitude of distortion at the edge of the brain, where it is often most pronounced. One possible fix would be to extend the pixel values at the edge of the mask to the edges in the phase encoding dimension. That is, if there was some anterior voxel at the edge of the brain mask, its phasediff values would be copied, in plane, along the anterior direction, with the same done along the posterior edge of the brain mask. Smoothing could then be applied as before.
This may be useful for location with large amounts of distortion - in which brain data has been pushed many voxels beyond the edge - the smoothed distortion correction map has limited effects on those voxels. Not required, just think it may be useful.