ahcore
ahcore is the AI for Oncology core toolkit for computational-pathology pipelines: the reusable building
blocks that sit between whole-slide images and a training run. It is a pure-Python library, meant to be
composed inside a larger pipeline rather than run on its own.
This repository is automatically synced from the AI for Oncology monorepo.
What ahcore offers
ahcore is a toolkit of composable building blocks for whole-slide-image deep learning, not an end-to-end
application. A consumer pipeline assembles these pieces and owns the experiment logic. It decides how data
is split, whether to cross-validate, and how runs are orchestrated. ahcore provides the parts.
- A data catalog. A SQLAlchemy-backed manifest of patients, slides, masks, labels, and named splits,
queried through a
DataManager.ahcorestores and serves splits (e.g. fit/validate/test membership, or membership supplied in memory). How you draw them is up to you. - Views and adapters. Lazy per-slide and per-tile accessors over the catalog, plus an adapter seam
(
view → AdapterBundle) that turns them into named, model-ready tensors. Ships adapters for foundation-model tile features, patient labels, bulk RNA expression, and image+mask pairs. Adapters are the main extension point. - Feature extraction and caching. Run a packaged foundation-model encoder over a slide's tiles and persist the per-slide features to HDF5, keyed deterministically. This is a distinct precompute step: at training time the feature adapters read from that cache, they do not extract on the fly (doing so would be too slow for a realistic training run).
- Datamodules and models. PyTorch Lightning datamodules that assemble batches from adapters (single- or multi-modal), plus model heads: attention-based MIL (ABMIL), mean-pool MIL (MeanMIL), encoders, a concatenation fusion head, and segmentation wrappers.
- Task and training scaffolding. A
Taskprotocol (choose inputs and targets, compute loss and metrics) and a thinMultiModalLightningModulethat runs training/validation/test by delegating to the task. You supply the concrete tasks. - Slide-sized raster I/O. Stream model outputs (segmentation masks, attention or probability maps) tile-by-tile into a chunked Zarr store, then read arbitrary regions back like a slide, to stitch, overlay, or export to a pyramidal TIFF.
- Transforms and augmentations. Tile transforms (including polygon-to-mask) and feature-space augmentations.
ahcore ships no end-to-end command-line application; it is a library.
Installation
pip install ahcore
Requires Python ≥ 3.11. The training stack (PyTorch Lightning) is a core dependency. ahcore is a
training-scaffolding library, not an optional add-on.
Development
ahcore is developed in the AI for Oncology monorepo and synced to this repository. To work on it here,
standalone:
pip install -e ".[dev]"
pytest
Inside the monorepo it is built and tested with Bazel (bazelisk test //aifo/ahcore/tests/...).
License
Apache 2.0 — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ahcore-0.1.0.tar.gz.
File metadata
- Download URL: ahcore-0.1.0.tar.gz
- Upload date:
- Size: 101.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ee001bcfabea7fc89bb464e4a3bffa5f5903c3946b934e198001c2ae8aa0309
|
|
| MD5 |
81f14c9a0003768608543d21f36eb291
|
|
| BLAKE2b-256 |
499975e46ce76712dbc2ec57d9ba6171d84c875d6495b4ed85e34cf399b4473b
|
Provenance
The following attestation bundles were made for ahcore-0.1.0.tar.gz:
Publisher:
release.yml on NKI-AI/ahcore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ahcore-0.1.0.tar.gz -
Subject digest:
2ee001bcfabea7fc89bb464e4a3bffa5f5903c3946b934e198001c2ae8aa0309 - Sigstore transparency entry: 2580672731
- Sigstore integration time:
-
Permalink:
NKI-AI/ahcore@17fb8c115b076e7bc3cc279b06a9ce2b5d7360fc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NKI-AI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@17fb8c115b076e7bc3cc279b06a9ce2b5d7360fc -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ahcore-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ahcore-0.1.0-py3-none-any.whl
- Upload date:
- Size: 128.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18556a7cbb16c41fb30d8fccddff24d9ef1b01e2e3422e97e0798bbc9c3b673a
|
|
| MD5 |
ef1e21d81df25fe00cb56f414be48010
|
|
| BLAKE2b-256 |
271beca21737bd5633433cdb906ae8183d6cb7329fc0f29653ca2b8e4827261e
|
Provenance
The following attestation bundles were made for ahcore-0.1.0-py3-none-any.whl:
Publisher:
release.yml on NKI-AI/ahcore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ahcore-0.1.0-py3-none-any.whl -
Subject digest:
18556a7cbb16c41fb30d8fccddff24d9ef1b01e2e3422e97e0798bbc9c3b673a - Sigstore transparency entry: 2580672750
- Sigstore integration time:
-
Permalink:
NKI-AI/ahcore@17fb8c115b076e7bc3cc279b06a9ce2b5d7360fc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NKI-AI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@17fb8c115b076e7bc3cc279b06a9ce2b5d7360fc -
Trigger Event:
workflow_dispatch
-
Statement type: