Skip to content

Constants

Fixed quantities used by the released ALHENA model, including image geometry, retrieval defaults, annotation axes, and the tissue-reference registry.

The built-in annotation axes are distinct

lineage_v1 and compartment_v1 define different classification tasks. Interpret annotations and evaluation metrics separately for each axis.

Not importable from the package

Thirteen names here live in alhena._constants alone: TOKEN_GRID, NUM_TOKENS, UNKNOWN_LABEL, MPP_TOLERANCE, CROP_WARNING_FRACTION, MIN_MICROSCOPE_MPP, MAX_MICROSCOPE_MPP, MIN_REFERENCE_CELLS_PER_CLASS, MIN_SUPPORT_TO_K_RATIO, MIN_K_TO_CLASSES_RATIO, BACKBONE_REPO, WEIGHTS_REPO and REFERENCES_REPO. The remaining constants are re-exported from the top-level package, so alhena.REFERENCE_MPP, for example, refers to the same value.

alhena._constants.REFERENCE_MPP module-attribute

REFERENCE_MPP = DISTILLATION_MPP

Microns per pixel the encoder reads, which tiles of a declared resolution are brought to.

alhena._constants.BACKBONE_NATIVE_MPP module-attribute

BACKBONE_NATIVE_MPP = 0.5

Native microns per pixel of UNI2-h, an operating point nothing resamples to.

alhena._constants.INPUT_SIZE module-attribute

INPUT_SIZE = 224

Side of the square canvas the encoder reads, in pixels.

alhena._constants.PATCH_SIZE module-attribute

PATCH_SIZE = 14

Side of one token, in pixels of the canvas.

alhena._constants.DEFAULT_K module-attribute

DEFAULT_K = 30

Reference neighbors each cell votes over.

alhena._constants.DEFAULT_TAU module-attribute

DEFAULT_TAU = 0.03

Softmax temperature over neighbor similarities.

alhena._constants.RETRIEVAL_DEPTH module-attribute

RETRIEVAL_DEPTH = 200

Neighbors retrieved, then scored again pair by pair, before the slice to k.

alhena._constants.LINEAGE_V1 module-attribute

LINEAGE_V1 = ('B_Plasma', 'Epithelial_Melanocyte', 'Myeloid', 'Stromal_Vascular', 'T_NK')

Classes of the lineage_v1 axis, in the order of their codes (label_order).

alhena._constants.COMPARTMENT_V1 module-attribute

COMPARTMENT_V1 = ('Epithelial_Melanocyte', 'Immune', 'Stromal_Vascular')

Classes of the compartment_v1 axis, in the order of their codes (label_order).

alhena._constants.CLASS_AXES module-attribute

CLASS_AXES = {'lineage_v1': LINEAGE_V1, 'compartment_v1': COMPARTMENT_V1}

Declared class axes, by name.

alhena._constants.DEFAULT_AXIS module-attribute

DEFAULT_AXIS = 'lineage_v1'

Class axis used where none is named.

alhena._constants.label_order

label_order(axis)

Return the class order of an axis, scorable classes sorted, then the unknown class.

The order fixes the code of every class and breaks ties in the vote.

Parameters:

Name Type Description Default
axis str

A key of CLASS_AXES.

required

Returns:

Type Description
tuple[str, ...]

Class names in their canonical order.

Raises:

Type Description
AlhenaValueError

If the axis is not one of the declared axes.

alhena._constants.CLASS_COLORS module-attribute

CLASS_COLORS = {'T_NK': (255, 15, 15), 'B_Plasma': (255, 143, 15), 'Myeloid': (255, 211, 15), 'Immune': (255, 123, 15), 'Stromal_Vascular': (113, 191, 18), 'Epithelial_Melanocyte': (39, 188, 178), 'Unknown': (143, 143, 143)}

RGB color of each class in the figures of alhena.viz.

alhena._constants.TISSUE_TO_SHARD module-attribute

