Skip to main content

PyPI PyPI - Python Version codecov Ruff Checked with mypy License

ome-tiled

An adapter for tiled that serves OME-Zarr images as arrays with their axis names, which tiled's own Zarr adapter leaves out.

Install

With uv (recommended):

uv add ome-tiled

With pip:

pip install ome-tiled

Install it on the server, and also wherever tiled register runs: registering opens each store through the adapter on the registering side.

To write Bluesky runs into a catalog with bluesky-tiled-plugins, install the bluesky extra: uv add "ome-tiled[bluesky]".

Usage

Serve a directory, letting ome-tiled find the OME-Zarr stores in it:

tiled serve directory data/ \
    --adapter application/x-ome-zarr=ome_tiled:OmeZarrAdapter \
    --mimetype-hook ome_tiled:detect

Each image then reads as one array whose dims are its axis names:

from tiled.client import from_uri

client = from_uri("http://localhost:8000", api_key="...")
client["stack"].structure().dims  # ('t', 'z', 'y', 'x')

The hook recognizes a store by its metadata, whatever it is called. Stores named *.ome.zarr can be routed by name instead, with --ext .ome.zarr=application/x-ome-zarr in place of --mimetype-hook.

From a configuration file

Register the adapter in the server's configuration:

# config.yml
trees:
  - tree: catalog
    path: /
    args:
      uri: ./catalog.db
      init_if_not_exists: true
      readable_storage:
        - data/
      adapters_by_mimetype:
        application/x-ome-zarr: ome_tiled:OmeZarrAdapter

Then start the server and register the directory:

tiled serve config config.yml --api-key secret
tiled register http://localhost:8000 data/ --api-key secret \
    --adapter application/x-ome-zarr=ome_tiled:OmeZarrAdapter \
    --mimetype-hook ome_tiled:detect

From Python

from tiled.catalog import from_uri

catalog = from_uri(
    "catalog.db",
    readable_storage=["data/"],
    init_if_not_exists=True,
    adapters_by_mimetype={"application/x-ome-zarr": "ome_tiled:OmeZarrAdapter"},
)

tiled.server.simple.SimpleTiledServer takes no adapters, so add the adapter to its catalog after starting the server and before registering anything:

from tiled.server.simple import SimpleTiledServer

from ome_tiled import OME_ZARR_MIMETYPE, OmeZarrAdapter

server = SimpleTiledServer(readable_storage=["data/"])
server.catalog.context.adapters_by_mimetype.maps[0][OME_ZARR_MIMETYPE] = OmeZarrAdapter

Registering by hand

tiled answers a registered node's structure and metadata from its database, so a registration made with client.new has to store the adapter's own, or the node reads without its axis names:

from tiled.structures.core import StructureFamily
from tiled.structures.data_source import Asset, DataSource, Management

from ome_tiled import OME_ZARR_MIMETYPE, OmeZarrAdapter

uri = "file:///data/stack.ome.zarr"
adapter = OmeZarrAdapter.from_uris(uri)
client.new(
    key="stack",
    structure_family=StructureFamily.array,
    data_sources=[
        DataSource(
            management=Management.external,
            mimetype=OME_ZARR_MIMETYPE,
            structure_family=StructureFamily.array,
            structure=adapter.structure(),
            assets=[Asset(data_uri=uri, is_directory=True, parameter="data_uri")],
        )
    ],
    metadata=dict(adapter.metadata()),
    specs=[],
)

The URI may name the image group or its full-resolution array; both read the same way.

Writing runs with TiledWriter

bluesky-tiled-plugins' TiledWriter registers each data key of a run from its StreamResource document, with a structure computed from the documents: the number of rows times the shape of each. A detector writing a multidimensional OME-Zarr store frame by frame describes a stack of frames, which is not the shape of the store, and the node cannot be read. Registering the consolidator this package provides makes TiledWriter store the image as the store holds it, with its shape, chunks and axis names:

from bluesky import RunEngine
from bluesky_tiled_plugins import TiledWriter
from tiled.client import from_uri

from ome_tiled.bluesky import register_consolidator

register_consolidator()
RE = RunEngine()
RE.subscribe(TiledWriter(from_uri("http://localhost:8000", api_key="...")))

The detector's StreamResource gives application/x-ome-zarr as the mimetype and the store, or its image, as the URI. The server needs OmeZarrAdapter registered for that mimetype, as above.

What it reads

  • NGFF 0.4 and 0.5 images and label images, validated with yaozarrs. The axes, with their types and units, are under axes in the node's metadata.
  • A Zarr group holding several such images, each presented as its own array.
  • The full-resolution level only. Pyramids read at level 0.

Anything else is served as tiled's Zarr adapter serves it, with a log line saying why: other NGFF layouts such as bioformats2raw series, plates, wells and label groups, and any group whose NGFF metadata fails validation. Validation is strict, so a file that breaks the NGFF specification, for example a dataset without coordinateTransformations, reads as plain Zarr rather than as an image.

Axes of a custom kind, such as a scan pattern, keep their names too. NGFF orders axes as time, then channel or custom, then space, so a file that puts a custom axis after the spatial ones fails validation and reads as plain Zarr.

More

The tiled documentation explains adapters, mimetypes and detection hooks in more detail: Serve Files with Custom Formats.

License

Apache License 2.0. See LICENSE.

Release files for ome-tiled 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ome-tiled 0.2.0
File Size Uploaded
ome_tiled-0.2.0.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ome-tiled 0.2.0
File Interpreter ABI Platform
ome_tiled-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size:23.9 kB

Release files / ome_tiled-0.2.0.tar.gz

Download URL ome_tiled-0.2.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
58765132cbcfc080f1b7e8da62cbc4328385e7e8d093b50fab9de18535b27b92
BLAKE2b-256 checksum
How to use checksums
617f236e1e3a5a56620c8c5c8a65967f7db2d1599dd3f2f6b35fd08e2a649446
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / ome_tiled-0.2.0-py3-none-any.whl

Download URL ome_tiled-0.2.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6f20110fae43e54c042abc86be12fc79dc94ea50c5cc560a2e5d511860c3dfa
BLAKE2b-256 checksum
How to use checksums
074a611ffbcf257afcf0da03bcc9f4dc02aef3dbecd88047e1cfacee5c53b58b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page