napari.utils.transforms.Transform#

class napari.utils.transforms.Transform(func=<function identity>, inverse=None, name=None)[source]#

Bases: object

Base transform class.

Defaults to the identity transform.

Parameters:
  • func (callable, Coords -> Coords) – A function converting an NxD array of coordinates to NxD’.

  • 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

Details

compose(transform: Transform) Transform[source]#

Return the composite of this transform and the provided one.

expand_dims(axes: Sequence[int]) Transform[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

set_slice(axes: Sequence[int]) Transform[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