compute_mfi_coefficients#

mrinufft.extras.compute_mfi_coefficients(field_map: NDArray, readout_time: NDArray, mask: NDArray, L: int = 9, n_bins: int | tuple[int, int] = -1, lazy: bool = True)[source]#

Compute off-resonance correction coefficients using Mixed-Frequency-Interpolator.

Parameters:
  • field_map (NDArray) – The field map (off-resonance map) in rad/s, If complex-valued, the real part is interpreted as R2* mapping. If real-valued this is the field inhomogeneities in Hz. and will be multiplied by \(2j\pi\)

  • readout_time (NDArray) – The vector of time points (in seconds) at which to compute phase evolution.

  • mask (NDArray) – Binary mask indicating object region for field map/statistics. Only those voxels are used to build the histogram, so field-map values outside it are clamped to the range spanned by the object.

  • L (int, optional) – Number of virtual centers or basis functions retained (default is -1, automatically estimated from the time-bandwidth product of the readout). Too small an L leaves a large residual phase error, which appears as artefacts in the corrected image; a warning is logged when that happens.

  • n_bins (int or tuple[int, int], optional) – Number of bins used to quantize the field map before the factorization. Binning error does not decrease with L: each voxel is represented by its bin centre. The default, -1, sets the bin width from the readout so that binning changes \(e^{\Delta t}\) by at most 5% (0.05 rad of phase); a warning is logged if memory forces coarser bins. An integer is the number of bins along B0, and the R2* bins have the same width; a tuple (n_r2star, n_b0) sets both. Only bins holding a voxel are kept, so the cost is bounded by the number of voxels.

  • lazy (bool, default False) – If True, use a lazy evaluation scheme for the space interpolator C, saving memory.

Returns:

  • B (NDArray) – [nt, L] phase basis matrix in the time domain; nt = len(readout_time).

  • C (NDArray) – [L, *field_map.shape] spatial interpolators.

  • E (NDArray) – [nt, n_bins] exponential off-resonance phase matrix at the occupied bins.

References

Man, L.-C., Pauly, J.M. and Macovski, A. (1997), Multifrequency interpolation for fast off-resonance correction. Magn. Reson. Med., 37: 785-792. https://doi.org/10.1002/mrm.1910370523

Note

This function uses numpy for all CPU arrays, and cupy for all on-gpu array. It will convert all its array argument to the respective array library. The outputs will be converted back to the original array module and device.