Skip to content

Coordinates

Warning

The implementation of OME-Zarr 0.6 is not final, and subject to change. It is provided so users can test and evaluate ome-zarr-models and the specification before it becomes final. Please report issues and provide feedback!

Base models

ome_zarr_models.v06.coordinate_transforms.CoordinateSystem

Bases: BaseAttrs

A coordinate system.

Attributes:

Name Type Description
name str

Coordinate system name.

axes tuple[Axis, ...]

Coordinate system axes.

ome_zarr_models.v06.coordinate_transforms.CoordinateSystemIdentifier

Bases: BaseAttrs

A coordinate system identifier.

Attributes:

Name Type Description
name str | None

Coordinate system name.

path str | None

Path to Zarr group.

ome_zarr_models.v06.coordinate_transforms.Axis

Bases: BaseAttrs

Model for an element of Multiscale.axes.

Attributes:

Name Type Description
name str | None

Axis name.

type Literal['array', 'space', 'time', 'channel', 'coordinate', 'displacement'] | str | None

Axis type.

discrete bool | None

Whether coordinates on this axis have discrete (e.g., array coordinates) or continuous (e.g., length coordinates) values.

unit str | TypeAliasType | None

Axis units.

longName str | None

Longer name for axis.

ome_zarr_models.v06.coordinate_transforms.Transform

Bases: BaseAttrs, ABC

Base model of a coordinate transformation.

Notes

Coordinate transformations have a transform_point method to transform a single point. This only operates on a tuple of coordinate points, not other objects that could represent points (e.g., NumPy arrays). This is a deliberate choice to keep the dependencies of ome-zarr-models slim. Other libraries are encouraged to implement their own coordinate transforms, and use the transform_point methods here as reference implementations to check their own implementations.

Attributes:

Name Type Description
type str

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

ome_zarr_models.v06.coordinate_transforms.Transform.has_inverse

has_inverse: bool

True if an inverse can be returned from .

Examples:

>>> from ome_zarr_models.v06.coordinate_transforms import Translation
>>> t = Translation(translation=[1, -2, 3.4])
>>> t.has_inverse
True

ome_zarr_models.v06.coordinate_transforms.Transform.as_affine

as_affine() -> Affine

Convert this transform to an equivalent affine transform.

Raises:

Type Description
NoAffineError

If this transform can't be converted to an affine transform.

Examples:

>>> from ome_zarr_models.v06.coordinate_transforms import Translation
>>> t = Translation(translation=[1, -2, 3.4])
>>> t.as_affine()
Affine(type='affine', input=None, output=None, name=None, affine=((1.0, 0.0, 0.0, 1.0), (0.0, 1.0, 0.0, -2.0), (0.0, 0.0, 1.0, 3.4)), path=None)

ome_zarr_models.v06.coordinate_transforms.Transform.get_inverse

get_inverse() -> Transform

Inverse of this transform.

Raises:

Type Description
NotImplementedError

If this the inverse for this transform is not implemented.

Examples:

>>> from ome_zarr_models.v06.coordinate_transforms import Translation
>>> t = Translation(translation=[1, -2, 3.4])
>>> t.get_inverse()
Translation(type='translation', input=None, output=None, name=None, translation=(-1.0, 2.0, -3.4))

ome_zarr_models.v06.coordinate_transforms.Transform.transform_point

transform_point(point: Sequence[float]) -> tuple[float, ...]

Apply transform a single point.

Examples:

>>> from ome_zarr_models.v06.coordinate_transforms import Translation
>>> t = Translation(translation=[1, -2, 3.4])
>>> t.transform_point((0, 0, 0))
(1.0, -2.0, 3.4)

Coordinate transforms

ome_zarr_models.v06.coordinate_transforms.Affine

Bases: Transform

Affine transform.

Attributes:

Name Type Description
type Literal['affine']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

affine tuple[tuple[float, ...], ...] | None

Affine matrix

path str | None

Path to affine matrix stored as a Zarr array.

ome_zarr_models.v06.coordinate_transforms.Bijection

