Radiomics feature extraction pipeline for HEST spatial transcriptomics datasets using WSI patches, CellViT nucleus segmentation, and PyRadiomics-based handcrafted features.
- Handcrafted radiomics feature extraction
- Patch-level intensity and texture descriptors (PyRadiomics)
- Cell-aware extraction using CellViT nucleus segmentation
- Cell-shape morphology features (shape2D aggregated statistics)
- Cell-composition and graph-based spatial interaction features
- Integrated download and preprocessing workflow for the HEST dataset
- Parallelized extraction with multiprocessing support
- Output in Parquet and H5AD (AnnData-compatible) formats
conda create -n hestradiomics python=3.10
conda activate hestradiomicsInstall torch and torchvision matching your CUDA version:
# Example for CUDA 12.1
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install "numpy>=1.24,<2.0.0"git clone https://github.com/gyoenge/hest-radiomics.git
cd hest-radiomics/
pip install -e .PyRadiomics requires a separate install step due to its build system:
pip install SimpleITK
pip install --no-build-isolation pyradiomics==3.0.1conda install -c conda-forge openslide
pip install openslide-python openslide-bin
pip install cellvitA HuggingFace token is required to download the HEST dataset:
export HF_TOKEN=hf_...Or add HF_TOKEN=hf_... to a .env file in the project root.
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
python -m hestradiomics.runCommon overrides via CLI arguments:
python -m hestradiomics.run \
--oncotrees IDC \
--sample_ids NCBI783 NCBI785 \
--device cuda:0 \
--extract_num_workers 8 \
--vis_ratio 0.05| Argument | Description |
|---|---|
--oncotrees |
Cancer type codes, e.g. IDC LUAD |
--sample_ids |
Specific sample IDs (default: all) |
--device |
Torch device for segmentation |
--segment_num_workers |
DataLoader workers for segmentation |
--extract_num_workers |
Process-pool workers for extraction |
--vis_ratio |
Fraction of patches to visualize (0.0–1.0) |
Outputs are saved under data/hestradiomics/<ONCOTREE>/.
Edit src/hestradiomics/config.py to change default settings (cancer types, sample IDs, model paths, mask sources, etc.). CLI arguments override config values for the current run without modifying the file.
See the Configuration docs for the full option reference.
Full documentation is available at hest-radiomics.readthedocs.io.
