napari.utils.transforms.CompositeAffine#
- class napari.utils.transforms.CompositeAffine(scale=(1, 1), translate=(0, 0), *, axis_labels=None, rotate=None, shear=None, ndim=None, name=None, units=None)[source]#
Bases:
Affine
n-dimensional affine transformation composed from more basic components.
Composition is in the following order
rotate * shear * scale + translate
- Parameters:
rotate (float, 3-tuple of float, or n-D array.) – If a float convert into a 2D rotation matrix using that value as an angle. If 3-tuple convert into a 3D rotation matrix, using a yaw, pitch, roll convention. Otherwise assume an nD rotation. Angles are assumed to be in degrees. They can be converted from radians with np.degrees if needed.
scale (1-D array) – A 1-D array of factors to scale each axis by. Scale is broadcast to 1 in leading dimensions, so that, for example, a scale of [4, 18, 34] in 3D can be used as a scale of [1, 4, 18, 34] in 4D without modification. An empty translation vector implies no scaling.
shear (1-D array or n-D array) – Either a vector of upper triangular values, or an nD shear matrix with ones along the main diagonal.
translate (1-D array) – A 1-D array of factors to shift each axis by. Translation is broadcast to 0 in leading dimensions, so that, for example, a translation of [4, 18, 34] in 3D can be used as a translation of [0, 4, 18, 34] in 4D without modification. An empty translation vector implies no translation.
ndim (int) – The dimensionality of the transform. If None, this is inferred from the other parameters.
name (string) – A string name for the transform.
Methods
compose
(transform)Return the composite of this transform and the provided one.
expand_dims
(axes)Return a transform with added axes for non-visible dimensions.
replace_slice
(axes, transform)Returns a transform where the transform at the indicated n dimensions is replaced with another n-dimensional transform
set_slice
(axes)Return a transform subset to the visible dimensions.
Attributes
Return the affine matrix for the transform.
tuple of axis labels for the layer.
changed
Return the inverse transform.
Return the linear matrix of the transform.
Dimensionality of the transform.
Return the scale of the transform, with units.
Return the rotation of the transform.
Return the scale of the transform.
Return the shear of the transform.
Return the translation of the transform.
List of units for the layer.
Details
- property affine_matrix#
Return the affine matrix for the transform.
- compose(transform)#
Return the composite of this transform and the provided one.
- expand_dims(axes: Sequence[int]) CompositeAffine [source]#
Return a transform with added axes for non-visible dimensions.
- property linear_matrix#
Return the linear matrix of the transform.
- replace_slice(axes: Sequence[int], transform: Affine) Affine #
Returns a transform where the transform at the indicated n dimensions is replaced with another n-dimensional transform
- set_slice(axes: Sequence[int]) CompositeAffine [source]#
Return a transform subset to the visible dimensions.