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
¶
Microns per pixel the encoder reads, which tiles of a declared resolution are brought to.
alhena._constants.BACKBONE_NATIVE_MPP
module-attribute
¶
Native microns per pixel of UNI2-h, an operating point nothing resamples to.
alhena._constants.INPUT_SIZE
module-attribute
¶
Side of the square canvas the encoder reads, in pixels.
alhena._constants.PATCH_SIZE
module-attribute
¶
Side of one token, in pixels of the canvas.
alhena._constants.DEFAULT_K
module-attribute
¶
Reference neighbors each cell votes over.
alhena._constants.DEFAULT_TAU
module-attribute
¶
Softmax temperature over neighbor similarities.
alhena._constants.RETRIEVAL_DEPTH
module-attribute
¶
Neighbors retrieved, then scored again pair by pair, before the slice to k.
alhena._constants.LINEAGE_V1
module-attribute
¶
Classes of the lineage_v1 axis, in the order of their codes (label_order).
alhena._constants.COMPARTMENT_V1
module-attribute
¶
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
¶
Class axis used where none is named.
alhena._constants.label_order
¶
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 |
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._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
¶
Name of the unknown class, last in every class order, which no row is coded with.
alhena._constants.MPP_TOLERANCE
module-attribute
¶
Relative difference between a declared mpp and the target above which tiles are resampled.
alhena._constants.CROP_WARNING_FRACTION
module-attribute
¶
Share of a field the center crop may discard before a GeometryWarning is raised.
alhena._constants.MIN_MICROSCOPE_MPP
module-attribute
¶
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
¶
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
¶
Reference cells below which a class is reported as thinly supported.
alhena._constants.MIN_SUPPORT_TO_K_RATIO
module-attribute
¶
Floor of the thinnest class's support over k, below which EnvelopeWarning is raised.
alhena._constants.MIN_K_TO_CLASSES_RATIO
module-attribute
¶
Floor of k over the number of classes, below which EnvelopeWarning is raised.
alhena._constants.BACKBONE_REPO
module-attribute
¶
Model hub repository of the UNI2-h weights, gated by their authors.
alhena._constants.WEIGHTS_REPO
module-attribute
¶
Model hub repository publishing the encoder bundle.
alhena._constants.REFERENCES_REPO
module-attribute
¶
Model hub repository publishing the reference shards and their registry.
Next: FAQ