Skip to main content

Crate openreadout_omezarr

Crate openreadout_omezarr 

Source
Expand description

OME-Zarr writer: OME-NGFF 0.5 on Zarr v3 (via the pure-Rust zarrs crate).

Every image becomes a multiscales group with 5-D arrays in t, c, z, y, x order, one array per resolution level (2×2 mean pyramid), plus omero channel display metadata. A single exported image is written at the root of the store, with an OME/ group holding METADATA.ome.xml (objective, instrument and channel details OME-NGFF has no place for); several images become a bioformats2raw.layout collection (0/, 1/, … plus an OME/ group listing the series and holding METADATA.ome.xml). A multi-well plate (a high-content screening plate, openreadout_core::plate) becomes an OME-NGFF HCS plate: <row>/<column>/<field> image groups under plate and well metadata.

The store is written to a temporary directory next to the output, every level-0 plane is read back through zarrs and hash-compared with the source plane, and only then is the directory renamed into place. The source file is never opened for writing.

OME-Zarr (OME-NGFF) is the cloud-friendly successor of OME-TIFF: a directory of small compressed chunks plus JSON metadata, readable by napari, ome-zarr-py, bioio and web viewers.

§Example

use std::path::Path;

use openreadout_core::{Dataset, Result};
use openreadout_omezarr::{ZarrExportOptions, default_output, export_ome_zarr};

/// Write an opened file next to its input as `<stem>.ome.zarr`, with 256-pixel chunks.
fn to_ome_zarr(dataset: &mut dyn Dataset, input: &Path) -> Result<()> {
    let mut options = ZarrExportOptions::default();
    options.chunk = 256;
    let report = export_ome_zarr(dataset, input, &default_output(input), &options)?;
    println!("{} planes in {}", report.planes_written, report.output);
    Ok(())
}

Structs§

ZarrExportOptions
OME-Zarr export options.

Enums§

PyramidMode
Where the lower resolutions of an export come from.

Constants§

DEFAULT_CHUNK
Default chunk edge (y and x) in pixels.

Functions§

default_output
Default output path for input: same directory, <stem>.ome.zarr.
export_ome_zarr
Export ds (already opened from input) to an OME-Zarr store (a directory) at output.
export_ome_zarr_with
export_ome_zarr with parallel plane decoding and progress reporting (planes are decoded by worker threads and written in the same order whatever the thread count).