cellmap_flow.serving.virtual_zarr
The zarr v2 array an inference server makes up, as data.
A server serves one model’s output as <dataset>/.zattrs,
<dataset>/s0/.zarray and <dataset>/s0/<z>.<y>.<x>[.<c>] chunks, which
neuroglancer reads as an OME-NGFF 0.4 group with one level. What those say,
and which region each chunk key is, is plain arithmetic on the model’s
geometry and the raw data’s; these functions are that arithmetic, with no
Flask and no process-wide state, so the server’s routes only call them.
Every client reads this format, including dashboards older than the server, so it changes only additively.
Attributes
Functions
|
The group's OME-NGFF attributes: one level, s0, at the output voxel size. |
|
The array's zarr v2 metadata. |
|
Output voxels from |
|
The region (nm) chunk |
|
|
|
The codec for the chunks, as |
Module Contents
- cellmap_flow.serving.virtual_zarr.logger
- cellmap_flow.serving.virtual_zarr.BLOSC
- cellmap_flow.serving.virtual_zarr.zattrs(axes, output_voxel_size, origin, has_channel: bool, name: str) dict
The group’s OME-NGFF attributes: one level, s0, at the output voxel size.
axesare the spatial axes,originthe lower corner of output voxel 0 in nm; OME writes voxel 0’s centre, so neuroglancer draws voxel 0 at the origin. A channel axis comes last, with scale 1 and translation 0.
- cellmap_flow.serving.virtual_zarr.zarray(shape, chunks, dtype) dict
The array’s zarr v2 metadata.
dtypeis anything np.dtype takes; its typestr is written (“<f4”, “|u1”, …).
- cellmap_flow.serving.virtual_zarr.served_spatial_shape(raw_offset, raw_shape, raw_voxel_size, origin, output_voxel_size) list
Output voxels from
originto the end of the raw data, rounded up.
- cellmap_flow.serving.virtual_zarr.chunk_roi(index, spatial_block, output_voxel_size, origin) funlib.geometry.Roi
The region (nm) chunk
indexcovers:spatial_blockoutput voxels per chunk, the grid starting atorigin.
- cellmap_flow.serving.virtual_zarr.reorder_to_zarr_axes(data, model_axes, spatial_axes) numpy.ndarray
data, laid out asmodel_axes, in zarr’s order: the spatial axes, then “c”.
- cellmap_flow.serving.virtual_zarr.chunk_encoder() numcodecs.Blosc
The codec for the chunks, as
BLOSCdescribes it.