compute_girf_interpolators#

mrinufft.extras.compute_girf_interpolators(fields: NDArray, acq: Acquisition, L: int = -1, order: int = -1, tol: float = 0.001, mask: NDArray | None = None, interpolators: tuple[NDArray, NDArray] | None = None, n_fit: int = 20000, skip: int = 0) → tuple[NDArray, NDArray][source]#

Factorize the higher-order terms of a GIRF prediction.

Computes B and C such that, for the samples \(m\) and the voxels \(n\) of the image,

\[\sum_\ell B_{m\ell} C_{\ell n} \approx e^{-\imath \sum_{j \geq 4} \phi_j(t_m) P_j(\boldsymbol{u}_n)}, \quad \text{with} \quad \phi_j(t) = 2\pi\gamma \int_0^t b_j(\tau)\, d\tau\]

the phases accrued by the fields \(b_j\) since the start of the waveforms, to be used as interpolators of MRIFourierCorrected. The exponential is expanded in Taylor series, whose terms are products of spherical harmonics in closed form, then compressed to rank L. See Factorization of the higher orders.

Parameters:
  • fields (NDArray) – Deviations of the field terms from mrinufft.trajectories.apply_girf(), in T/m^l, at the gradient raster: shape (n_shots, n_samples - 1, n_terms), between the n_samples samples of the trajectory.

  • acq (Acquisition) – Acquisition configuration, providing the image grid, the gyromagnetic ratio and the raster time.

  • L (int, optional) – Rank of the factorization. If -1 (default), the smallest reaching tol.

  • order (int, optional) – Order of the Taylor series, whose error is at most max|phi|^(order + 1) / (order + 1)! for a phase phi. If -1 (default), the smallest for which this bound reaches tol.

  • tol (float, optional) – Relative error, in Frobenius norm, targeted when L = -1. The default is 1e-3.

  • mask (NDArray, optional) – Voxels on which the factorization is fitted, with the shape of the image. By default, all of them.

  • interpolators (tuple[NDArray, NDArray], optional) – Factorization (B, C) to multiply with, e.g. that of the static off-resonance from get_orc_factorization(). B has a shape (n_samples - skip, L0) or (n_shots * (n_samples - skip), L0), and C a shape (L0, *acq.img_size).

  • n_fit (int, optional) – Number of samples and of voxels drawn to fit the compression. The default is 20000.

  • skip (int, optional) – Number of samples of the trajectory before the ADC, e.g. during the pre-phasers (start_skip_samples of mrinufft.io.read_gradients()). The phases are accrued from the start of fields, and B covers the samples from skip on. The default is 0.

Returns:

  • B (NDArray) – Temporal interpolators, with shape (n_shots * (n_samples - skip), L).

  • C (NDArray) – Spatial interpolators, with shape (L, *acq.img_size).

Raises:

ValueError – If skip is out of range, or if interpolators does not match the samples.

Return type:

tuple[NDArray, NDArray]

Example using compute_girf_interpolators:#

GIRF-based correction of the encoding

GIRF-based correction of the encoding