torchkbnufft.functional

fft_filter

fft_filter(image, kernel, norm='ortho')[source]

FFT-based filtering on an oversampled grid.

This is a wrapper for the operation

\[\text{output} = iFFT(\text{kernel}*FFT(\text{image})) \]

where \(iFFT\) and \(FFT\) are both implemented as oversampled FFTs.

Parameters
  • image (Tensor) – The image to be filtered.

  • kernel (Tensor) – FFT-domain filter.

  • norm (Optional[str]) – Whether to apply normalization with the FFT operation. Options are "ortho" or None.

Return type

Tensor

Returns

Filtered version of image.

Interpolation Functions

kb_spmat_interp

kb_spmat_interp(image, interp_mats)[source]

Kaiser-Bessel sparse matrix interpolation.

See KbInterp for an overall description of interpolation.

To calculate the sparse matrix tuple, see calc_tensor_spmatrix().

Parameters
  • image (Tensor) – Gridded data to be interpolated to scattered data.

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

Return type

Tensor

Returns

image calculated at scattered locations.

kb_spmat_interp_adjoint

kb_spmat_interp_adjoint(data, interp_mats, grid_size)[source]

Kaiser-Bessel sparse matrix interpolation adjoint.

See KbInterpAdjoint for an overall description of adjoint interpolation.

To calculate the sparse matrix tuple, see calc_tensor_spmatrix().

Parameters
  • data (Tensor) – Scattered data to be interpolated to gridded data.

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

Return type

Tensor

Returns

data calculated at gridded locations.

kb_table_interp

kb_table_interp(image, omega, tables, n_shift, numpoints, table_oversamp, offsets)[source]

Kaiser-Bessel table interpolation.

See KbInterp for an overall description of interpolation and how to construct the function arguments.

Parameters
  • image (Tensor) – Gridded data to be interpolated to scattered data.

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

  • tables (List[Tensor]) – Interpolation tables (one table for each dimension).

  • n_shift (Tensor) – Size for fftshift, usually im_size // 2.

  • numpoints (Tensor) – Number of neighbors to use for interpolation.

  • table_oversamp (Tensor) – Table oversampling factor.

  • offsets (Tensor) – A list of offsets, looping over all possible combinations of numpoints.

Return type

Tensor

Returns

image calculated at scattered locations.

kb_table_interp_adjoint

kb_table_interp_adjoint(data, omega, tables, n_shift, numpoints, table_oversamp, offsets, grid_size)[source]

Kaiser-Bessel table interpolation adjoint.

See KbInterpAdjoint for an overall description of adjoint interpolation.

Parameters
  • data (Tensor) – Scattered data to be interpolated to gridded data.

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

  • tables (List[Tensor]) – Interpolation tables (one table for each dimension).

  • n_shift (Tensor) – Size for fftshift, usually im_size // 2.

  • numpoints (Tensor) – Number of neighbors to use for interpolation.

  • table_oversamp (Tensor) – Table oversampling factor.

  • offsets (Tensor) – A list of offsets, looping over all possible combinations of numpoints.

  • grid_size (Tensor) – Size of grid to use for interpolation, typically 1.25 to 2 times im_size.

Return type

Tensor

Returns

data calculated at gridded locations.

NUFFT Functions

kb_spmat_nufft

kb_spmat_nufft(image, scaling_coef, im_size, grid_size, interp_mats, norm=None)[source]

Kaiser-Bessel NUFFT with sparse matrix interpolation.

See KbNufft for an overall description of the forward NUFFT.

To calculate the sparse matrix tuple, see calc_tensor_spmatrix().

Parameters
  • image (Tensor) – Image to be NUFFT’d to scattered data.

  • scaling_coef (Tensor) – Image-domain coefficients to pre-compensate for interpolation errors.

  • im_size (Tensor) – Size of image with length being the number of dimensions.

  • grid_size (Tensor) – Size of grid to use for interpolation, typically 1.25 to 2 times im_size.

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

  • norm (Optional[str]) – Whether to apply normalization with the FFT operation. Options are "ortho" or None.

Return type

Tensor

Returns

image calculated at scattered Fourier locations.

kb_spmat_nufft_adjoint

kb_spmat_nufft_adjoint(data, scaling_coef, im_size, grid_size, interp_mats, norm=None)[source]

Kaiser-Bessel adjoint NUFFT with sparse matrix interpolation.

See KbNufftAdjoint for an overall description of the adjoint NUFFT.

To calculate the sparse matrix tuple, see calc_tensor_spmatrix().

Parameters
  • data (Tensor) – Scattered data to be iNUFFT’d to an image.

  • scaling_coef (Tensor) – Image-domain coefficients to compensate for interpolation errors.

  • im_size (Tensor) – Size of image with length being the number of dimensions.

  • grid_size (Tensor) – Size of grid to use for interpolation, typically 1.25 to 2 times im_size.

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

  • norm (Optional[str]) – Whether to apply normalization with the FFT operation. Options are "ortho" or None.

Return type

Tensor

Returns

data transformed to an image.

kb_table_nufft

kb_table_nufft(image, scaling_coef, im_size, grid_size, omega, tables, n_shift, numpoints, table_oversamp, offsets, norm=None)[source]

Kaiser-Bessel NUFFT with table interpolation.

See KbNufft for an overall description of the forward NUFFT.

Parameters
  • image (Tensor) – Image to be NUFFT’d to scattered data.

  • scaling_coef (Tensor) – Image-domain coefficients to pre-compensate for interpolation errors.

  • im_size (Tensor) – Size of image with length being the number of dimensions.

  • grid_size (Tensor) – Size of grid to use for interpolation, typically 1.25 to 2 times im_size.

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

  • tables (List[Tensor]) – Interpolation tables (one table for each dimension).

  • n_shift (Tensor) – Size for fftshift, usually im_size // 2.

  • numpoints (Tensor) – Number of neighbors to use for interpolation.

  • table_oversamp (Tensor) – Table oversampling factor.

  • offsets (Tensor) – A list of offsets, looping over all possible combinations of numpoints.

  • norm (Optional[str]) – Whether to apply normalization with the FFT operation. Options are "ortho" or None.

Return type

Tensor

Returns

image calculated at scattered Fourier locations.

kb_table_nufft_adjoint

kb_table_nufft_adjoint(data, scaling_coef, im_size, grid_size, omega, tables, n_shift, numpoints, table_oversamp, offsets, norm=None)[source]

Kaiser-Bessel NUFFT adjoint with table interpolation.

See KbNufftAdjoint for an overall description of the adjoint NUFFT.

Parameters
  • data (Tensor) – Scattered data to be iNUFFT’d to an image.

  • scaling_coef (Tensor) – Image-domain coefficients to compensate for interpolation errors.

  • im_size (Tensor) – Size of image with length being the number of dimensions.

  • grid_size (Tensor) – Size of grid to use for interpolation, typically 1.25 to 2 times im_size.

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

  • tables (List[Tensor]) – Interpolation tables (one table for each dimension).

  • n_shift (Tensor) – Size for fftshift, usually im_size // 2.

  • numpoints (Tensor) – Number of neighbors to use for interpolation.

  • table_oversamp (Tensor) – Table oversampling factor.

  • offsets (Tensor) – A list of offsets, looping over all possible combinations of numpoints.

  • norm (Optional[str]) – Whether to apply normalization with the FFT operation. Options are "ortho" or None.

Return type

Tensor

Returns

data transformed to an image.