Skip to content

Python API

This section documents the public Python API directly from the ALHENA docstrings.

Most workflows use three pages:

The returned TileEmbeddings, CellEmbeddings, and AnnotationResult objects are documented under Types.

Page Open it when
Encoder You compute tile or cell embeddings, or want the adapters underneath.
Cell typer You annotate cells, from tiles and nuclei or from cells encoded earlier.
Reading data Your images or nuclei sit in files or arrays, or you read saved results.
Preprocessing You check what a resolution does to a tile.
Cells and pooling You build the nucleus-to-token table, or pool yourself.
Retrieval You run the lower-level reference-retrieval operator.
References You load a prebuilt or custom reference and inspect its class support.
Building a reference You build a custom reference from atlas embeddings and labels.
Scoring You evaluate annotations against known labels.
SpatialData Your data is in a SpatialData object, or you run sopa's patch pipeline.
Plotting You draw overlays, tile regions, compositions, matrices or legends.
Types You need the fields of a result: TileEmbeddings, CellEmbeddings, AnnotationResult.
Errors and warnings You catch an ALHENA error, or filter its warnings.
Constants You need a fixed quantity: resolution, k, tau, the axes.

Each heading names the public module to import a symbol from. On the Errors and Constants pages, it names the private module that defines the symbol, and the page says where to import it from. A re-exported symbol reaches either way, so alhena.load_celltyper and alhena.api.load_celltyper are one function.


Next: FAQ