bartorch.warp

Contents

bartorch.warp#

bartorch.warp(input, displacement, axes, *, order=1)#

Pull input through a displacement field: out[p] = input(p + displacement[p]).

p and the displacement are in voxels along axes; the grid is zero outside [0, n - 1]. BART’s interpolate -D.

Parameters:
  • input (torch.Tensor)

  • displacement (torch.Tensor) – Real field of shape (..., len(axes)); component i of the last axis is the displacement along axes[i]. The leading shape is aligned right against input.shape, equal to it along axes and one or equal elsewhere.

  • axes (int or tuple of int) – The last len(axes) axes, in any order: BART interpolates along the first len(axes) BART dims whatever the flags (motion/displacement.c:117).

  • order ({0, 1, 3}) – Nearest neighbour, linear, or Keys cubic; see interpolate().

Returns:

Same shape as input.

Return type:

torch.Tensor