tools.igrog

Contents

tools.igrog#

bartorch.tools.igrog()#

Non-Cartesian samples moved to their nearest grid point by closed-form GRAPPA (iGROG).

Each sample on the grid’s extent is moved to its nearest Cartesian point by a kernel over sources samples of its readout and every coil. iGROG (Abraham et al. [1]) learns that kernel from the source offsets; here it is the Wiener (linear minimum mean square error) interpolator under the coil cross-correlation of the calibration k-space,

\[W = R_{ts} (R_{ss} + \lambda \bar r I)^{-1}, \qquad Q_{cc'}(\delta) = \sum_r m_c(r) \overline{m_{c'}(r)} e^{-2\pi i \delta \cdot r / n},\]

with \(R_{ss}\) and \(R_{ts}\) the correlation \(Q\) between the sources and from them to the target, \(m_c\) the calibration’s coil images and \(\bar r\) the mean signal power. \(Q\) is tabulated once on a fine grid of displacements and interpolated, so there is no fit and no seed. The gridded samples can then be encoded by bartorch.linop.CartesianSense() with positions=, whose normal is FFTs on the image grid: no NUFFT and no oversampled grid.

Parameters:
  • kspace (torch.Tensor) – (coils, *shots, samples) samples.

  • traj (torch.Tensor) – (*shots, samples, ndim) in grid units, kx, ky[, kz], as for bartorch.linop.NUFFT.

  • shape (tuple) – The image grid, ([z,] y, x).

  • calib (torch.Tensor or sequence of torch.Tensor) – Cartesian calibration k-space (coils, [z,] y, x) centred at n // 2, on the grid’s k-space spacing; a sequence of them with group when the contrast changes over the scan.

  • group (torch.Tensor, default=None) – (*shots,) index into calib of each shot’s calibration.

  • sources (int, default=3) – Readout samples per kernel.

  • lam (float, default=1e-3) – Tikhonov weight relative to the mean signal power.

  • spacing (float, default=1.0) – Arc length between sources along the readout, in grid units; None takes consecutive samples.

  • reach (int, default=4) – Displacements the correlation is tabulated to, in cells.

  • upsample (int, default=8) – Table steps per cell.

  • batch (int, default=1048576) – Targets per pass on a card: what it holds besides the samples.

  • device (torch.device, default=None) – Where the kernels are solved; the result is on the host. None uses the samples’ device. Each target’s kernel is solved in single precision by a compiled loop: one target per thread on a card, the targets spread over the cores on the host. The card holds the samples and batch targets’ indices and results, nothing else.

  • double (bool, default=False) – Solve the kernels in double precision, by torch (slow, for checks).

  • also (sequence of torch.Tensor, default=()) – More samples shaped as kspace, such as a draw of pure noise, moved by the same kernels without solving them again.

Returns:

With values (coils, M) complex64, their flat grid index (M,), the shot (flat index of *shots) and sample each came from, noise (M,) (each value’s noise variance per coil for unit white noise on the samples) and weights(), the weights of unit mean square that whiten the values; also holds the values of the extra samples, in their order.

Return type:

gridded

References

Examples

>>> g = igrog(kspace, traj, (256, 256, 256), calib)
>>> values = g.values * g.weights()