neu_vol.ngff

OME-NGFF 0.5 multiscale group metadata.

TensorStore writes the per-level array data; this module writes the group-level multiscales metadata that ties those arrays into an OME-Zarr pyramid. The attribute schema ({"ome": {"version": "0.5", "multiscales": [...]}}) matches what ngff-zarr emits, and can be validated with validate_attrs() (needs the jsonschema dep).

Functions

build_dataset(path, scale, translation) → dict[str, Any]

One multiscales.datasets entry (scale then translation transforms).

build_multiscales_attrs(*, axis_names, axis_types, ...) → dict[str, Any]

Assemble the OME-NGFF 0.5 group attributes dict.

ome_unit(units) → str | None

validate_attrs(attrs, *[, strict]) → None

Validate against the OME-NGFF 0.5 image schema (raises on failure).

write_group_metadata(kvstore, attrs) → None

Write the group zarr.json (node_type=group) with attrs to kvstore.

Module Contents

neu_vol.ngff.build_dataset(path: str, scale: Sequence[float], translation: Sequence[float]) → dict[str, Any]

One multiscales.datasets entry (scale then translation transforms).

neu_vol.ngff.build_multiscales_attrs(*, axis_names: Sequence[str], axis_types: Sequence[str], axis_units: Sequence[str | None], datasets: Sequence[Mapping[str, Any]], name: str = 'image', method_type: str | None = None) → dict[str, Any]

Assemble the OME-NGFF 0.5 group attributes dict.

axis_* and each dataset’s transforms must span all axes in order (channel axis included, with scale 1 / translation 0).

neu_vol.ngff.ome_unit(units: str | None) → str | None
neu_vol.ngff.validate_attrs(attrs: Mapping[str, Any], *, strict: bool = False) → None

Validate against the OME-NGFF 0.5 image schema (raises on failure).

neu_vol.ngff.write_group_metadata(kvstore: Mapping[str, Any], attrs: Mapping[str, Any]) → None

Write the group zarr.json (node_type=group) with attrs to kvstore.

kvstore is a TensorStore kvstore spec for the group path (e.g. {"driver": "file", "path": "/.../vol.zarr"}), so this works uniformly for file / s3 / gcs stores.