tools.register_nonrigid#
- bartorch.tools.register_nonrigid()#
Displacement field from
referenceintomoved, 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, default=None) – Gaussian pyramid levels, one to five; BART’s default is three.
optical_flow (bool, default=False) – TV-L1 optical flow instead of greedy SyN.
tv_weight (float, default=None) – TV regularization of the optical flow; BART’s default is 0.01.
max_flow (float, default=None) – Bound on the flow magnitude of the optical flow.
- Returns:
field (torch.Tensor) – Real, shape
(*reference.shape, len(axes)); componentiis the displacement in voxels alongaxes[i], such thatmoved(p + field[p]) ≈ reference(p). Whatbartorch.tools.warp()takes:warp(moved, field, axes)resamplesmovedontoreference.inverse_field (torch.Tensor or None) – Same layout,
reference(p + inverse_field[p]) ≈ moved(p).Nonewithoptical_flow: BART computes no inverse there (estmotion.c:275).