vreg.Volume3D.translate#
- Volume3D.translate(translation, values=False, reshape=False, coords='fixed', dir='xyz')[source]#
Translate the volume.
- Parameters:
translation (array-like) – translation vector (mm) with 1, 2 or 3 elements depending on the value of dir.
values (bool, optional) – If set to True, the values are transformed. Otherwise the affine is transformed. Defaults to False.
reshape (bool, optional) – When values=True, reshape=False will retain the shape and location of the volume. With reshape=True, the volume will be reshaped to fit the transformed values. This keyword is ignored when values=False. Defaults to False.
coords (str or array, optional) – Reference frame for the coordinates of the translation vector, as a 4x4 affine array. String options are shorthand notations: ‘fixed’ (patient reference), and ‘volume’ (volume reference frame). Defaults to ‘fixed’.
dir (str, optional) – Allowed directions of the translation. The options are ‘xyz’ (3D translation), ‘xy’ (2D in-slice translation) and ‘z’ (through-slice translation). Defaults to ‘xyz’.
- Returns:
transformed volume.
- Return type: