Skip to content

Latest commit

 

History

284 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HEST-Radiomics (hestradiomics)

docs python pytorch dataset license

Radiomics feature extraction pipeline for HEST spatial transcriptomics datasets using WSI patches, CellViT nucleus segmentation, and PyRadiomics-based handcrafted features.

Overview


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

Installation

1. Create conda environment

conda create -n hestradiomics python=3.10
conda activate hestradiomics

2. Install PyTorch

Install 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"

3. Install hestradiomics

git clone https://github.com/gyoenge/hest-radiomics.git
cd hest-radiomics/
pip install -e .

4. Install PyRadiomics

PyRadiomics requires a separate install step due to its build system:

pip install SimpleITK
pip install --no-build-isolation pyradiomics==3.0.1

5. Install CellViT dependencies

conda install -c conda-forge openslide
pip install openslide-python openslide-bin
pip install cellvit

6. Set HuggingFace token

A 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.


Quick Start

export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
python -m hestradiomics.run

Common 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>/.


Configuration

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.


Documentation

Full documentation is available at hest-radiomics.readthedocs.io.

About

Radiomics-based feature extraction pipeline for the HEST dataset using PyRadiomics and CellViT, supporting intensity, texture, cell-shape, and cell-composition descriptors.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages