gradient_unwarped

gradient_unwarped#

pulserver.recon.gradient_unwarped()[source]#

Correct an image for gradient nonlinearity.

The coil’s spherical-harmonic field is evaluated at the scanner position of every voxel of the reconstruction matrix, and the image is resampled at the displaced positions; a complex image has its real and imaginary parts resampled separately. Geometry comes from the header’s reconstruction space and the unit’s reference acquisition, so the correction is in the frame the series was acquired in, oblique prescriptions included. An encoding of one partition, a 2D slice, is corrected in its plane: the displacement across the slice moves the slice, which resampling cannot undo.

Parameters:
  • image (array_like) – (..., [partitions,] lines, columns), NumPy array or Torch tensor.

  • context (ReconContext) – The plugin’s ReconContext, whose header states the table.

  • data (ReconData) – The plugin’s ReconData, whose buffer states the geometry.

  • cache (dict, default=None) – Corrections already built for the stream, by the reference acquisition’s encoding space, position and orientation; the one this unit needs is taken from it or added to it. A stream of several units of one geometry, the echoes of a multi-echo scan or the volumes of a time series, so builds its correction once.

Returns:

The corrected image, of the type and on the device of image. image itself where the header states no table, where the unit has no reference acquisition, or where the correction fails; the last two are logged as warnings and an uncorrected image is sent on.

Return type:

numpy.ndarray or torch.Tensor