tools.deblur

tools.deblur#

bartorch.tools.deblur()#

Remove off-resonance blur from a reconstructed spiral image.

The result is \(\sum_m a_m(f(r))\, (h_m * x)(r)\), with \(h_m\) the image-domain kernel of term \(m\) of transfer and the weights linearly interpolated at each voxel’s frequency \(f(r)\). \(|k| / k_{max}\) is the k-space coordinate normalized to one at the Nyquist edge of each axis: the arm transfer was fitted to is taken to reach the edge of the image’s grid.

Parameters:
  • image (torch.Tensor) – Complex image (..., *spatial), 2D or 3D, with the spatial axes those of field_map.

  • field_map (torch.Tensor) – Off-resonance frequency at each voxel, in Hz, (*spatial).

  • transfer (SpiralTransfer) – Factorization from fit_transfer().

  • backend ({"auto", "fft", "conv"}, default='auto') – "fft": each term a k-space multiply. "conv": a separable circular convolution, for a separable transfer and a CUDA image with Triton installed. "auto": "conv" where it applies.

Returns:

The deblurred image, of the shape and dtype of image.

Return type:

torch.Tensor

Raises:

ValueError – If image is not complex, its spatial shape is not that of field_map, or backend="conv" is asked of an MFI transfer.

Notes

The "conv" kernels are truncated, per axis, to the taps holding all but 1e-5 of their energy. Peak memory is one accumulator and one working volume, and for MFI one real volume of readout times, independent of the number of terms.

Examples using deblur#

Off-resonance correction of spiral imaging

Off-resonance correction of spiral imaging