BossDB Labs: Zarr

This is an implementation of the Zarr N5 specification and OME-Zarr specification for the BossDB spatial database.

Zarr is a growing standard for interacting with large volumetric datasets. Here, we implement Zarr data access backed by BossDB. Data requests are proxied to the BossDB API (https://api.bossdb.io). This allows users to interact with BossDB data through the standard N5 or OME interfaces, which improves tool interoperability.

Installation

uv sync 

Usage

uv run app.py

Consider accessing the N5 or OME Zarr data with Neuroglancer by creating a channel with the following source:

n5://http://localhost:5020/api/witvliet2020/Dataset_1/em
zarr://http://localhost:5020/ome/witvliet2020/Dataset_1/em

Endpoint Overview

See bossdbzarr/endpoints.py for more details.

Get Top Level Attributes (N5)

GET /api/<collection>/<experiment>/<channel>/attributes.json

Response

{
    "pixelResolution": {
        "dimensions": [*voxel_shape, 1],
        "unit": "nm",
    },
    "ordering": "C",
    "scales": [[2**s, 2**s, 1, 1] for s in range(4)],
    "axes": ["x", "y", "z", "c"],
    "units": ["nm", "nm", "nm", ""],
    "translate": [0, 0, 0, 0],
}

Get Scale Attributes

GET /api/<collection>/<experiment>/<channel>/s<int:scale>/attributes.json

Response

{
    "transform": {
        "ordering": "C",
        "axes": ["x", "y", "z", "c"],
        "scale": [
            2**scale,  # * 2**scale,
            2**scale,  # * 2**scale,
            2**scale,
            1,
        ],
        "units": ["nm", "nm", "nm"],  # TODO
        "translate": [0.0, 0.0, 0.0],
    },
    "compression": {"type": "gzip", "useZlib": False, "level": -1},
    "blockSize": [*BLOCK_SIZE.tolist(), 1],
    "dataType": dtype,
    "dimensions": [*shape[::-1], 1],
}

Get Chunk

GET /api/<collection>/<experiment>/<channel>/s<int:scale>/<int:chunk_x>/<int:chunk_y>/<int:chunk_z>/<int:chunk_c>

Response

(Encoded Zarr Gzip data)

Get Top Level Attributes (OME)

See bossdbzarr/ome_endpoints.py for more details.

GET /ome/<collection>/<experiment>/<channel>/.zgroup

GET /ome/<collection>/<experiment>/<channel>/.zattrs

GET /ome/<collection>/<experiment>/<channel>/<int:scale>/.zarray

GET /ome/<collection>/<experiment>/<channel>/<int:scale>/.zattrs

GET /ome/<collection>/<experiment>/<channel>/<int:scale>/<path:chunk_key>


Made with 💙 at JHU APL