Skip to main content

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. ahcore stores 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 Task protocol (choose inputs and targets, compute loss and metrics) and a thin MultiModalLightningModule that 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

ahcore-0.1.1.tar.gz (102.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ahcore-0.1.1-py3-none-any.whl (129.8 kB view details)

Uploaded Python 3

File details

Details for the file ahcore-0.1.1.tar.gz.

File metadata

  • Download URL: ahcore-0.1.1.tar.gz
  • Upload date:
  • Size: 102.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ahcore-0.1.1.tar.gz
Algorithm Hash digest
SHA256 197105d21f7e43e332bdc856d3f01bed8dd6a844c0046d59c644affa6ab02a5e
MD5 e5453c43cb0f940d08c2f6b2df28262f
BLAKE2b-256 e471f88916068d40439aee1ba21c86686ea61edc5d49ca05477ff74d43410a81

See more details on using hashes here.

Provenance

The following attestation bundles were made for ahcore-0.1.1.tar.gz:

Publisher: release.yml on NKI-AI/ahcore

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ahcore-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ahcore-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 129.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ahcore-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b733e3f14b06d0514f2f6bf4206ca0846067dee30f13543d5a3c40b52d500f9c
MD5 1ec7a7f59c483dbdafecb1ac4a709286
BLAKE2b-256 e4f0680c3f4ae79bd8231ba994b31f9d7538ebeecd99d7da22d9bb4c95281196

See more details on using hashes here.

Provenance

The following attestation bundles were made for ahcore-0.1.1-py3-none-any.whl:

Publisher: release.yml on NKI-AI/ahcore

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page