bartorch.register_nonrigid

bartorch.register_nonrigid#

bartorch.register_nonrigid(reference, moved, axes, *, levels=None, optical_flow=False, tv_weight=None, max_flow=None)#

Displacement field from reference into moved, by greedy SyN or TV-L1 optical flow.

Registers magnitudes.

Parameters:
  • reference (torch.Tensor) – Images of the same shape, at most eight axes.

  • moved (torch.Tensor) – Images of the same shape, at most eight axes.

  • axes (int or tuple of int) – Axes to register along.

  • levels (int, optional) – Gaussian pyramid levels, one to five (-l); BART’s default is three.

  • optical_flow (bool) – TV-L1 optical flow instead of greedy SyN (--optical-flow).

  • tv_weight (float, optional) – TV regularization of the optical flow (-r); BART’s default is 0.01.

  • max_flow (float, optional) – Bound on the flow magnitude of the optical flow (--max-flow).

Returns:

  • field (torch.Tensor) – Real, shape (*reference.shape, len(axes)); component i is the displacement in voxels along axes[i], such that moved(p + field[p]) reference(p). What bartorch.warp() takes: warp(moved, field, axes) resamples moved onto reference.

  • inverse_field (torch.Tensor or None) – Same layout, reference(p + inverse_field[p]) moved(p). None with optical_flow: BART computes no inverse there (estmotion.c:275).