Backends and Registry
June 8, 2026 ยท View on GitHub
ASlide uses a registry to map file paths to backend classes. This keeps the public Slide(path) API stable while allowing each format to provide its own reader and DeepZoom implementation.
Resolution Flow
When Slide(filepath) is created:
registry.resolve_path(filepath)scans registeredFormatEntryobjects.- The file extension must match an entry.
- If the entry has a
probe, the probe must accept the path. entry.is_available()must return true.entry.create_slide(filepath, acquisition_id=...)constructs the backend.Slideresolves the runtimeslide_familywhen the backend supports classification.
Entries with probes are useful when one extension can represent multiple families. OME-like TIFF is probe-selected before generic TIFF fallback.
FormatEntry
FormatEntry describes one backend registration:
format_id: stable registry nameextensions: accepted suffixesslide_backend: backend class or lazy factoryslide_family: static family or runtime-classified family markerdeepzoom_backend: optional backend-specific DeepZoom classavailability_check: optional dependency checkprobe: optional file content/metadata checkcapabilities: staticBackendCapabilities
FormatEntry.create_slide() only forwards keyword arguments accepted by the backend constructor. This lets Slide(..., acquisition_id=...) work for MCD without breaking backends that do not accept acquisition_id.
Static Capabilities vs Runtime Behavior
BackendCapabilities are known before opening a specific file. Runtime-classified formats such as CZI and QPTIFF can advertise conservative static capabilities, then expose brightfield or multiplex behavior after metadata inspection.
Capability flags:
has_label_imagehas_color_correctionhas_associated_imageshas_deepzoomrequires_bootstrapsupports_biomarkersrequires_explicit_channel_readdefault_display_biomarker
Use slide.slide_family and slide.supports_biomarkers for file-specific behavior.
Adding a Backend
To add a backend, implement the backend contract used by Slide:
- shared fields:
level_count,dimensions,level_dimensions,level_downsamples,properties close()- brightfield:
read_region()and optional thumbnail, associated image, label, color correction helpers - multiplex:
list_biomarkers(),read_biomarker_region(), andget_default_display_biomarker()when a safe default exists
Then register a FormatEntry in build_default_registry(). If the format needs optional dependencies, use availability_check. If extension alone is not enough, add a probe.
DeepZoom Backends
If a format has a specialized DeepZoom generator, set deepzoom_backend. Otherwise DeepZoom falls back to OpenSlide's generator when possible. Multiplex DeepZoom backends should accept or expose a biomarker-aware source.