Skip to content

Image

ome_zarr_models.v04.image.Image

Bases: BaseGroupv04[ImageAttrs]

An OME-Zarr multiscale dataset.

Attributes:

Name Type Description
zarr_format Literal[2]
attributes ImageAttrs
members Mapping[str, GroupSpec | ArraySpec] | None

datasets

datasets: tuple[tuple[Dataset, ...], ...]

Get datasets stored in this image.

The first index is for the multiscales. The second index is for the dataset inside that multiscales.

labels

labels: Labels | None

Labels group contained within this image group.

Returns None if no labels are present.

Raises:

Type Description
RuntimeError

If the node at "labels" is not a group.

from_zarr

from_zarr(group: Group) -> Self

Create an OME-Zarr image model from a zarr.Group.

Parameters:

Name Type Description Default
group Group

A Zarr group that has valid OME-Zarr image metadata.

required

new

new(*, array_specs: Sequence[AnyArraySpec], paths: Sequence[str], axes: Sequence[Axis], scales: Sequence[Sequence[float]], translations: Sequence[Sequence[float] | None], name: str | None = None, multiscale_type: str | None = None, metadata: JsonValue | None = None, global_scale: Sequence[float] | None = None, global_translation: Sequence[float] | None = None) -> Image

Create a new Image from a sequence of multiscale arrays and spatial metadata.

Parameters:

Name Type Description Default
array_specs Sequence[AnyArraySpec]

A sequence of array specifications that collectively represent the same image at multiple levels of detail.

required
paths Sequence[str]

The paths to the arrays within the new Zarr group.

required
axes Sequence[Axis]

Axis objects describing the axes of the arrays.

required
scales Sequence[Sequence[float]]

For each array, a scale value for each axis of the array.

required
translations Sequence[Sequence[float] | None]

For each array, a translation value for each axis the array.

required
name str | None

A name for the multiscale collection.

None
multiscale_type str | None

Type of downscaling method used to generate the multiscale image pyramid. Optional.

None
metadata JsonValue | None

Arbitrary metadata to store in the multiscales group.

None
global_scale Sequence[float] | None

A global scale value for each axis of every array.

None
global_translation Sequence[float] | None

A global translation value for each axis of every array.

None
Notes

This class does not store or copy any array data. To save array data, first write this class to a Zarr store, and then write data to the Zarr arrays in that store.

ome_zarr_models.v04.image.ImageAttrs

Bases: BaseAttrsv2

Metadata for OME-Zarr image groups.

Attributes:

Name Type Description
multiscales list[Multiscale]

The multiscale datasets for this image

omero Omero | None

Multiscales metadata

ome_zarr_models.v04.multiscales.Dataset

Bases: BaseAttrs

An element of Multiscale.datasets.

Attributes:

Name Type Description
path str
coordinateTransformations tuple[VectorScale | PathScale] | tuple[VectorScale | PathScale, VectorTranslation | PathTranslation]

build

build(*, path: str, scale: Sequence[float], translation: Sequence[float] | None) -> Self

Construct a Dataset from a path, a scale, and a translation.

ome_zarr_models.v04.multiscales.Multiscale

Bases: BaseAttrs

An element of multiscales metadata.

Attributes:

Name Type Description
axes Sequence[Axis]
datasets ForwardRef('tuple[Dataset, ...]')
coordinateTransformations tuple[VectorScale | PathScale] | tuple[VectorScale | PathScale, VectorTranslation | PathTranslation] | None
metadata TypeAliasType
name TypeAliasType | None
type TypeAliasType
version Literal['0.4'] | None

ndim

ndim: int

Dimensionality of the data described by this metadata.

Determined by the length of the axes attribute.

to_version

to_version(version: Literal['0.5']) -> Multiscale

Convert this Multiscale metadata to the specified version.

Currently supports conversions: - from 0.4 to 0.5

Coordinate transformation metadata

For reference, see the coordinate transformations section of the OME-Zarr specification.

ome_zarr_models.v04.coordinate_transformations.Identity

Bases: Transform

Identity transformation.

Notes

Although defined in the specification, it is not allowed to be used anywhere.

Attributes:

Name Type Description
type Literal['identity']

ome_zarr_models.v04.coordinate_transformations.PathScale

Bases: Transform

Scale transformation parametrized by a path.

Attributes:

Name Type Description
type Literal['scale']
path str

ome_zarr_models.v04.coordinate_transformations.PathTranslation

Bases: Transform

Translation transformation parametrized by a path.

Attributes:

Name Type Description
type Literal['translation']
translation str

ome_zarr_models.v04.coordinate_transformations.Transform

Bases: BaseAttrs

Attributes:

Name Type Description
type Literal['identity', 'scale', 'translation']

ome_zarr_models.v04.coordinate_transformations.VectorScale

Bases: Transform

Scale transformation parametrized by a vector of numbers.

Attributes:

Name Type Description
type Literal['scale']
scale list[float]

ndim

ndim: int

Number of dimensions.

build

build(data: Iterable[float]) -> Self

Create a VectorScale from an iterable of floats.

ome_zarr_models.v04.coordinate_transformations.VectorTranslation

Bases: Transform

Translation transformation parametrized by a vector of numbers.

Attributes:

Name Type Description
type Literal['translation']

Type

translation list[float]

ndim

ndim: int

Number of dimensions.

build

build(data: Iterable[float]) -> Self

Create a VectorTranslation from an iterable of floats.

Axes metadata

ome_zarr_models.v04.axes.Axis

Bases: BaseAttrs

Model for an element of Multiscale.axes.

Attributes:

Name Type Description
name TypeAliasType
type str | None
unit str | TypeAliasType | None

OMERO metadata

ome_zarr_models.v04.omero.Channel

Bases: BaseAttrs

A single omero channel.

Attributes:

Name Type Description
color str
window Window

ome_zarr_models.v04.omero.Omero

Bases: BaseAttrs

omero model.

Attributes:

Name Type Description
channels list[Channel]

ome_zarr_models.v04.omero.Window

Bases: BaseAttrs

A single window.

Attributes:

Name Type Description
max float
min float
start float
end float