hyri.measurement_operator.meas_op_nufft_tkbn#

Define the TKBNUFFT-backed measurement operator.

This implementation uses torchkbnufft for forward and adjoint NUFFT operations.

Class

MeasOpTkbn

Represent a NUFFT measurement operator backed by TorchKbNUFFT.

class hyri.measurement_operator.meas_op_nufft_tkbn.MeasOpTkbn(u: Tensor, v: Tensor, img_size: tuple[int, int], natural_weight: Tensor = tensor([[[1.]]]), image_weight: Tensor = tensor([[[1.]]]), precond_weight: Tensor = tensor([[[1.]]]), real_flag: bool = True, grid_size: tuple[int, int] = None, kernel_dim: int = 7, mode: str = 'table', device: device = device(type='cpu'), dtype: dtype = torch.float32, **kwargs: Any)#

Bases: MeasOpNUFFT

Represent a NUFFT measurement operator backed by TorchKbNUFFT.

This class evaluates nonuniform Fourier sampling with torchkbnufft for single-channel measurement operators. It reuses the weighting and preconditioning logic defined in MeasOpNUFFT while exposing the backend-specific interpolation modes supported by TorchKbNUFFT.

Shape:
  • Image tensor – (1, 1, H, W).

  • Visibility tensor – (1, 1, N).

  • Sampling-pattern coordinates :math:`u` and :math:`v` – (1, 1, N).

_traj#

Sampling trajectory stored in TorchKbNUFFT’s expected layout.

Type:

torch.Tensor

_data_weight#

Combined natural and imaging weights applied in measurement space.

Type:

torch.Tensor

_precond_weight#

Preconditioning weights applied around the backend NUFFT calls.

Type:

torch.Tensor

_nufft_obj#

Forward TorchKbNUFFT operator.

Type:

torch.nn.Module

_adj_nufft_obj#

Adjoint TorchKbNUFFT operator.

Type:

torch.nn.Module

_interp_mats#

Sparse interpolation matrices for "matrix" mode, or None for "table" mode.

Type:

tuple[torch.Tensor, …] | None

Example

>>> import torch
>>> u = (2 * torch.pi) * torch.rand(1, 1, 8) - torch.pi
>>> v = (2 * torch.pi) * torch.rand(1, 1, 8) - torch.pi
>>> op = MeasOpTkbn(
...     u=u,
...     v=v,
...     img_size=(16, 16),
...     mode="table",
... )
>>> image = torch.randn(1, 1, 16, 16)
>>> vis = op.forward_op(image)
>>> vis.shape
torch.Size([1, 1, 8])

References

Muckley, M. J., Stern, R., Murrell, T., & Knoll, F. (2020). TorchKbNufft: A high-level, hardware-agnostic non-uniform fast Fourier transform. ISMRM Workshop Data Sampling Image Reconstr. Source code available at mmuckley/torchkbnufft.

Initialise the torchkbnufft measurement operator.

Parameters:
  • u (torch.Tensor) – u sampling coordinates in radians.

  • v (torch.Tensor) – v sampling coordinates in radians.

  • img_size (Tuple[int, int]) – Target image size (H, W).

  • natural_weight (torch.Tensor, optional) – Natural weighting tensor. Default: torch.ones(1, 1, 1).

  • image_weight (torch.Tensor, optional) – Imaging weighting tensor. Default: torch.ones(1, 1, 1).

  • precond_weight (torch.Tensor, optional) – Data-space preconditioning tensor. Default: torch.ones(1, 1, 1).

  • real_flag (bool, optional) – If True, keep adjoint outputs real when applicable. Default: True.

  • grid_size (Tuple[int, int], optional) – Oversampled Fourier-grid size. If None, uses 2 * img_size. Default: None.

  • kernel_dim (int, optional) – Kaiser-Bessel kernel support. Default: 7.

  • mode (str, optional) – Interpolation mode, either "table" or "matrix". Default: "table".

  • device (torch.device, optional) – Execution device. Default: torch.device("cpu").

  • dtype (torch.dtype, optional) – Image-domain dtype. Default: torch.float.

  • **kwargs – Reserved for API compatibility with other backends.

Raises:
_nufft_op(x: Tensor) → Tensor#

Apply forward TKBNUFFT and data weighting.

Parameters:

x (torch.Tensor) – Image-domain input tensor.

Returns:

Weighted measurement-domain tensor.

Return type:

torch.Tensor

_nufft_adj_op(y: Tensor) → Tensor#

Apply adjoint TKBNUFFT and data weighting.

Parameters:

y (torch.Tensor) – Measurement-domain input tensor.

Returns:

Image-domain adjoint output tensor.

Return type:

torch.Tensor