bartorch.register_affine#
- bartorch.register_affine(reference, moved, *, transform='rigid', reference_mask=None, moved_mask=None)#
Affine transform that maps
referenceontomoved, by mutual information.Registers magnitudes over a three-level Gaussian pyramid.
- Parameters:
reference (torch.Tensor) – Images of C shape
(z, y, x)or(y, x); any further leading axis must have size one. Areferencewithoutz, or withzof size one, is registered in two dimensions.moved (torch.Tensor) – Images of C shape
(z, y, x)or(y, x); any further leading axis must have size one. Areferencewithoutz, or withzof size one, is registered in two dimensions.transform ({"translation", "rigid", "affine"}) – Degrees of freedom: translation only (
-T), rotation and translation (-R), or all (-A).reference_mask (torch.Tensor, optional) – Binary masks shaped like their image (
--mask-reference,--mask-moved); both or neither.moved_mask (torch.Tensor, optional) – Binary masks shaped like their image (
--mask-reference,--mask-moved); both or neither.
- Returns:
Real
(k, k + 1)matrix[A | t],ktwo or three, whose rows and columns are the lastkaxes in C order. It maps a position inreferenceto the position inmovedthat lands there,p_moved = A @ p_ref + t, each in its own grid’s field-of-view units(index - n // 2) / n(motion/affine.c:152-171,:428-465): content ofmoveddisplaced bydvoxels along the last axis givest[-1] = d / n. This is whatbartorch.affine_transform()takes:affine_transform(moved, matrix, axes=tuple(range(-k, 0)))resamplesmovedontoreference.- Return type:
torch.Tensor