Catalog PyPI
Back to packageRELEASE DETAILS

0.4.0

PyPI

ahcore

Core building blocks for whole-slide-image deep learning pipelines

Published16 Oct 2026
Direct dependencies30
Transitive dependenciesNot calculated

README

Version 0.4.0 documentation

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.

Manifests that read slides with OpenSlide (reader OPENSLIDE) need dlup's OpenSlide backend:

pip install "ahcore[openslide]"

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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 36

Native requirements
30 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
dlup
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
dlup>=0.9.4runtime
filelock
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
filelock>=3.12runtime
h5py
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
h5py>=3.12runtime
imageio
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
imageio>=2.37runtime
kornia
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
kornia>=0.8runtime
lightning
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
lightning>=2.6runtime
numcodecs
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
numcodecs>=0.13runtime
numpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
numpy>=2.0runtime
omegaconf
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
omegaconf>=2.3runtime
pandas
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pandas>=2.0runtime
pillow
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pillow>=10.0runtime
pyarrow
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pyarrow>=15runtime
pydantic
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pydantic>=2.10runtime
rich
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
rich>=13runtime
sqlalchemy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
sqlalchemy>=2.0runtime
torch
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
torch>=2.6runtime
tqdm
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
tqdm>=4.66runtime
typing-extensions
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
typing-extensions>=4.10runtime
zarr
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
zarr>=3.0runtime
aiohttp
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
aiohttp>=3.9; extra == "dev"runtime
huggingface-hub
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
huggingface-hub; extra == "dev"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
mypy; extra == "dev"runtime
pytest-mock
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pytest-mock; extra == "dev"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0; extra == "dev"runtime
pyyaml
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pyyaml; extra == "dev"runtime
ruff
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
ruff; extra == "dev"runtime
timm
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
timm==1.0.*; extra == "dev"runtime
transformers
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
transformers==4.48.*; extra == "dev"runtime
mlflow
Environment
{
  "extras": "",
  "marker": "extra == \"logging\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
mlflow>=3.4; extra == "logging"runtime
tensorboard
Environment
{
  "extras": "",
  "marker": "extra == \"logging\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
tensorboard>=2.19; extra == "logging"runtime
dlup
Environment
{
  "extras": "openslide",
  "marker": "extra == \"openslide\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
dlup[openslide]>=0.9.4; extra == "openslide"runtime
aiohttp
Environment
{
  "extras": "",
  "marker": "extra == \"remote\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
aiohttp>=3.9; extra == "remote"runtime
huggingface-hub
Environment
{
  "extras": "",
  "marker": "extra == \"tracing\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
huggingface-hub; extra == "tracing"runtime
pyyaml
Environment
{
  "extras": "",
  "marker": "extra == \"tracing\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pyyaml; extra == "tracing"runtime
timm
Environment
{
  "extras": "",
  "marker": "extra == \"tracing\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
timm==1.0.*; extra == "tracing"runtime
transformers
Environment
{
  "extras": "",
  "marker": "extra == \"tracing\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
transformers==4.48.*; extra == "tracing"runtime

Distribution files

2 collected
ahcore-0.4.0-py3-none-any.whl

bdist_wheel · 165.87 KB · Python py3

Source file
ahcore-0.4.0.tar.gz

sdist · 148.87 KB · Python source

Source file

Repository

PENDING
nki-ai/ahcore

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:36 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:9796ec3345e159bf731984dd2a3655e11fcc2ca5ca8858328ef227ef77be81dc

Other collected versions

View all collected versions →