Skip to main content

Convert any bioimage file to OME-Zarr v0.5, preserving metadata.

Project description

zarrmony

PyPI version Python versions License CI

Convert any bioimage file to OME-Zarr v0.5, preserving metadata.

Zarrmony reads proprietary microscopy formats (CZI, LIF, ND2, OME-TIFF, ...) via bioio and writes them as OME-Zarr v0.5, with a configurable user-metadata gate, mean-pool pyramid generation, and a full audit trail of the conversion.

By default (--layout auto) the writer is chosen from the reader's layout_hint: a flat reader writes one self-describing <scene>.ome.zarr store per scene under the output directory; a plate-shaped reader writes a single OME-NGFF HCS plate store at the output. The legacy bundled bioformats2raw.layout shape is opt-in via --layout bf2raw (CLI) or layout="bf2raw" (library).

Status: v0.3 in active development. API and metadata schema are not yet stable.

Install

pip install zarrmony

Optional extras:

Extra Adds When you need it
gcs gcsfs Writing output to gs:// URIs
s3 s3fs Writing output to s3:// URIs
ome-tiff bioio-ome-tiff Reading OME-TIFF input
all All of the above
dev pytest, ruff, pre-commit Contributing

CZI, LIF, and ND2 reader plugins are included by default.

Usage

CLI

# Auto (default): dispatches on the reader's layout_hint.
#   flat readers (CZI, LIF, ND2, OME-TIFF) → per-scene stores under OUTPUT
#   plate-shaped readers (e.g. zarrmony-phenix) → a single HCS plate store at OUTPUT
zarrmony convert input.czi output_dir/ --metadata-file metadata.json

# Force per-scene (one <scene>.ome.zarr store per scene under OUTPUT).
zarrmony convert input.czi output_dir/ --layout per-scene --metadata-file metadata.json

# Force HCS plate (one <plate>.ome.zarr store at OUTPUT). Requires a
# plate-shaped reader; flat readers raise LayoutMismatchError.
zarrmony convert phenix-acquisition/ output.ome.zarr --layout plate --metadata-file metadata.json

# Bundled bioformats2raw.layout (opt-in): writes a single store at OUTPUT.
zarrmony convert input.czi output.ome.zarr --layout bf2raw --metadata-file metadata.json

zarrmony inspect input.czi
zarrmony schema dump > zarrmony-metadata.schema.json

Library

from zarrmony import convert, UserMetadata

# Auto (default): for a flat reader, returns {"input": ..., "stores": [...]};
# for a plate-shaped reader, returns the single plate audit dict (schema 3,
# with "fields" and a top-level "plate" block). Switch on audit["layout"].
result = convert(
    "input.lif",
    "output_dir/",
    metadata=UserMetadata(...),
)

# Bundled: returns the single bundle's audit dict.
audit = convert(
    "input.lif",
    "output.ome.zarr",
    layout="bf2raw",
    metadata=UserMetadata(...),
)

# HCS plate: writes one OME-NGFF plate store at OUTPUT.
audit = convert(
    "phenix-acquisition/",
    "output.ome.zarr",
    layout="plate",
    metadata=UserMetadata(...),
    per_well_metadata={"B04": {"treatment": "control"}, "C05": {"treatment": "drug-X"}},
)

Extending zarrmony

Add support for a new bioimage format by writing a reader plugin. See Writing a zarrmony reader plugin for the Reader Protocol, matcher conventions, entry-point registration, and a worked example.

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zarrmony-0.3.4.tar.gz (360.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zarrmony-0.3.4-py3-none-any.whl (43.8 kB view details)

Uploaded Python 3

File details

Details for the file zarrmony-0.3.4.tar.gz.

File metadata

  • Download URL: zarrmony-0.3.4.tar.gz
  • Upload date:
  • Size: 360.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zarrmony-0.3.4.tar.gz
Algorithm Hash digest
SHA256 9bf252cb816d69373aad2e1e6a41dd47efda427832273a7c42695cc0fa6571f2
MD5 a37d6ae2af8df2c1fbd16451b167677f
BLAKE2b-256 09c114f52f99d35fc5a48a40f397976ccfbdd527c167a7c0994723a2fa358043

See more details on using hashes here.

Provenance

The following attestation bundles were made for zarrmony-0.3.4.tar.gz:

Publisher: release.yml on ferrinm/zarrmony

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zarrmony-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: zarrmony-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 43.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zarrmony-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8d2d8e1d7f7aabd87cf04aa164d6bb2fcafea36b7865e4a02e7b74a5a13f81b5
MD5 1fa8e08e0d1d7f3c05f11f675b2e6644
BLAKE2b-256 8175b30f831c0f3342bd7fc0199f140e04fe49e0f930715b78fe01615fb4b832

See more details on using hashes here.

Provenance

The following attestation bundles were made for zarrmony-0.3.4-py3-none-any.whl:

Publisher: release.yml on ferrinm/zarrmony

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page