A napari interface to the bilayers ecosystem.
WARNING: Extremely alpha level software
Scientific reproducibility is hard. To fully reproduce an analysis, you might need to run unmaintained code, relying on outdated libraries, on an old version of an operating system. Bilayers is a mechanism to encapsulate algorithms in a Docker container then access those algorithms from popular image analysis software. This plugin allows you to access those tools from napari.
Clone the current version of napari bilayers from github:
git clone https://github.com/david-a-joy/napari-bilayers
cd napari-bilayers/
We recommend installing napari-bilayers into a virtual environment using an environment manager like uv. To create a basic virtual environment:
uv venv --python 3.13
uv add pip
source .venv/bin/activate
Next, install napari with the qt backend (other backends might also work):
pip install 'napari[qt]'
Finally, install napari-bilayers:
pip install .
Launch napari and the bilayers plugin should be available under the Plugins > Bilayers menu.
Clone the bilayers repository then select which algorithm you'd like to use under bilayers/src/algorithms. For instance to build a plugin for the classical_segmentation image, run:
scripts/build_docker.py bilayers/src/algorithms/classical_segmentation
This script will first build the algorithm base image, then build the napari bilayers interface on top of it.
Launch the image with the scripts/start_docker.py script. For instance, to launch the classical_segmentation image, run:
scripts/start_docker.py napari_bilayers_classical_segmentation
This will launch a local image that listens on port 7878. Connect to this port to access the image from napari-bilayers. When you connect, the UI will be populated with controls to adjust the algorithm parameters.
The best test image to use is the File > Sample > human mitosis example.
Load that image, make sure it's selected in the image dropdown, then press Run.
The segmented result will be added back as a new napari layer.
The plugin comes with some basic unittests. To run the tests, install the test requirements:
pip install '.[test]'
Then run the tests in the test folder with:
python -m pytest tests/