tools.apply_susceptibility#
- bartorch.tools.apply_susceptibility()#
Correct an image for susceptibility distortion with a known displacement field.
The model is that of
correct_susceptibility(): the blip-up image is sampled at \(x + b(x)\) and its intensity multiplied by \(1 + \partial b / \partial x\), the blip-down image at \(x - b(x)\) with \(1 - \partial b / \partial x\). The field, estimated once from a pair, so corrects every later image acquired with the same phase encoding and field, as FSL’sapplytopup --method=jacdoes. The image is interpolated linearly along the phase-encoding axis, wrapping around the field of view as the phase encoding does. Nothing but torch is needed.- Parameters:
image (torch.Tensor) – Real or complex image, 2D or 3D.
field_map (torch.Tensor) – Displacement along the phase-encoding axis in the units of
voxel_size, on cell edges: one sample longer thanimagealong that axis and of its size along the others, asSusceptibilityCorrection.field_map.voxel_size (tuple of float) – Voxel size per axis of the image, in the units of
field_map.phase_encoding_axis (int, default=0) – Phase-encoding axis of
imageandfield_map.blip ({"up", "down"}, default='up') – Phase-encoding polarity of
image:"up"for the image passed asblip_uptocorrect_susceptibility().
- Returns:
The corrected image, of the shape of
image.- Return type:
torch.Tensor
- Raises:
ValueError – If
field_mapis not one sample longer thanimagealong the phase-encoding axis and of its size along the others,voxel_sizedoes not give one value per axis, orblipis unknown.