Skip to content

Image

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!

ome_zarr_models.v06.image.Image

Bases: BaseGroupv06[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], scales: Sequence[Sequence[float]], translations: Sequence[Sequence[float] | None], physical_coord_system: CoordinateSystem, name: str, multiscale_type: str | None = None, metadata: JsonValue | None = None, coord_transforms: Sequence[AnyTransform] = (), coord_systems: Sequence[CoordinateSystem] = ()) -> 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
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
physical_coord_system CoordinateSystem

The physical coordinate system after the scale and translations have been applied to each array.

required
name str

A name for the multiscale image.

required
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
coord_transforms Sequence[AnyTransform]

Additional coordinate transforms to add to this image.

()
coord_systems Sequence[CoordinateSystem]

Additional coordinate systems to add to this image.

()
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.

transform_graph

transform_graph() -> TransformGraph

Create a coordinate transformation graph for this image.

ome_zarr_models.v06.image.ImageAttrs

Bases: BaseOMEAttrs

Metadata for OME-Zarr image groups.

Attributes:

Name Type Description
version Literal['0.6.dev4']
multiscales list[Multiscale]

The multiscale datasets for this image

transform_graph

transform_graph() -> TransformGraph

Create a coordinate transformation graph for these image attributes.

Multiscales metadata

ome_zarr_models.v06.multiscales.Dataset

Bases: BaseAttrs

An element of Multiscale.datasets.

Attributes:

Name Type Description
path str
coordinateTransformations tuple[Scale | Identity | Sequence]

build

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

Construct a Dataset.

Parameters:

Name Type Description Default
path str

Path to Zarr array.

required
scale Sequence[float]

Scale factors for this Dataset. These should be set so the output voxel size matches the highest resolution dataset in the multiscales.

required
translation Sequence[float] | None

A translation to apply. This is applied after the scaling.

required
coord_sys_output_name str

The name of the output coordinate system after this dataset is scaled and translated.

required

check_cs_input

check_cs_input() -> Self

Check the input of all multiscale transformations

check_cs_output

check_cs_output() -> Self

Check the output of all multiscale transformations

ome_zarr_models.v06.multiscales.Multiscale

Bases: BaseAttrs

An element of multiscales metadata.

Attributes:

Name Type Description
coordinateSystems tuple[CoordinateSystem, ...]
datasets ForwardRef('tuple[Dataset, ...]')
coordinateTransformations tuple[Identity | MapAxis | Translation | Scale | Affine | Rotation | Sequence | Displacements | Coordinates | Bijection | ByDimension, ...] | None
metadata TypeAliasType
name TypeAliasType | None
type TypeAliasType

intrinsic_coordinate_system

intrinsic_coordinate_system: CoordinateSystem

Physical coordinate system.

Should be used for viewing and processing unless a use case dictates otherwise. A representation of the image in its native physical coordinate system.

Notes

This is the coordinate system which is the output of all multiscale transformations defined in datasets.

ndim

ndim: int

Dimensionality of the data described by this multiscale metadata.

check_dataset_transform_output

check_dataset_transform_output() -> Self

Check the output of all transforms in 'datasets' are the same.

to_version

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

Convert this Multiscale metadata to the specified version.

Currently supported conversions are

  • 0.6 -> 0.5
  • 0.6 -> 0.4

Parameters:

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

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

required