HistoX
HistoX is an open-source Python library for computational pathology. It is a modified fork of Slideflow and is being developed into a PyTorch-first toolkit for whole-slide image (WSI) processing, model training, evaluation, and multimodal pathology research.
What works today
The current package provides a working baseline for:
- project and cohort configuration;
- WSI reading, tissue quality control, and tile extraction;
- stain normalization;
- PyTorch and legacy TensorFlow model backends;
- supervised training and multiple-instance learning workflows;
- feature extraction, heatmaps, mosaics, and the HistoX Studio viewer.
PyTorch is selected automatically when it is installed and is the target for new model and task development. TensorFlow remains available for compatibility with inherited workflows, but new HistoX capabilities will be designed for PyTorch first. See ROADMAP.md for the planned interfaces and milestones.
Requirements
- Package metadata currently declares Python
>=3.7. - Distribution builds are currently checked in CI with Python 3.9.
- WSI reading requires a working libvips installation, unless a compatible cuCIM backend is used.
- Training requires at least one deep-learning backend.
The Python-version declaration is not yet a full compatibility guarantee. Python 3.9 is the current development and CI baseline.
Installation
Install the published package with the PyTorch extras:
python -m pip install "histox[torch]"
To install the current GitHub version without keeping a source checkout:
python -m pip install "histox[torch] @ git+https://github.com/leicaohmu/histox.git@master"
Editable installation is intended for contributors. Use a checkout directory whose name is distinct from the import package:
git clone https://github.com/leicaohmu/histox.git histox-src
cd histox-src
python -m pip install -e ".[torch]"
Using histox-src avoids an outer directory named histox shadowing the
installed package when Python is started from the checkout's parent directory.
Optional installation groups are retained for existing workflows:
| Command | Purpose |
|---|---|
python -m pip install histox |
Base dependency set; install a backend separately |
python -m pip install "histox[torch]" |
PyTorch backend and related tools |
python -m pip install "histox[tf]" |
Legacy TensorFlow compatibility |
python -m pip install "histox[torch,cucim]" |
PyTorch plus cuCIM; manage CuPy separately |
python -m pip install "histox[torch,cucim-cuda12]" |
PyTorch, cuCIM, and CUDA 12 CuPy |
python -m pip install "histox[torch,cucim-cuda11]" |
PyTorch, cuCIM, and CUDA 11 CuPy |
Do not install multiple cupy-* variants in the same environment. Match the
CuPy package to the CUDA runtime reported by nvidia-smi.
Verify the installation
import histox as hx
print("HistoX:", hx.__version__)
print("package location:", hx.__file__)
print("model backend:", hx.backend())
print("slide backend:", hx.slide_backend())
The package location must point to a real histox/__init__.py file. With
PyTorch installed, hx.backend() should report torch unless HX_BACKEND
explicitly selects another supported backend.
Minimal project workflow
HistoX uses an annotation table to connect patient labels to slide names. A minimal table looks like this:
patient,slide,label
P001,S001,tumor
P002,S002,normal
Create a project and configure a PyTorch model:
from pathlib import Path
import histox as hx
workspace = Path("/path/to/workspace")
project = hx.create_project(
root=str(workspace / "project"),
name="my-cohort",
annotations=str(workspace / "annotations.csv"),
slides=str(workspace / "slides"),
tfrecords=str(workspace / "tfrecords"),
)
params = hx.ModelParams(
tile_px=256,
tile_um="20x",
model="resnet50",
epochs=1,
)
Once the slide files named by the annotation table are available, extraction and training use the following public methods:
project.extract_tiles(
tile_px=256,
tile_um="20x",
qc="otsu",
normalizer="macenko",
)
results = project.train("label", params=params)
Tile extraction and training are intentionally separate from project creation: they require real WSI files, sufficient local storage, and an environment configured for the selected slide and model backends.
Data and storage policy
HistoX does not intend to bundle public WSI datasets in the Python wheel, keep them in the Git repository, or operate the laboratory server as a public data mirror. Dataset providers remain the source of record.
The histox.data interface provides small, versioned registry records,
read-only download plans, and verified direct downloads for open HTTP(S)
assets. Those records describe:
- the authoritative provider and dataset identifier;
- access and license requirements;
- file manifests and provider checksums when available;
- supported labels, cohorts, and HistoX adapters;
- the local cache layout and provenance metadata.
import histox as hx
record = hx.data.get_dataset("histox-metadata-fixture")
plan = hx.data.plan_download(record, path="/shared/pathology-data")
print(plan.destination)
A4b1 ships one metadata-only fixture so registry lookup and cache planning can be tested without bundling pathology data. A4b2 adds explicit direct downloads, HTTP Range resumption, atomic file publication, checksum enforcement, and a machine-readable local provenance record. Authentication and provider-specific clients remain subsequent A4b work.
Downloads will go directly from the provider to storage controlled by the user. The cache resolution order is:
HISTOX_CACHE_DIR, when set;$XDG_CACHE_HOME/histox, whenXDG_CACHE_HOMEis set;~/.cache/histoxotherwise.
Controlled-access datasets will continue to require the user's own provider account, approvals, and credentials. The registry and planning contract do not bypass provider access controls.
Core modules
| Module | Current responsibility |
|---|---|
histox.project |
Project configuration and end-to-end workflow orchestration |
histox.data |
Dataset registry, cache resolution, and download planning |
histox.dataset |
Cohort filtering, slide/tile records, and dataset operations |
histox.slide |
WSI reading, QC, ROI handling, and tile extraction |
histox.norm |
Stain-normalization algorithms |
histox.model |
Backend selection, model configuration, training, and features |
histox.mil |
Multiple-instance learning workflows |
histox.heatmap |
Spatial model visualization |
histox.studio |
Interactive desktop viewer |
Documentation and support
The hosted documentation is generated from docs/source. For installation
and current project direction, this README and ROADMAP.md remain
the source of truth.
Contributing
Small, reviewable pull requests are preferred. Before opening a pull request:
- explain the user-facing behavior being changed;
- add or update the smallest relevant test or check;
- run the package checks used by GitHub Actions;
- keep new APIs PyTorch-first unless compatibility work is explicitly scoped.
License and provenance
HistoX is a modified fork of
Slideflow. The top-level
LICENSE records the repository's Apache-2.0 license declaration.
Some bundled source files and optional integrations remain under their original
licenses.
See PROVENANCE.md for repository lineage and
THIRD_PARTY_NOTICES.md for component-level notices
and unresolved review items. Model weights, datasets, and optional extensions
are not automatically covered by the repository license; consult each
artifact's terms before use or redistribution.
Do not publish a new release until the unresolved license-review items in
THIRD_PARTY_NOTICES.md are closed.
Acknowledgments
- Slideflow, the upstream project from which HistoX is derived.
- The Cancer Genome Atlas and other data providers that make computational pathology research possible.
- The PyTorch, TensorFlow, libvips, and cuCIM communities.
Contact: caolei@hrbmu.edu.cn
Metadata
Release files for histox 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| histox-0.3.0.tar.gz | 977.9 kB | Without provenance | Details for histox-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| histox-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for histox-0.3.0-py3-none-any.whl |
Total release size: 2.1 MB
Release files / histox-0.3.0.tar.gz
| Download URL | histox-0.3.0.tar.gz |
|---|---|
| Size | 977.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4524b3af323505fcf30f68485b790bbdc4f26ff334e08dd21ce36c4bea074668
|
|
BLAKE2b-256 checksum How to use checksums |
a4f89298638221505b3bbfa8c308f5b887e8ea63172044927a1fdc5c21295449
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / histox-0.3.0-py3-none-any.whl
| Download URL | histox-0.3.0-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
289c391a9890cc53d3d7067e08017b59e617cb11aee094d908aa2a9d73936804
|
|
BLAKE2b-256 checksum How to use checksums |
b213798209a2317b0f0dd449aca008dcf74b45e340cefaf85f13e2c568b92c3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for histox 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.