cellmap_flow.models.bioimage_catalog

The BioImage Model Zoo’s models, for the dashboard’s picker.

They come from bioimage.io’s artifact server (Hypha), whose listing holds each model’s whole description: its axes (so 2D or 3D, and any declared voxel size, without a fetch per model) and weights. The legacy collection.json index, which lags it (125 models to its 157 in October 2026), is the fallback when the server cannot be reached.

list_bioimage_models answers from a cache file under ~/.cellmap_flow/bioimage once there is one, so opening the Models tab does not download the zoo’s index each time; refresh_bioimage_models fetches it again. Both give {"fetched": <ISO time>, "models": [...]}, the index’s models in its order, each as normalise gives it. A failed fetch raises ZooIndexError, whose message says why, and leaves the cache as it was.

None of the zoo’s models declares the voxel size it was trained at, so the EM ones’ were looked up by hand, in bioimage_voxel_sizes.yaml beside this module: trained_at reads it, and each listed model carries its row as trained (None for a model not in it).

bioimage_entry turns a ticked model into BioModelConfig’s constructor arguments: the one place that knows their names.

Attributes

ZOO_INDEX_URL

HYPHA_ARTIFACTS

HYPHA_MODELS_URL

FETCH_TIMEOUT_S

BIOIMAGE_CACHE_DIR

BIOIMAGE_CACHE_FILE

CACHE_FORMAT

STALE_AFTER_S

ZOO_PAGE_URL

TRAINED_VOXEL_SIZES_FILE

Exceptions

ZooIndexError

The zoo's index could not be fetched or read.

Functions

normalise(→ dict)

One index entry as the picker shows it.

normalise_artifact(→ Optional[dict])

One Hypha artifact as the picker shows it: normalise's fields from

trained_at(→ Optional[dict])

What bioimage_voxel_sizes.yaml says the model (an entry, or its

list_bioimage_models(→ dict)

The zoo's models, from the cache when there is a current one, with

refresh_bioimage_models(→ dict)

Fetch the zoo's index again, and cache it.

find_bioimage_model(→ Optional[dict])

The cached model whose id, nickname or key is key, or None.

declared_voxel_size(→ Optional[list])

The voxel size (nm, z y x) the model's description declares, None when it declares none.

bioimage_entry(→ dict)

BioModelConfig's constructor arguments for the zoo model model_id

entry_model_id(→ Optional[str])

The zoo model a BioModelConfig runs, read from its to_dict(),

Module Contents

cellmap_flow.models.bioimage_catalog.ZOO_INDEX_URL = 'https://uk1s3.embassy.ebi.ac.uk/public-datasets/bioimage.io/collection.json'
cellmap_flow.models.bioimage_catalog.HYPHA_ARTIFACTS = 'https://hypha.aicell.io/bioimage-io/artifacts'
cellmap_flow.models.bioimage_catalog.HYPHA_MODELS_URL = ''
cellmap_flow.models.bioimage_catalog.FETCH_TIMEOUT_S = 30
cellmap_flow.models.bioimage_catalog.BIOIMAGE_CACHE_DIR
cellmap_flow.models.bioimage_catalog.BIOIMAGE_CACHE_FILE
cellmap_flow.models.bioimage_catalog.CACHE_FORMAT = 2
cellmap_flow.models.bioimage_catalog.STALE_AFTER_S = 3600
cellmap_flow.models.bioimage_catalog.ZOO_PAGE_URL = 'https://bioimage.io/#/artifacts/{}'
exception cellmap_flow.models.bioimage_catalog.ZooIndexError

The zoo’s index could not be fetched or read.

cellmap_flow.models.bioimage_catalog.normalise(raw: dict) → dict

One index entry as the picker shows it.

id is the index’s (a Zenodo DOI for older models, the nickname for newer ones), nickname the animal name (“affable-shark”) or None, and key the one to load it by, the nickname when there is one. dims is “2d”, “3d” or None; em whether its tags, name or description say electron microscopy; weight_formats short names (“pytorch”, “onnx”).

cellmap_flow.models.bioimage_catalog.normalise_artifact(artifact: dict) → dict | None

One Hypha artifact as the picker shows it: normalise’s fields from its description, with 2D/3D and the declared voxel size from its input’s axes. None for an artifact with no description.

cellmap_flow.models.bioimage_catalog.TRAINED_VOXEL_SIZES_FILE
cellmap_flow.models.bioimage_catalog.trained_at(model) → dict | None

What bioimage_voxel_sizes.yaml says the model (an entry, or its nickname) was trained at: {“voxel_size” (absent when trained across resolutions), “trained_on”, “confidence”, “source”, “note”?}, or None.

cellmap_flow.models.bioimage_catalog.list_bioimage_models() → dict

The zoo’s models, from the cache when there is a current one, with stale saying whether it is older than STALE_AFTER_S.

A cache in an older format is fetched again; when that fails it is still read, as a list that is older is better than none.

cellmap_flow.models.bioimage_catalog.refresh_bioimage_models() → dict

Fetch the zoo’s index again, and cache it.

cellmap_flow.models.bioimage_catalog.find_bioimage_model(key: str) → dict | None

The cached model whose id, nickname or key is key, or None.

Only the cache is read: the Models tab’s submit must not wait on the network, and a model the tab listed is in it.

cellmap_flow.models.bioimage_catalog.declared_voxel_size(entry: dict) → list | None

The voxel size (nm, z y x) the model’s description declares, None when it declares none.

Read from its RDF (rdf_source) with a plain fetch, so the dashboard, which has no bioimageio.core, can refuse a blank voxel size at Submit: the server would otherwise refuse it after its job started, out of sight. Remembered per model. Raises ZooIndexError when the description cannot be read, which the caller treats as “don’t know”.

cellmap_flow.models.bioimage_catalog.bioimage_entry(model_id: str, voxel_size=None, name: str | None = None, cls=None) → dict

BioModelConfig’s constructor arguments for the zoo model model_id (an id or nickname bioimageio.core loads), at voxel_size (nm, z y x) and called name.

The argument names come from the signature, so this holds whether the model is called model_name or model. A voxel_size of None is left out when the class can read it from the model; when it cannot, a ValueError says to give it. cls is for tests.

cellmap_flow.models.bioimage_catalog.entry_model_id(model_config) → str | None

The zoo model a BioModelConfig runs, read from its to_dict(), which bioimage_entry’s names round-trip through.