Skip to content

lucem_hist::output

Where an analysis is stored, and how: next to the pixels it was made from.

  • Where: inside the image’s own OME-Zarr when it is one and can be written (labels where other viewers look for them), else <fallback>/<image>.lucem.zarr.
  • What:
    • labels/cells, labels/nuclei: label images (OME-Zarr labels, multiscale, u32; each object its id), rasterised chunk by chunk in parallel;
    • lucem/cells.parquet (and tiles.parquet): one row per object — id, kind, class, intensity class, region, position (px, µm), then every measurement — Arrow / Parquet, read by Polars, PyArrow, pandas, DuckDB;
    • lucem/shapes.parquet: GeoParquet (WKB polygons with the geo metadata): the objects’ outlines and nuclei, and the regions;
    • lucem/provenance.json: the session (every step and its parameters) and the versions.
pub struct RegionShape<'a>

A region of the image for the shapes table.

Fields

  • id: &'a str
  • class: &'a str
  • outline: &'a [[f64; 2]]
pub fn store_for(image: &Path, name: &str, fallback: &Path) -> PathBuf

The store of an image: its own OME-Zarr when writable, else under fallback.

pub fn write_objects(
store: &Path,
name: &str,
objects: &[HistObject],
region: &[Option<String>],
pixel_um: f64,
) -> HistResult<PathBuf>

Writes lucem/<name>.parquet: the objects and their measurements (region: each object’s region, None the image).

pub fn write_shapes(
store: &Path,
objects: &[HistObject],
regions: &[RegionShape<'_>],
) -> HistResult<PathBuf>

Writes lucem/shapes.parquet (GeoParquet 1.1, WKB, level-0 pixel coordinates): every object’s outline (cell, tile) and nucleus, and the regions.

pub fn write_labels(
store: &Path,
name: &str,
objects: &[HistObject],
nucleus: bool,
(width, height): (usize, usize),
pixel_um: Option<f64>,
) -> HistResult<PathBuf>

Writes labels/<name>: an OME-Zarr label image of the objects (nucleus: their nuclei, else their outlines), width × height level-0 pixels, chunks of 1024 rasterised in parallel.

pub fn write_provenance(store: &Path, provenance: &Value) -> HistResult<PathBuf>

Writes lucem/provenance.json.

pub fn ensure_group(store: &Path) -> HistResult<()>

Creates the fallback store’s group when it is not the image’s own.