Skip to content

Zarr models

biomero_schema.zarr

Cross-service schemas for BIOMERO-managed Zarr data.

These models describe portable records exchanged by BIOMERO services. They do not implement canonical storage, OMERO access, workflow events, or Zarr I/O.

ZarrContractModel

Bases: BaseModel

Base configuration shared by the Zarr interchange contracts.

to_dict

to_dict() -> dict[str, Any]

Return the stable camelCase wire representation.

from_dict classmethod

from_dict(value: Mapping[str, Any])

Validate a wire representation.

PixelIdentity

Bases: ZarrContractModel

Resolution-specific ISCC-BIO fingerprint and full-image semantic guard.

Missing/old profiles are readable for cache invalidation only. They are not evidence under the current comparison policy.

schema property

schema: int

Wire schema version (kept distinct from workflow schema versions).

CanonicalZarrSource

Bases: ZarrContractModel

Managed locator for a verified canonical Zarr representation.

schema property

schema: int

Wire schema version (kept distinct from workflow schema versions).

to_annotation_values

to_annotation_values() -> dict[str, str]

Encode the record for an OMERO MapAnnotation value map.

from_annotation_values classmethod

from_annotation_values(values: Mapping[str, str]) -> CanonicalZarrSource

Decode and validate an OMERO MapAnnotation value map.

ManagedZarrNode

Bases: ZarrContractModel

Stable managed locator for one physical NGFF image or label node.

ZarrLabelComponent

Bases: ZarrContractModel

One logical label layer and, when inherited, its managed source.

source is absent only while the label pixels are stored locally in the collection that owns this record. A workflow input snapshot always uses a managed source because its reconstructed transfer artifact is temporary.

CanonicalPlateImage

Bases: ZarrContractModel

One image-level node and its labels within a canonical Plate Zarr.

CanonicalPlateSource

Bases: ZarrContractModel

Managed canonical Plate Zarr with independently identified image nodes.

CanonicalPlateIndex

Bases: ZarrContractModel

Compact Plate-level index for split OMERO canonical annotations.

CanonicalPlateImageRecord

Bases: ZarrContractModel

One bounded image-node record belonging to a compact Plate index.

CanonicalPlateLabelRecord

Bases: ZarrContractModel

One bounded label-node record belonging to a compact Plate index.

CanonicalInput

Bases: ZarrContractModel

One selected OMERO object and the exact canonical generation exported.

schema property

schema: int

Wire schema version (kept distinct from workflow schema versions).

CanonicalInputManifest

Bases: ZarrContractModel

Recovery manifest for the canonical inputs exported for one workflow.

schema property

schema: int

Wire schema version (kept distinct from workflow schema versions).

ShallowImageNode

Bases: ZarrContractModel

One logical source-image node in a shallow result collection.

ShallowLabelNode

Bases: ZarrContractModel

One logical label node derived from a source-image node.

ShallowCollection

Bases: ZarrContractModel

Portable scientific relationships in a BIOMERO shallow result.

This graph deliberately excludes managed roots, OMERO identifiers, pixel identities and workflow receipts. It is not RFC-8 metadata; adapters can project the graph to a standards representation when that representation is supported by the selected NGFF profile.

ShallowImageBinding

Bases: ZarrContractModel

BIOMERO storage and identity binding for one logical image node.

ShallowLabelBinding

Bases: ZarrContractModel

BIOMERO storage and identity binding for one logical label node.

ShallowBindings

Bases: ZarrContractModel

Operational bindings kept separate from the scientific graph.

ShallowManifest

Bases: ZarrContractModel

Versioned BIOMERO storage manifest for one shallow result.

image_binding

image_binding(node_id: str) -> ShallowImageBinding

Return the unique operational binding for an image node.

label_bindings_for_image

label_bindings_for_image(image_id: str) -> tuple[ShallowLabelBinding, ...]

Return label bindings related to one image, in graph order.

ShallowPlateReference

Bases: ZarrContractModel

Managed locator attached to a derived OMERO shallow Plate.

