BossDB Labs: Zarr

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

N5 is a growing standard for interacting with large volumetric datasets. Here, we implement the N5 standard 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 interface, which improves tool interoperability.

Installation

poetry install

Usage

poetry run serve

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

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

Endpoint Overview

See bossdbzarr/endpoints.py for more details.

Get Top Level Attributes

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)

Made with 💙 at JHU APL