KbInterpAdjoint

class KbInterpAdjoint(im_size, grid_size=None, numpoints=6, n_shift=None, table_oversamp=1024, kbwidth=2.34, order=0.0, dtype=None, device=None)[source]

Non-uniform Kaiser-Bessel interpolation adjoint layer.

This object interpolates off-grid Fourier data to on-grid locations using a Kaiser-Bessel kernel. Mathematically, in one dimension it estimates \(X_k, k \in [0, ..., K-1]\), the oversampled DFT of \(x_n, n \in [0, ..., N-1]\), from a signal \(Y_m, m \in [0, ..., M-1]\) at frequency locations \(\omega_m\). To perform the estimate, this layer applies

\[X_k = \sum_{j=1}^J \sum_{m=0}^{M-1} Y_m u_j(\omega_m) \mathbb{1}_{\{\{k_m+j\}_K=k\}}, \]

where \(u\) is the Kaiser-Bessel kernel, \(k_m\) is the index of the root offset of nearest samples of \(X\) to frequency location \(\omega_m\), \(\mathbb{1}\) is an indicator function, and \(J\) is the number of nearest neighbors to use from \(X_k\). Multiple dimensions are handled separably. For a detailed description of the notation see Nonuniform fast Fourier transforms using min-max interpolation (JA Fessler and BP Sutton).

Note

This function is not the inverse of KbInterp; it is the adjoint.

When called, the parameters of this class define properties of the kernel and how the interpolation is applied.

  • im_size is the size of the base image, analagous to \(N\) (used for calculating the kernel but not for the actual operation).

  • grid_size is the size of the grid after adjoint interpolation, analogous to \(K\). To reduce errors, NUFFT operations are done on an oversampled grid to reduce interpolation distances. This will typically be 1.25 to 2 times im_size.

  • numpoints is the number of nearest neighbors to use for interpolation, i.e., \(J\).

  • n_shift is the FFT shift distance, typically im_size // 2.

Parameters
  • im_size (Sequence[int]) – Size of image with length being the number of dimensions.

  • grid_size (Optional[Sequence[int]]) – Size of grid to use for interpolation, typically 1.25 to 2 times im_size. Default: 2 * im_size

  • numpoints (Union[int, Sequence[int]]) – Number of neighbors to use for interpolation in each dimension.

  • n_shift (Optional[Sequence[int]]) – Size for fftshift. Default: im_size // 2.

  • table_oversamp (Union[int, Sequence[int]]) – Table oversampling factor.

  • kbwidth (float) – Size of Kaiser-Bessel kernel.

  • order (Union[float, Sequence[float]]) – Order of Kaiser-Bessel kernel.

  • dtype (Optional[dtype]) – Data type for tensor buffers. Default: torch.get_default_dtype()

  • device (Optional[device]) – Which device to create tensors on. Default: torch.device('cpu')

Examples

>>> data = torch.randn(1, 1, 12) + 1j * torch.randn(1, 1, 12)
>>> omega = torch.rand(2, 12) * 2 * np.pi - np.pi
>>> adjkb_ob = tkbn.KbInterpAdjoint(im_size=(8, 8), grid_size=(8, 8))
>>> image = adjkb_ob(data, omega)
forward(data, omega, interp_mats=None, grid_size=None)[source]

Interpolate from scattered data to gridded data.

Input tensors should be of shape (N, C) + klength, where N is the batch size and C is the number of sensitivity coils. omega, the k-space trajectory, should be of size (len(grid_size), klength) or (N, len(grid_size), klength), where klength is the length of the k-space trajectory.

Note

If the batch dimension is included in omega, the interpolator will parallelize over the batch dimension. This is efficient for many small trajectories that might occur in dynamic imaging settings.

If your tensors are real-valued, ensure that 2 is the size of the last dimension.

Parameters
  • data (Tensor) – Data to be gridded.

  • omega (Tensor) – k-space trajectory (in radians/voxel).

  • interp_mats (Optional[Tuple[Tensor, Tensor]]) – 2-tuple of real, imaginary sparse matrices to use for sparse matrix KB interpolation (overrides default table interpolation).

Return type

Tensor

Returns

data interpolated to the grid.