The compact Plate-level annotation indexes the authoritative collection manifest without repeating every per-image pixel identity in OMERO. Consumers must load and validate that manifest before reconstruction.

ZarrImportOptions

Bases: ZarrContractModel

Optional per-order controls for registering a BIOMERO Zarr result.

ShallowZarrReference

Bases: ZarrContractModel

Managed locator attached to one OMERO image or label-image projection.

The referenced collection remains the authority. Consumers must load its sidecar and verify that this image/label/source tuple is still present before materializing data.

to_annotation_values

to_annotation_values() -> dict[str, str]

Encode the reference for an OMERO MapAnnotation value map.

from_annotation_values classmethod

from_annotation_values(values: Mapping[str, str]) -> ShallowZarrReference

Decode and validate an OMERO MapAnnotation value map.

from_manifest classmethod

from_manifest(manifest: ShallowManifest, *, storage_root: str, relative_path: str, image_node_path: str, label_node_paths: tuple[str, ...] | None = None) -> ShallowZarrReference

Create a projection reference and require collection membership.

ShallowNodePointer

Bases: ZarrContractModel

The biomero attribute that links a shallow image node to its manifest.

BIOMERO.shallower writes this object as the biomero attribute of every image node's NGFF attributes (.zattrs, or attributes.ome in zarr.json) when it replaces the node's multiscales with a pointer to .biomero-shallow.json. The pointer has no schema field on the wire and gaining one would break existing readers, which forbid unknown fields; format names the layout and the manifest it points to carries the contract schema.

The schema-1 pointer (model: rfc8-shallow-copy instead of format) is deliberately not accepted: such a store must be migrated by BIOMERO.shallower before anything else reads it.

Attributes:

Name Type Description
format str

Always biomero-shallow-zarr; defaults to it.

manifest str

Always .biomero-shallow.json, the manifest file in the store root; defaults to it.

workflow_id UUID

The workflow the shallow store belongs to.

from_manifest classmethod

from_manifest(manifest: ShallowManifest) -> ShallowNodePointer

Build the pointer that BIOMERO.shallower writes for a manifest.

Parameters:

Name Type Description Default
manifest ShallowManifest

The manifest the pointer refers to.

required

Returns:

Name Type Description
ShallowNodePointer ShallowNodePointer

The pointer for the manifest's workflow.

CanonicalMarker

Bases: ZarrContractModel

The commit marker of a canonical Zarr store.

BIOMERO.importer writes it as .biomero-canonical.json in the root of a canonical store, or as a sidecar file for a Zarr indexed in place. It records the full source (including every per-node pixel identity of a Plate) behind the compact OMERO annotation. Its version field is markerSchema, not schema, because it predates the shared naming; the wrapped source carries its own schema.

Attributes:

Name Type Description
marker_schema int

Version of this wrapper.

state str

Always committed; a store without a committed marker is not adopted.

source CanonicalZarrSource | CanonicalPlateSource

What the store is.

RFC-8 draft projection

biomero_schema.rfc8

Projection boundary for the early OME-NGFF RFC-8 v1 draft.

RFC-8 v1 (2026-08) is not an adopted OME-NGFF specification. This module projects BIOMERO's format-independent collection graph into the draft shape so that alignment can be tested without making draft metadata authoritative or claiming that NGFF 0.4 / Zarr v2 stores are RFC-8 compliant.

Rfc8DraftPath

Bases: ZarrContractModel

A path accepted by the RFC-8 v1 draft projection.

project_rfc8_v1_draft

project_rfc8_v1_draft(manifest: ShallowManifest, *, ome_version: str, image_paths: Mapping[str, Rfc8DraftPath], label_paths: Mapping[str, Rfc8DraftPath]) -> dict

Project a shallow graph into the RFC-8 v1 draft collection shape.

Callers provide paths because BIOMERO managed-storage bindings are not portable RFC paths. Production writers must not use this projection until the selected NGFF profile and referenced stores support the accepted collections specification.