Getting Started
Installation
Optional extras
| Extra | Adds | Notes |
|---|---|---|
bioio |
bioio, bioio-tifffile |
TIFF and OME-Zarr file reading |
contours |
scipy |
Contour-only mask rendering |
sam |
ultralytics |
SAM segmentation (PyTorch required) |
all |
bioio + contours | Recommended for most users |
complete |
all + sam | Full install |
uv pip install "anybioimage[all]" # recommended
uv pip install "anybioimage[complete]" # includes SAM (Python 3.10–3.12)
SAM and Python 3.13+
SAM support requires PyTorch via ultralytics. Use Python 3.10–3.12 for SAM features.
Usage in Jupyter
Just evaluate the viewer in a cell — it renders inline like any other widget:
from anybioimage import BioImageViewer
from bioio import BioImage
viewer = BioImageViewer()
viewer.set_image(BioImage("image.tif"))
viewer
Usage in marimo
Wrap with mo.ui.anywidget() to make the widget reactive:
import marimo as mo
from anybioimage import BioImageViewer
from bioio import BioImage
viewer = BioImageViewer()
viewer.set_image(BioImage("image.tif"))
mo.ui.anywidget(viewer)
Reactive annotations
In marimo, annotation data is reactive. Any cell referencing widget.value will
re-run automatically when you draw or delete annotations.
Loading images
set_image accepts a numpy array or a BioImage object:
# NumPy array (2D, CYX, CZYX, or TCZYX)
viewer.set_image(np.array(...))
# BioImage — lazy loading, full 5D support
from bioio import BioImage
import bioio_tifffile, bioio_ome_zarr
viewer.set_image(BioImage("image.tif", reader=bioio_tifffile.Reader))
viewer.set_image(BioImage("image.zarr", reader=bioio_ome_zarr.Reader))
When a multi-dimensional image is loaded, sliders for T and Z appear automatically, and the Layers panel shows per-channel controls.