ngff_zarr.rfc9_zip¶
RFC-9: Zipped OME-Zarr (.ozx) support
This module provides utilities for reading and writing OME-Zarr hierarchies in ZIP archives according to RFC-9 specification.
Module Contents¶
Functions¶
Check if a path refers to a .ozx file. |
|
Write a zarr store to a ZIP archive following RFC-9 specification. |
|
Read the OME-Zarr version from a .ozx file’s ZIP comment. |
|
Read the jsonFirst flag from a .ozx file’s ZIP comment. |
API¶
- ngff_zarr.rfc9_zip.is_ozx_path(path: Union[str, pathlib.Path]) bool¶
Check if a path refers to a .ozx file.
Parameters
path : str or Path Path to check
Returns
bool True if path ends with .ozx extension
- ngff_zarr.rfc9_zip.write_store_to_zip(
- source_store: Union[zarr.storage.StoreLike, str, pathlib.Path],
- zip_path: Union[str, pathlib.Path],
- version: str = '0.5',
- compression: int = zipfile.ZIP_STORED,
Write a zarr store to a ZIP archive following RFC-9 specification.
According to RFC-9:
Root-level zarr.json must be the first entry
Other zarr.json files should follow in breadth-first order
ZIP-level compression should be disabled (ZIP_STORED)
ZIP64 format should be used
A comment with OME-Zarr version should be added
This function can be used to convert any existing zarr store (including HCS plates) to .ozx format after it has been written.
Parameters
source_store : zarr.storage.StoreLike, str, or Path Source zarr store to write from. Can be a store object (LocalStore, DirectoryStore) or a path string to a directory containing zarr data. zip_path : str or Path Path to output .ozx file version : str, optional OME-Zarr version string (e.g., “0.5”) compression : int, optional ZIP compression method (default: ZIP_STORED for no compression)
Examples
Convert an existing HCS plate to .ozx:
from ngff_zarr.rfc9_zip import write_store_to_zip
After writing plate with to_hcs_zarr or HCSPlateWriter
write_store_to_zip(“my_plate.ome.zarr”, “my_plate.ozx”, version=”0.5”)
- ngff_zarr.rfc9_zip.read_ozx_version(
- zip_path: Union[str, pathlib.Path],
Read the OME-Zarr version from a .ozx file’s ZIP comment.
Parameters
zip_path : str or Path Path to the .ozx file
Returns
str or None OME-Zarr version string if found, None otherwise
- ngff_zarr.rfc9_zip.read_ozx_json_first(zip_path: Union[str, pathlib.Path]) bool¶
Read the jsonFirst flag from a .ozx file’s ZIP comment.
The jsonFirst flag indicates that zarr.json files are ordered breadth-first in the central directory and precede other content.
Parameters
zip_path : str or Path Path to the .ozx file
Returns
bool True if jsonFirst is set to true in the ZIP comment, False otherwise