Skip to main content

OME-TIFF and OME-ZARR writer APIs designed for microscopy acquisition

Project description

ome-writers

License PyPI Python Version CI codecov

OME-TIFF and OME-ZARR writer APIs designed for microscopy acquisition.

This package provides a unified interface for writing OME-TIFF and OME-ZARR files, with various different backends. It is currently designed/optimized for "deterministic" use cases where the shape of the data is known ahead of time, and the data can be efficiently chunked and written in a predictable manner with a series of calls to stream.append(frame) as the data is generated.

Installation

pip install ome-writers

Or, include all optional dependencies for specific backends:

  • tensorstore: for tensorstore backend support
  • acquire-zarr: for acquire-zarr backend support
  • tiff: for tiff backend support using tifffile.
  • all: install all backends
pip install "ome-writers[all]"

Basic Usage

from ome_writers import Dimension, create_stream

# Configure the dimensions of the data stream
# The stream expects that data will be appended in the order and shape
# defined by the dimensions.
# labels must currently be one of 't', 'c', 'z', 'y', 'x', or 'p' (stage position).
dims = [
    Dimension(label="t", size=10, unit=(1.0, "s")),
    Dimension(label="c", size=3),
    Dimension(label="z", size=5, unit=(1.0, "um")),
    Dimension(label="y", size=512, unit=(1.0, "um"), chunk_size=128),
    Dimension(label="x", size=512, unit=(1.0, "um"), chunk_size=128),
]

stream = create_stream(
    "my_data.zarr",
    dimensions=dims,
    dtype='uint16',
    # backend may be any of
    # "acquire-zarr", "tensorstore", "tiff" (for ome-tiff) or "auto"
    backend="acquire-zarr"  
)

# Write data frame by frame, as it is generated by your application
for frame in ...:
    stream.append(frame)

# Flush any pending writes to disk
stream.flush()

Contributing

This is a work in progress; we absolutely welcome and appreciate contributions! If you have suggestions, improvements, or bug fixes, please open an issue or submit a pull request.

git clone https://github.com/pymmcore-plus/ome-writers.git
cd ome-writers

# setup env
uv sync

# test
uv run pytest

# lint
uv run pre-commit run -a

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

ome_writers-0.0.1b0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

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

ome_writers-0.0.1b0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file ome_writers-0.0.1b0.tar.gz.

File metadata

  • Download URL: ome_writers-0.0.1b0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ome_writers-0.0.1b0.tar.gz
Algorithm Hash digest
SHA256 fe83d7aec5eb36f08207412d33c0115b21ab1c76a538b9576da9daf185ec2c52
MD5 784d870dd998aa8c4f5ca382fb4013e8
BLAKE2b-256 3e40355cfb7c88c3e22aeffb3443c9846ae27de034a43de2945403db41d7252d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ome_writers-0.0.1b0.tar.gz:

Publisher: ci.yml on pymmcore-plus/ome-writers

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

File details

Details for the file ome_writers-0.0.1b0-py3-none-any.whl.

File metadata

  • Download URL: ome_writers-0.0.1b0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ome_writers-0.0.1b0-py3-none-any.whl
Algorithm Hash digest
SHA256 15ed1fdc1d30f216eb8ec2fda28addcf389e4c4996d08163385d7674b37fdcb5
MD5 4617513b2be05879caa6cfa31fed0106
BLAKE2b-256 98071f8a2cf08f15225b4815e4dee31cf5db794e55f47a9cbe4fedc26d36f6ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for ome_writers-0.0.1b0-py3-none-any.whl:

Publisher: ci.yml on pymmcore-plus/ome-writers

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