Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 2.16 KB

README.md

File metadata and controls

34 lines (22 loc) · 2.16 KB

Example Virtual N5

Example service showing how to host a virtual N5, suitable for browsing in neuroglancer.

Neuroglancer is capable of browsing N5 files, as long as you store them on disk and then host those files over http (with a CORS-friendly http server). But what if your data doesn't exist on disk yet?

This server hosts a "virtual" N5. Nothing is stored on disk, but neuroglancer doesn't need to know that. This server provides the necessary attributes.json files and chunk files on-demand, in the "locations" (url patterns) that neuroglancer expects.

For simplicity, this file uses Flask. In a production system, you'd probably want to use something snazzier, like FastAPI.

To run the example, install a few dependencies:

conda create -n example-virtual-n5 -c conda-forge zarr flask flask-cors
conda activate example-virtual-n5

Then just execute the file:

python example_virtual_n5.py

Or, for better performance, use a proper http server:

conda install -c conda-forge gunicorn
gunicorn --bind 0.0.0.0:8000 --workers 8 --threads 1 example_virtual_n5:app

You can browse the data in neuroglancer after configuring the viewer with the appropriate layer settings.