Skip to main content

anybioimage

Interactive bioimage viewer widget for Jupyter and marimo notebooks. Built on anywidget, it supports multi-dimensional images, multi-channel composites, mask overlays, annotation tools, and HCS plate navigation.

Documentation: https://maartenpaul.github.io/anybioimage/

Installation

uv pip install anybioimage

# With all recommended dependencies (excludes SAM/PyTorch)
uv pip install "anybioimage[all]"

# With SAM support (Python 3.10–3.12, requires PyTorch)
uv pip install "anybioimage[complete]"

Quick Start

Minimal example (NumPy only)

import numpy as np
from anybioimage import BioImageViewer

viewer = BioImageViewer()
viewer.set_image(np.random.randint(0, 255, (512, 512), dtype=np.uint8))
viewer  # displays in notebook

Example with a tiff image

from anybioimage import BioImageViewer
from bioio import BioImage
import bioio_tifffile

viewer = BioImageViewer()
viewer.set_image(BioImage("image.tif", reader=bioio_tifffile.Reader))
viewer  # renders inline

marimo

import marimo as mo
from anybioimage import BioImageViewer
from bioio import BioImage
import bioio_tifffile

viewer = BioImageViewer()
viewer.set_image(BioImage("image.tif", reader=bioio_tifffile.Reader))
mo.ui.anywidget(viewer)

Features

Multi-dimensional images

Supports 5D arrays (TCZYX: Time, Channel, Z-stack, Y, X) with sliders for T, Z, and per-channel controls. Pass a BioImage object for lazy loading — efficient for large TIFF and OME-Zarr files.

from bioio import BioImage
import bioio_tifffile
import bioio_ome_zarr

img = BioImage("image.tif",  reader=bioio_tifffile.Reader)
viewer.set_image(img)  # activates T/Z sliders, per-channel LUT controls

Multi-channel composites

Each channel has independent color, brightness/contrast (LUT), and visibility controls via the Layers panel in the toolbar. Channel settings can also be set programmatically:

# Access and modify channel settings
settings = list(viewer._channel_settings)
settings[0] = {**settings[0], "name": "DAPI", "color": "#0000ff"}
viewer._channel_settings = settings

Mask overlays

Add segmentation masks as overlay layers with configurable color, opacity, and contour rendering:

viewer.add_mask(labels, name="Nuclei", color="#ff0000", opacity=0.5)

# Manage masks
viewer.update_mask_settings(mask_id, opacity=0.3)
viewer.remove_mask(mask_id)
viewer.clear_masks()

HCS plate support

Load OME-Zarr HCS plates with well and FOV navigation dropdowns built into the widget:

viewer = BioImageViewer()
viewer.set_plate("plate.zarr")
viewer  # shows Well / FOV dropdowns

Annotation tools

Tool Shortcut Description
Pan P Navigate and zoom
Select V Select annotations; Delete to remove
Rectangle R Draw bounding boxes
Polygon G Click vertices, double-click to close
Point O Place point markers

Export annotations as DataFrames:

viewer.rois_df      # rectangles: id, x, y, width, height
viewer.polygons_df  # polygons: id, points, num_vertices
viewer.points_df    # points: id, x, y

SAM integration

Automatic segmentation with Segment Anything Model when drawing rectangles or placing points:

viewer.enable_sam(model_type="mobile_sam")  # ~40 MB, fastest
viewer.enable_sam(model_type="sam_b")       # SAM base, ~375 MB

Requires uv pip install "anybioimage[sam]" (Python 3.10–3.12).

Optional dependencies

Extra Installs Use case
bioio bioio, bioio-tifffile TIFF / OME-Zarr loading
contours scipy Contour-only mask rendering
sam ultralytics (PyTorch) SAM segmentation
all bioio + contours Recommended (no PyTorch)
complete all + sam Everything

License

MIT

Metadata

Release files for anybioimage 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anybioimage 0.3.1
File Size Uploaded
anybioimage-0.3.1.tar.gz 46.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anybioimage 0.3.1
File Interpreter ABI Platform
anybioimage-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 91.1 kB

Release files / anybioimage-0.3.1.tar.gz

Download URL anybioimage-0.3.1.tar.gz
Size 46.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2a8456ba8dba768344a6c7e0a15f34a317a855ba74105243a3968c6edd98ed23
BLAKE2b-256 checksum
How to use checksums
945d4f699d5ff11865953f4b86e75a425bee42c7cbac05755ea7891dc4171cf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 22, 2026.

Transparency log

Release files / anybioimage-0.3.1-py3-none-any.whl

Download URL anybioimage-0.3.1-py3-none-any.whl
Size 44.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bad3595c2f2c828952ff434b81de164ece0ec635eef422f0597bab8b4280d264
BLAKE2b-256 checksum
How to use checksums
58271e273c8776cca72ff3c8bf688b11b603a4a9de5ceea8ac97eb7e66ea1b6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page