Skip to content

About

A python package with Jupiter notebook widgets and convenience functions to work with OMERO to annotate and train AI bioimage models

Resources

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

OMERO Annotate.AI

PyPI version install with bioconda Python versions CI/CD Documentation Pixi Badge License

OMERO Annotate.AI logo

Reproducible AI-assisted annotation of OMERO data, from image selection to training-ready datasets.

Pick images from an OMERO project, dataset, plate or screen. Annotate them in napari with micro-SAM or prepare them for Cellpose. The masks, ROIs and a tracking table go back to OMERO. Every run is described by one YAML file, so you can resume it, repeat it or share it.

micro-SAM segmentation of a Cell Painting field in napari micro-SAM (vit_b_lm) instance segmentation of nuclei in a Cell Painting field from the BioImage Archive (S-BIAD855), shown in napari.

How it works

flowchart LR
    A[OMERO<br/>project · dataset · plate · screen] --> B[Select images<br/>train / val / test split]
    B --> C[Annotate in napari<br/>micro-SAM or Cellpose]
    C --> D[Back to OMERO<br/>masks · ROIs · tracking table]
    D --> E[Training data<br/>micro-SAM · BiaPy · DL4MicEverywhere]
    D --> F[BioImage Archive<br/>MIFA export]
Loading
  • Jupyter widgets to connect to OMERO and create a training set or open one to continue, no code needed.
  • Resumable and crash-safe: each mask is saved locally, uploaded with a tag and then recorded in the tracking table, so an interrupted run continues where it stopped without duplicate uploads; pixel digests flag files that changed afterwards.
  • Review and correct earlier annotations with their saved masks; record a note per session.
  • Flexible sampling: timepoints, z-slices, 3D volumes, random patches, and filtering plate wells on their key-value pairs.
  • Training-ready output: one folder layout for micro-SAM, BiaPy and DL4MicEverywhere, with images and labels paired by name.
  • FAIR by default: the config carries study and method metadata and exports to the BioImage Archive (MIFA).
  • Local-only storage (storage: local) for data you cannot write to, such as public IDR OME-Zarr.

Jupyter widgets

OMERO connection widget Opening a training set in the workflow widget: progress per split and session notes
Connect to any OMERO server. Pick a container, then start a new training set or continue one: progress per split and the notes of earlier sessions.

napari plugin (experimental)

Annotate in your own napari window: Plugins → OMERO Annotate AI → Annotate training set (install with pip install "omero-annotate-ai[napari]"). It opens existing training sets on OMERO or in a local folder, saves each accepted image straight away, and can review annotated images starting from their saved masks. See the napari plugin guide.

Installation

# Recommended: pixi
pixi init myproject && cd myproject
pixi add micro_sam jupyterlab
pixi add --pypi "omero-annotate-ai[notebooks]"

# Or: conda + pip
conda install -c conda-forge micro_sam jupyterlab
pip install "omero-annotate-ai[notebooks]"

# Or: pip only (micro-SAM and napari from PyPI)
pip install "omero-annotate-ai[microsam,notebooks]" jupyterlab

See the installation guide for details and troubleshooting.

Quick start

With widgets (in Jupyter):

from omero_annotate_ai import create_omero_connection_widget, create_workflow_widget

conn_widget = create_omero_connection_widget()
conn_widget.display()
conn = conn_widget.get_connection()

workflow_widget = create_workflow_widget(connection=conn)
workflow_widget.display()  # New training set, or Open one to continue

ts = workflow_widget.training_set()
workflow_widget.annotate(note="nuclei only, small debris skipped")

From a YAML config (scripts, batch runs, or repeating a run):

from omero_annotate_ai import TrainingSet, load_config

config = load_config("annotation_config.yaml")
ts = TrainingSet.create(config, conn)
ts.annotate()

Continue later (after closing napari, or a crash): open the set by its table ID and annotate what is left; anything a crash left half-done is repaired first.

ts = TrainingSet.open(12345, conn)
ts.extend(train_n=10)  # optional: add images to the same table
ts.annotate(note="second round")

Each training set keeps its files in one folder: images, masks, config.yaml (with the sessions and their notes) and a local copy of the tracking table. By default that is ~/omero_annotate_ai/<server>/<table id>_<name>/; set OMERO_ANNOTATE_AI_HOME (or pass home= to TrainingSet.create / open) to keep the sets elsewhere. ts.review() reopens annotated images with their masks to correct them. Open the same set on another computer to carry on there; two people can even annotate it at the same time, because each session claims the images it shows (your own claims, e.g. after a dropped connection, never block you). create_pipeline(config, conn).run_full_micro_sam_workflow() from 0.4 still works but is deprecated.

The configuration guide lists every option.

Example notebooks

Jupyter marimo
Annotate with micro-SAM or Cellpose widget workflow annotation
Run from YAML (OMERO or OME-Zarr) from YAML
Train micro-SAM micro-SAM
Export for BiaPy / DL4MicEverywhere export
Export to the BioImage Archive BIA export
Try it on public data IDR OME-Zarr demo

Documentation

Upgrading from 0.4? The release notes list the changes and how to migrate.

Full documentation: https://leiden-cell-observatory.github.io/omero_annotate_ai/ (micro-SAM tutorial, API reference).

Contributing

git clone https://github.com/Leiden-Cell-Observatory/omero_annotate_ai.git
cd omero_annotate_ai
pixi install                         # default env: everything to run the notebooks
pixi run -e dev install-hooks        # once per clone: ruff + notebook-output hooks
pixi run -e dev pytest tests/        # dev env adds test, lint and type-check tools

Issues and pull requests are welcome on GitHub.

Contact and acknowledgements

Maarten Paul, m.w.paul@lacdr.leidenuniv.nl

Developed at the Leiden Cell Observatory within the NL-BioImaging infrastructure, funded by NWO.

License

GNU General Public License v2.0 or later (GPL-2.0-or-later); see LICENSE. The package builds on omero-py (GPL-2.0-or-later) and ezomero (GPL-2.0), so it uses a compatible license. Releases up to and including 0.4.x were published under Apache-2.0.

About

A python package with Jupiter notebook widgets and convenience functions to work with OMERO to annotate and train AI bioimage models

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages