napari.utils.transforms.ScaleTranslate#

class napari.utils.transforms.ScaleTranslate(scale=(1.0,), translate=(0.0,), *, name=None)[source]#

Bases: Transform

n-dimensional scale and translation (shift) class.

Scaling is always applied before translation.

Parameters:
  • 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.

  • 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.

  • 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.

set_slice(axes)

Return a transform subset to the visible dimensions.

Attributes

changed

inverse

Return the inverse transform.

Details

compose(transform: Transform) Transform[source]#

Return the composite of this transform and the provided one.

expand_dims(axes: Sequence[int]) ScaleTranslate[source]#

Return a transform with added axes for non-visible dimensions.

Parameters:

axes (Sequence[int]) – Location of axes to expand the current transform with. Passing a list allows expansion to occur at specific locations and for expand_dims to be like an inverse to the set_slice method.

Returns:

Resulting transform.

Return type:

Transform

property inverse: ScaleTranslate#

Return the inverse transform.

set_slice(axes: Sequence[int]) ScaleTranslate[source]#

Return a transform subset to the visible dimensions.

Parameters:

axes (Sequence[int]) – Axes to subset the current transform with.

Returns:

Resulting transform.

Return type:

Transform