Skip to content

OME-Zarr groups

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

Bases: BaseGroupv06[BioFormats2RawAttrs]

An OME-Zarr bioformats2raw dataset.

Warnings

It is not recommended to write new bioformats2raw groups. bioformats2raw is designed to support existing legacy data, and will be superseded by other OME-Zarr features in the future.

Notes

Currently this class does not offer a way to access OME-XML metadata. Please comment on issue #374 if you would find accessing OME-XML metadata useful.

Attributes:

Name Type Description
zarr_format Literal[3]
node_type Literal['group']
attributes BaseZarrAttrs[BioFormats2RawAttrs]
members Mapping[str, GroupSpec | ArraySpec] | None

image_paths

image_paths: list[str]

All paths to OME-Zarr images in this group.

images

images: dict[str, Image]

All images in this group.

Returns:

Type Description
images

Mapping from image path to Image object.

from_zarr

from_zarr(group: Group) -> Self

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

Parameters:

Name Type Description Default
group Group

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

required

ome_zarr_models.v06.HCS

Bases: BaseGroupv06[HCSAttrs]

An OME-Zarr high content screening (HCS) dataset.

Attributes:

Name Type Description
zarr_format Literal[3]
node_type Literal['group']
attributes BaseZarrAttrs[HCSAttrs]
members Mapping[str, GroupSpec | ArraySpec] | None

n_wells

n_wells: int

Number of wells.

well_groups

well_groups: Generator[Well, None, None]

Well groups within this HCS group.

Notes

Only well groups that exist are returned. This can be less than the number of wells defined in the HCS metadata if some of the well Zarr groups don't exist.

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

get_well_group

get_well_group(i: int) -> Well

Get a single well group.

Parameters:

Name Type Description Default
i int

Index of well group.

required

Raises:

Type Description
WellGroupNotFoundError

If no Zarr group is found at the well path.

ome_zarr_models.v06.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.ImageLabel

Bases: BaseGroupv06[ImageLabelAttrs]

An OME-Zarr image label dataset.

Attributes:

Name Type Description
zarr_format Literal[3]
node_type Literal['group']
attributes BaseZarrAttrs[ImageLabelAttrs]
members Mapping[str, GroupSpec | ArraySpec] | None

from_zarr

from_zarr(group: Group) -> Self

Create an instance of an OME-Zarr image from a zarr.Group.

Parameters:

Name Type Description Default
group Group

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

required

ome_zarr_models.v06.Labels

Bases: BaseGroupv06[LabelsAttrs]

An OME-Zarr labels dataset.

Attributes:

Name Type Description
zarr_format Literal[3]
node_type Literal['group']
attributes BaseZarrAttrs[LabelsAttrs]
members Mapping[str, GroupSpec | ArraySpec] | None

label_paths

label_paths: list[str]

List of paths to image-label groups within this labels group.

from_zarr

from_zarr(group: Group) -> Self

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

Parameters:

Name Type Description Default
group Group

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

required

get_image_labels_group

get_image_labels_group(path: str) -> ImageLabel

Get a image labels group at a given path.

ome_zarr_models.v06.Scene

Bases: BaseGroupv06[BaseSceneAttrs]

An OME-Zarr container group.

This is a group that stores a series of other multiscale images, along with additional coordinate transformations and coordinate systems.

Attributes:

Name Type Description
zarr_format Literal[3]
node_type Literal['group']
attributes BaseZarrAttrs[BaseSceneAttrs]
members Mapping[str, GroupSpec | ArraySpec] | None

images

images: dict[str, Image]

Mapping from path to image.

from_zarr

from_zarr(group: Group) -> Self

Create an OME-Zarr scene from a zarr.Group.

Parameters:

Name Type Description Default
group Group

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

required

new

new(*, images: dict[str, Image], coord_transforms: Sequence[AnyTransform] = (), coord_systems: Sequence[CoordinateSystem] = ()) -> Scene

Create a new Scene from a sequence of images and coordinate metadata.

Parameters:

Name Type Description Default
images dict[str, Image]

A dictionary mapping image names to Image objects. The keys are the paths to the images within the scene.

required
coord_transforms Sequence[AnyTransform]

Coordinate transforms to add to this scene.

()
coord_systems Sequence[CoordinateSystem]

Coordinate systems to add to this scene.

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

Bases: BaseGroupv06[WellAttrs]

An OME-Zarr well dataset.

Attributes:

Name Type Description
zarr_format Literal[3]
node_type Literal['group']
attributes BaseZarrAttrs[WellAttrs]
members Mapping[str, GroupSpec | ArraySpec] | None

from_zarr

from_zarr(group: Group) -> Self

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

Parameters:

Name Type Description Default
group Group

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

required