TISSUE_TO_SHARD = {'Breast': 'breast', 'BoneMarrow': 'bone_marrow', 'Cervix': 'cervix', 'Colon': 'intestine', 'Heart': 'heart', 'Kidney': 'kidney', 'Liver': 'liver_cell', 'Lung': 'lung', 'LymphNode': 'tonsil', 'Ovary': 'ovary', 'Pancreas': 'pancreas_cell', 'Prostate': 'prostate', 'Skin': 'skin', 'Tonsil': 'tonsil', 'Uterus': 'uterus'}

Shard each tissue is served by, under its canonical organ name; tissues may share one.

alhena._constants.TISSUE_ALIASES module-attribute

TISSUE_ALIASES = {'Colonic': 'Colon', 'Cutaneous': 'Skin', 'Hepatic': 'Liver', 'Mammary': 'Breast', 'Ovarian': 'Ovary', 'Pancreatic': 'Pancreas', 'Prostatic': 'Prostate', 'Pulmonary': 'Lung', 'Renal': 'Kidney', 'Tonsillar': 'Tonsil', 'Uterine': 'Uterus', 'Cervix uteri': 'Cervix', 'Prostate gland': 'Prostate', 'Uterine cervix': 'Cervix', 'Bowel': 'Colon', 'Colorectal': 'Colon', 'Large intestine': 'Colon', 'Rectum': 'Colon', 'Small intestine': 'Colon', 'Corpus uteri': 'Uterus', 'Endometrium': 'Uterus', 'Myometrium': 'Uterus'}

Other names a tissue is accepted under, each mapped to its tissue in TISSUE_TO_SHARD.

alhena.__version__ module-attribute

__version__ = '0.1.0'

alhena._constants.TOKEN_GRID module-attribute

TOKEN_GRID = INPUT_SIZE // PATCH_SIZE

Tokens along each side of the canvas.

alhena._constants.NUM_TOKENS module-attribute

NUM_TOKENS = TOKEN_GRID * TOKEN_GRID

Patch tokens of one canvas.

alhena._constants.UNKNOWN_LABEL module-attribute

UNKNOWN_LABEL = 'Unknown'

Name of the unknown class, last in every class order, which no row is coded with.

alhena._constants.MPP_TOLERANCE module-attribute

MPP_TOLERANCE = 0.02

Relative difference between a declared mpp and the target above which tiles are resampled.

alhena._constants.CROP_WARNING_FRACTION module-attribute

CROP_WARNING_FRACTION = 0.05

Share of a field the center crop may discard before a GeometryWarning is raised.

alhena._constants.MIN_MICROSCOPE_MPP module-attribute

MIN_MICROSCOPE_MPP = 0.02

Finest microns per pixel of a microscope image: a tenth of the 0.2 micron a lens resolves.

alhena._constants.MAX_MICROSCOPE_MPP module-attribute

MAX_MICROSCOPE_MPP = 20.0

Coarsest microns per pixel of a microscope image, between a 1.25x scan and 600 dpi.

alhena._constants.MIN_REFERENCE_CELLS_PER_CLASS module-attribute

MIN_REFERENCE_CELLS_PER_CLASS = 200

Reference cells below which a class is reported as thinly supported.

alhena._constants.MIN_SUPPORT_TO_K_RATIO module-attribute

MIN_SUPPORT_TO_K_RATIO = 10.0

Floor of the thinnest class's support over k, below which EnvelopeWarning is raised.

alhena._constants.MIN_K_TO_CLASSES_RATIO module-attribute

MIN_K_TO_CLASSES_RATIO = 3.0

Floor of k over the number of classes, below which EnvelopeWarning is raised.

alhena._constants.BACKBONE_REPO module-attribute

BACKBONE_REPO = 'MahmoodLab/UNI2-h'

Model hub repository of the UNI2-h weights, gated by their authors.

alhena._constants.WEIGHTS_REPO module-attribute

WEIGHTS_REPO = 'prism-oncology/ALHENA'

Model hub repository publishing the encoder bundle.

alhena._constants.REFERENCES_REPO module-attribute

REFERENCES_REPO = 'prism-oncology/ALHENA-references'

Model hub repository publishing the reference shards and their registry.


Next: FAQ