nlinv

Contents

nlinv#

pygrog.utils.nlinv(y, cal_width=24, ndim=None, mask=None, shape=None, coords=None, weights=None, oversamp=1.25, eps=0.001, sobolev_width=200.0, sobolev_deg=32, max_iter=10, cg_iter=10, cg_tol=0.01, alpha0=1.0, q=0.6666666666666666, toeplitz=None, ret_cal=True, ret_image=False, train_reduce='none')#

Estimate coil sensitivity maps using NLINV.

Parameters:
  • y (NDArray[complex]) – Measured k-space data of shape (n_coils, ...).

  • cal_width (int, optional) – Calibration region size. The default is 24.

  • ndim (int, optional) – Acquisition dimensionality (2 or 3). Required for Cartesian.

  • mask (NDArray[bool], optional) – Cartesian sampling pattern.

  • shape (list[int] | tuple[int], optional) – Image dimensions. Required for non-Cartesian.

  • coords (NDArray[float], optional) – Fourier domain coordinates of shape (..., ndim).

  • weights (NDArray[float], optional) – Density compensation weights.

  • oversamp (float, optional) – NUFFT oversampling factor. The default is 1.25.

  • eps (float, optional) – NUFFT precision. The default is 1e-3.

  • sobolev_width (float, optional) – Sobolev kernel width. The default is 220.

  • sobolev_deg (int, optional) – Sobolev norm order. The default is 16.

  • max_iter (int, optional) – Gauss-Newton iterations. The default is 10.

  • cg_iter (int, optional) – Conjugate gradient iterations per Gauss-Newton step. The default is 10.

  • cg_tol (float, optional) – CG relative tolerance. The default is 1e-2.

  • alpha0 (float, optional) – Initial regularization parameter. The default is 1.0.

  • q (float, optional) – Regularization decay factor per iteration. The default is 1/3.

  • toeplitz (bool | None, optional) – Use Toeplitz acceleration for the CG normal equation in the non-Cartesian case. Precomputes the NUFFT PSF kernel and replaces each nufft_adjoint(nufft(·)) pair with an FFT-based multiplication, significantly reducing per-iteration cost. None (default) auto-selects: True on CPU (where NUFFT is expensive), False on GPU.

  • ret_cal (bool, optional) – Return synthesized calibration data. The default is True.

  • ret_image (bool, optional) – Return reconstructed image. The default is False.

Returns:

  • smaps (NDArray[complex]) – Coil sensitivity maps of shape (n_coils, *shape).

  • grappa_train (NDArray[complex], optional) – Synthesized calibration k-space of shape (n_coils, *cal_shape). Only if ret_cal=True.

  • image (NDArray[complex], optional) – Reconstructed image. Only if ret_image=True.

Note

This function uses torch internally, and will convert all its array argument to torch tensors, but will respect the device they are allocated on. The outputs will be converted back to the original array module and device.