Inference, a high-level facade that wires together model construction, tissue segmentation, tile extraction, and per-tile prediction via a remote model endpoint. The internal _SlideInference class handles single-WSI processing.
Inference
Cohort is the single source of truth — all inputs, outputs, and processing status live there. The manifest is auto-saved after each WSI completes, enabling seamless resume on restart.
Base URL for the HTTP backend. Required when backend is
"remote".Directory containing WSI files.
Directory containing bulk RNA files.
Directory containing pre-computed tissue masks.
Whether to auto-compute tissue masks via the
tissue-seg model. Defaults to True.Minimum tissue fraction to keep a tile.
Root directory for the structured workspace.
On-disk format for predictions/embeddings.
Maximum concurrent HTTP requests.
Number of WSIs to process in parallel. When
None (the default), it falls back to max(1, gpu_count) from the local CUDA device count. This is meaningful for the local backend; for the remote and aws backends the GPUs live server-side, so a warning is logged and this should be set explicitly.Experiment / study name for directory nesting.
Run number for repeated experiments.
Sub-variant label (e.g. stain method, threshold).
Free-text note saved in the config.
"remote" (HTTP) or "aws" (SageMaker).Optional explicit tile positions as
(x, y) top-left, slide-origin pixel pairs at the model tile-spec resolution. When supplied, tiles are extracted at exactly these locations (one per coordinate) and tissue masking is bypassed, for every slide this instance processes. Intended for predicting at predefined locations (e.g. PseudoVisium / hex-pooled / Visium spots) and benchmarking against spatial-transcriptomics ground truth. Spot tables report spot centres; convert to top-left first (subtract half the spot size in x and y). Coordinate mode targets a single WSI at a time.Backend-specific arguments forwarded to
Backbone.from_workspace
Inference from a saved workspace.
Loads both the config YAML and the cohort manifest, allowing seamless resume of an interrupted run.
Path to the workspace directory.
Keyword overrides applied on top of the config values.
Inference with cohort state.
save_config
Destination file path. Defaults to the workspace.
cohort
wsi_dir
None if not set.
model_name
workspace
manifest_path
find
Directory to scan for WSI files.
Directory for bulk RNA files.
Directory for pre-computed masks.
Optional callable that maps a filename stem to a patient ID.
Cohort.
Raises:
ValueError- If no WSI directory is available.
run
True.
The
InferenceMode to run (EMBEDDING or PREDICTION); a mode string is also accepted.Reprocess all WSIs regardless of status.
BioptimusValueError- If this instance hascoordinatesset (the full-cohort form is incompatible with the single-WSI contract).
predict
coordinates=, tiles are extracted at those fixed locations for the single processed WSI.
Single WSI path, list of paths, or
None to process the full cohort.Optional bulk RNA CSV override.
Reprocess even if already done.
None in
the slots of slides that failed (logged, recorded in the manifest,
and skipped so the batch completes).
Raises:
BioptimusValueError- If this instance hascoordinatesset and a list input or the full-cohort form is requested.
embed
Single WSI path, list of paths, or
None to process the full cohort.Optional bulk RNA CSV override.
Reprocess even if already done.
None in
the slots of slides that failed (logged, recorded in the manifest,
and skipped so the batch completes).
Raises:
BioptimusValueError- If this instance hascoordinatesset and a list input or the full-cohort form is requested.
tissue
Single path, list, or
None for full cohort.Recompute even if a cached mask exists.
None in the slots of
slides whose mask computation failed (logged and skipped).