Bases: Transform

A transform that also contains an explicit inverse transform.

Attributes:

Name Type Description
type Literal['bijection']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

forward ForwardRef('AnyTransform')

Forward transform.

inverse ForwardRef('AnyTransform')

Inverse transform.

ome_zarr_models.v06.coordinate_transforms.ByDimension

Bases: Transform

A transform that operates on a subset of dimensions.

Attributes:

Name Type Description
type Literal['byDimension']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

transformations tuple[ByDimensionTransform, ...]

Transformations.

ome_zarr_models.v06.coordinate_transforms.ByDimensionTransform

Bases: BaseAttrs

A transformation item within a byDimension coordinate transformation.

As well as the actual transform, this specifies which axes it operates on via the input_axes and output_axes fields.

Attributes:

Name Type Description
transformation ForwardRef('AnyTransform')

The coordinate transformation.

input_axes tuple[int, ...]

Input axes indices.

output_axes tuple[int, ...]

Output axes indices.

Bases: Transform

Coordinate field transform.

This transform stores an explicit map from points in the input coordinate system to their corresponding points in the output coordinate system.

Attributes:

Name Type Description
type Literal['coordinates']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

path str

Path to the Zarr array containing the coordinate mapping.

interpolation str | None

Interpolation method to be used after applying the transform.

options: show_root_heading: true

ome_zarr_models.v06.coordinate_transforms.Displacements

Bases: Transform

Displacement field transform.

Attributes:

Name Type Description
type Literal['displacements']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

path str

Path to the Zarr array displacement field.

interpolation str | None

Interpolation method to be used after applying the transform.

ome_zarr_models.v06.coordinate_transforms.Identity

Bases: Transform

Identity transformation.

Attributes:

Name Type Description
type Literal['identity']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

ome_zarr_models.v06.coordinate_transforms.MapAxis

Bases: Transform

Axis mapping transform.

Examples:

>>> from ome_zarr_models.v06.coordinate_transforms import MapAxis
>>> t = MapAxis(mapAxis=[1, 2, 0, 3])
>>> t.transform_point((11, 12, 22, 33))
(12, 22, 11, 33)

Attributes:

Name Type Description
type Literal['mapAxis']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

mapAxis tuple[int, ...]

The axes to map axis numbers [0, 1, 2... etc.] to.

ome_zarr_models.v06.coordinate_transforms.Rotation

Bases: Transform

Rotation transform.

Notes

The rotation matrix must be a pure rotation matrix.

Attributes:

Name Type Description
type Literal['rotation']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

rotation tuple[tuple[float, ...], ...] | None

Rotation matrix.

path str | None

Path to rotation matrix stored as a Zarr array.

ome_zarr_models.v06.coordinate_transforms.Scale

Bases: Transform

Scale transformation.

Attributes:

Name Type Description
type Literal['scale']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

scale tuple[float, ...]

Scale factors for each axis.

ome_zarr_models.v06.coordinate_transforms.Scale.ndim

ndim: int

Number of dimensions.

ome_zarr_models.v06.coordinate_transforms.Translation

Bases: Transform

Translation transformation.

Attributes:

Name Type Description
type Literal['translation']

Unique identifier for type of transform (e.g., 'scale', 'translation'.

input CoordinateSystemIdentifier | None

Input coordinate system.

output CoordinateSystemIdentifier | None

Output coordinate system.

name str | None

Arbitrary for the specific transform (e.g., 'array-to-physical')

translation tuple[float, ...]

Translation vector.

ome_zarr_models.v06.coordinate_transforms.Translation.ndim

ndim: int

Number of dimensions.

ome_zarr_models.v06.coordinate_transforms.AnyTransform

AnyTransform = Annotated[Identity | MapAxis | Translation | Scale | Affine | Rotation | Sequence | Displacements | Coordinates | Bijection | ByDimension, Field(discriminator='type')]

Errors

ome_zarr_models.v06.coordinate_transforms.NoAffineError

Bases: RuntimeError

Exception raised when it's not possible to convert a transform to an affine.