API Reference
June 8, 2026 ยท View on GitHub
This page documents ASlide's public Python API. Backend-specific low-level SDK bindings are intentionally not treated as stable public API.
Public Imports
from Aslide import ADeepZoomGenerator, DeepZoom, FormatEntry, FormatRegistry, Slide, registry
Slide
Slide(filepath, acquisition_id=None) opens a slide and selects the correct backend through the registry. acquisition_id is used by MCD inputs when the caller wants a specific acquisition.
Use Slide as a context manager when possible:
from Aslide import Slide
with Slide("sample.svs") as slide:
print(slide.dimensions)
Properties
backend: concrete backend object selected by the registryformat: primary file extension from the registry entry, such as.svsor.qptiffslide_family: semantic family, usuallybrightfieldormultiplexqptiff_semantics: QPTIFF semantic family, orNonefor non-QPTIFF inputssupports_biomarkers: true when biomarker-aware operations are availablempp: microns-per-pixel when the backend or metadata provides itmagnification: backend magnification value when availablelevel_count: number of pyramid levelsdimensions: level-0(width, height)dimensionslevel_dimensions: dimensions for all levelslevel_downsamples: downsample factor for each levelproperties: metadata dictionary or mapping from the backendassociated_images: mapping of associated images; may synthesizethumbnailfor brightfield slides
Methods
classify_slide_family(): returns the backend-resolved slide family when a backend supports runtime classificationlabel_image(save_path=None): returns or saves a label image when availableget_best_level_for_downsample(downsample): asks the backend for the closest pyramid levelget_thumbnail(size): returns a brightfield thumbnaillist_biomarkers(): returns multiplex biomarker namesget_default_display_biomarker(): returns a backend default display biomarker, or raisesMissingDefaultBiomarkerErrorwhen none can be selectedread_biomarker_region(location, level, size, biomarker): reads a multiplex channel region as RGBAread_region(location, level, size): reads a brightfield region as RGBA; multiplex slides raiseUnsupportedOperationErrorand requireread_biomarker_region()insteadread_fixed_region(location, level, size): reads a backend fixed brightfield region when supportedclose(): closes the backendapply_color_correction(apply=True, style="Real"): toggles backend color correction when supported
Brightfield and Multiplex Guards
Brightfield-only methods reject multiplex slides. Multiplex-only methods reject brightfield slides. These guards prevent accidental reads through the wrong semantic API.
DeepZoom and ADeepZoomGenerator
DeepZoom(slide, tile_size=254, overlap=1, limit_bounds=False, max_level_size=10000, biomarker=None) wraps the slide's DeepZoom backend.
Properties:
backendbiomarkertile_sizelevel_countlevel_tileslevel_dimensionstile_count
Methods:
get_dzi(image_format): returns DZI XMLget_tile(level, address): returns a tile image
ADeepZoomGenerator is an alias for DeepZoom.
Registry API
registry is the default FormatRegistry built by build_default_registry().
from Aslide import registry
entry = registry.resolve_path("sample.svs")
print(entry.format_id)
FormatRegistry methods:
register(entry): adds or replaces a format entry byformat_idget(format_id): returns one entry or raisesLookupErrorentries(): returns all entries as a tupleresolve_path(path): selects a matching and available entry for a file path
FormatEntry fields:
format_idextensionsslide_backendslide_familydeepzoom_backendavailability_checkprobecapabilities
FormatEntry methods:
is_available()load_slide_backend()load_deepzoom_backend()create_slide(path, **kwargs)matches_path(path)
Backend Capabilities
BackendCapabilities describes static backend capabilities known before a file is opened:
has_label_imagehas_color_correctionhas_associated_imageshas_deepzoomrequires_bootstrapsupports_biomarkersrequires_explicit_channel_readdefault_display_biomarker
Runtime-classified formats may have conservative static capabilities and still expose multiplex behavior after opening a specific file.
Runtime Bootstrap Helpers
from Aslide.bootstrap import collect_library_paths, preload_shared_libraries, setup_runtime_environment
collect_library_paths(package_root=None): returns package library directories for OpenCV, SDPC, KFB, and TRON when presentsetup_runtime_environment(lib_paths=None): prepends library paths toLD_LIBRARY_PATHandsys.pathpreload_shared_libraries(lib_paths=None): attempts to load shared libraries withctypes.RTLD_GLOBAL
Public Errors
from Aslide.errors import AslideError, MissingDefaultBiomarkerError, UnknownBiomarkerError, UnsupportedOperationError
AslideError: base package errorUnsupportedOperationError: raised when a method is not valid for the slide family or backendUnknownBiomarkerError: raised by biomarker-aware paths when a marker is not knownMissingDefaultBiomarkerError: raised when a default display biomarker cannot be selected