tomosipo.translate
- tomosipo.translate(axis, *, alpha=1)[source]
Create a translation transform
- Parameters:
axis (
Tuple[float,float,float] |Iterable[Tuple[float,float,float]] |ndarray|Tuple[float,float,float,float] |Iterable[Tuple[float,float,float,float]]) –By how much to translate. The parameter axis is interpreted as a series of homogeneous coordinates. You may pass in both homogeneous or non-homogeneous coordinates. Also, you may pass in multiple rows for multiple timesteps. The following shapes are allowed:
(n_rows, 3) [non-homogeneous] or (n_rows, 4) [homogeneous]
(3,) [non-homogeneous] or (4,) [homogeneous]
alpha (
float|Collection[float] |ndarray) – A scalar multiplier of axis. This parameter can be used to conveniently translate along a single axis.
- Returns:
A transform describing the translation
- Return type:
Examples
>>> ts.translate((1, 2, 3)) Transform( [[[1. 0. 0. 1.] [0. 1. 0. 2.] [0. 0. 1. 3.] [0. 0. 0. 1.]]] )
>>> ts.translate((1, 1, 1), alpha=[2, 3]) Transform( [[[1. 0. 0. 2.] [0. 1. 0. 2.] [0. 0. 1. 2.] [0. 0. 0. 1.]] [[1. 0. 0. 3.] [0. 1. 0. 3.] [0. 0. 1. 3.] [0. 0. 0. 1.]]] )