Skip to content

Image

ome_zarr_models.v05.image.Image

Bases: BaseGroupv05[ImageAttrs]

An OME-Zarr image dataset.

Attributes:

Name Type Description
zarr_format Literal[3]
node_type Literal['group']
attributes BaseZarrAttrs[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

Any labels datasets contained in this image group.

Returns None if no labels are present.

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

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.v05.image.ImageAttrs

Bases: BaseOMEAttrs

Metadata for OME-Zarr image groups.

Attributes:

Name Type Description
version Literal['0.5']
multiscales list[Multiscale]

The multiscale datasets for this image

to_version

to_version(version: Literal['0.6'], *, default_cs_name: str = 'physical', output_cs_name: str = 'output') -> ImageAttrs

Convert these Image Attributes metadata to the specified version.

Currently supported conversions are - 0.5 -> 0.6

Parameters:

Name Type Description Default
version Literal['0.6']

The version to convert to. Must be "0.6".

required
default_cs_name str

The name of the default coordinate system to use for the 0.5 -> 0.6 conversion. Defaults to "physical".

'physical'
output_cs_name str

The name of the output coordinate system to use for the 0.5 -> 0.6 conversion. Defaults to "output". Only used if coordinateTransformations are defined in the 0.5 metadata.

'output'
Notes

If there is more than one multiscale, the same default coordinate system names are applied to each multiscale. If you need them to be different, edit them manually after the conversion.

Multiscales metadata

ome_zarr_models.v05.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.v05.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

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.4']) -> Multiscale
to_version(version: Literal['0.6'], *, default_cs_name: str = 'physical', output_cs_name: str = 'output') -> Multiscale
to_version(version: Literal['0.4', '0.6'], *, default_cs_name: str = 'physical', output_cs_name: str = 'output') -> Multiscale | Multiscale

Convert this Multiscale metadata to the specified version.

Currently supported conversions are - 0.5 -> 0.4 - 0.5 -> 0.6

Parameters:

Name Type Description Default
version Literal['0.4', '0.6']

The version to convert to. Must be one of "0.4" or "0.6".

required
default_cs_name str

The name of the default coordinate system to use for the 0.5 -> 0.6 conversion. Defaults to "physical".

'physical'
output_cs_name str

The name of the output coordinate system to use for the 0.5 -> 0.6 conversion. Defaults to "output". Only used if coordinateTransformations are defined in the 0.5 metadata.

'output'

Coordinate transformation metadata

ome_zarr_models.v05.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.v05.coordinate_transformations.PathScale

Bases: Transform

Scale transformation parametrized by a path.

Attributes:

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

ome_zarr_models.v05.coordinate_transformations.PathTranslation

Bases: Transform

Translation transformation parametrized by a path.

Attributes:

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

ome_zarr_models.v05.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.v05.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.v05.axes.Axis

Bases: BaseAttrs

Model for an element of Multiscale.axes.

Attributes:

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