This repository contains a comprehensive collection of state-of-the-art computational pathology methods for whole slide image (WSI) analysis, implemented as part of a final dissertation project. The project encompasses multiple deep learning approaches including attention-based multiple instance learning, graph neural networks, and foundation models for pathological image analysis.
This project explores various computational pathology approaches for analyzing whole slide images (WSIs) in cancer diagnosis and prognosis. The repository integrates several cutting-edge methods:
final_dissertation/
βββ CLAM/ # CLAM implementation for WSI classification
βββ Patch-GCN/ # Graph-based survival prediction
βββ TRIDENT/ # WSI processing toolkit
βββ SUGAR/ # Subgraph neural networks with RL
βββ prov-gigapath/ # GigaPath foundation model
βββ TCGA-WSI/ # TCGA dataset processing utilities
βββ TCGA-CLAM-graph/ # Processed TCGA data for graph methods
βββ TCGA-patches/ # Extracted patches from TCGA
βββ trident_processed/ # Processed WSI data using TRIDENT
βββ test/ # Test data and validation files
Clone the repository
git clone <your-repository-url>
cd final_dissertation
Set up individual environments
Each method has its own environment requirements. Choose the method you want to use:
For CLAM:
cd CLAM
conda env create -f env.yml
conda activate clam
For TRIDENT:
cd TRIDENT
conda create -n trident python=3.10
conda activate trident
pip install -e .
For SUGAR:
cd SUGAR
pip install -r requirements.txt
For GigaPath:
cd prov-gigapath
conda env create -f environment.yaml
conda activate gigapath
CLAM enables slide-level classification without patch-level annotations.
cd CLAM
# Segmentation and patching
python create_patches_fp.py --source DATA_DIRECTORY --save_dir RESULTS_DIRECTORY --patch_size 256 --seg --patch --stitch
# Feature extraction
python extract_features_fp.py --data_h5_dir RESULTS_DIRECTORY --data_slide_dir DATA_DIRECTORY --csv_path dataset_csv/tumor_vs_normal_dummy_clean.csv --feat_dir FEATURES_DIRECTORY
# Training
python main.py --drop_out --early_stopping --lr 2e-4 --k 10 --label_frac 1.0 --exp_code tumor_vs_normal_CLAM_50 --weighted_sample --bag_loss ce --inst_loss svm --task tumor_vs_normal --model_type clam_sb --log_data --data_root_dir FEATURES_DIRECTORY
Formulates WSIs as graphs for context-aware analysis.
cd Patch-GCN
# WSI-Graph Construction
python "WSI-Graph Construction.py"
# Training
python main.py --task tcga_kidney_cv --split_dir tcga_kidney_100 --gc 32
High-performance WSI processing with foundation model support.
cd TRIDENT
# Process single slide
python run_single_slide.py --slide_path ./wsis/slide.svs --job_dir ./processed --patch_encoder uni_v1 --mag 20 --patch_size 256
# Batch processing
python run_batch_of_slides.py --task all --wsi_dir ./wsis --job_dir ./processed --patch_encoder uni_v1 --mag 20 --patch_size 256
Graph neural networks with reinforcement learning pooling.
cd SUGAR
python train.py
The project works with several major pathology datasets:
TCGA (The Cancer Genome Atlas): Multi-cancer WSI dataset
Graph Datasets: MUTAG, DD, NCI1, NCI109, PTC_MR, ENZYMES, PROTEINS
TCGA-WSI/
βββ BLCA/ # Bladder cancer WSIs
βββ BRCA/ # Breast cancer WSIs
βββ LUAD/ # Lung cancer WSIs
βββ UCEC/ # Uterine cancer WSIs
TCGA-patches/ # Extracted tissue patches
TCGA-CLAM-graph/ # Graph representations
The project includes comprehensive evaluation scripts and benchmarks:
Detailed documentation for each method can be found in their respective directories:
CLAM/docs/ - CLAM documentation and tutorialsTRIDENT/docs/ - TRIDENT user guidePatch-GCN/docs/ - Patch-GCN implementation detailsThis is a research project developed for academic purposes. For questions or collaboration opportunities, please feel free to reach out.
Each component retains its original license:
If you use this work, please cite the relevant papers:
@article{lu2021data,
title={Data-efficient and weakly supervised computational pathology on whole-slide images},
author={Lu, Ming Y and Williamson, Drew FK and Chen, Tiffany Y and Chen, Richard J and Barbieri, Matteo and Mahmood, Faisal},
journal={Nature biomedical engineering},
volume={5},
number={6},
pages={555--570},
year={2021},
publisher={Nature Publishing Group}
}
@incollection{chen2021whole,
title={Whole Slide Images are 2D Point Clouds: Context-Aware Survival Prediction using Patch-based Graph Convolutional Networks},
author={Chen, Richard J and Lu, Ming Y and Shaban, Muhammad and Chen, Chengkuan and Chen, Tiffany Y and Williamson, Drew FK and Mahmood, Faisal},
booktitle={Medical Image Computing and Computer Assisted Intervention--MICCAI 2021},
pages={339--349},
year={2021},
publisher={Springer}
}
@article{chen2025trident,
title={Trident: A foundation model for digital pathology},
author={Chen, Richard J and others},
journal={arXiv preprint arXiv:2502.06750},
year={2025}
}
Developed as part of UCL Final Dissertation Project
Advancing Computational Pathology through Deep Learning and Graph Neural Networks
1 commits
Jupyter Notebook
64.5%
Python
35.3%
This repository contains a comprehensive collection of state-of-the-art computational pathology methods for whole slide image (WSI) analysis, implemented as part of a final dissertation project. The project encompasses multiple deep learning approaches including attention-based multiple instance learning, graph neural networks, and foundation models for pathological image analysis.
This project explores various computational pathology approaches for analyzing whole slide images (WSIs) in cancer diagnosis and prognosis. The repository integrates several cutting-edge methods:
final_dissertation/
βββ CLAM/ # CLAM implementation for WSI classification
βββ Patch-GCN/ # Graph-based survival prediction
βββ TRIDENT/ # WSI processing toolkit
βββ SUGAR/ # Subgraph neural networks with RL
βββ prov-gigapath/ # GigaPath foundation model
βββ TCGA-WSI/ # TCGA dataset processing utilities
βββ TCGA-CLAM-graph/ # Processed TCGA data for graph methods
βββ TCGA-patches/ # Extracted patches from TCGA
βββ trident_processed/ # Processed WSI data using TRIDENT
βββ test/ # Test data and validation files
Clone the repository
git clone <your-repository-url>
cd final_dissertation
Set up individual environments
Each method has its own environment requirements. Choose the method you want to use:
For CLAM:
cd CLAM
conda env create -f env.yml
conda activate clam
For TRIDENT:
cd TRIDENT
conda create -n trident python=3.10
conda activate trident
pip install -e .
For SUGAR:
cd SUGAR
pip install -r requirements.txt
For GigaPath:
cd prov-gigapath
conda env create -f environment.yaml
conda activate gigapath
CLAM enables slide-level classification without patch-level annotations.
cd CLAM
# Segmentation and patching
python create_patches_fp.py --source DATA_DIRECTORY --save_dir RESULTS_DIRECTORY --patch_size 256 --seg --patch --stitch
# Feature extraction
python extract_features_fp.py --data_h5_dir RESULTS_DIRECTORY --data_slide_dir DATA_DIRECTORY --csv_path dataset_csv/tumor_vs_normal_dummy_clean.csv --feat_dir FEATURES_DIRECTORY
# Training
python main.py --drop_out --early_stopping --lr 2e-4 --k 10 --label_frac 1.0 --exp_code tumor_vs_normal_CLAM_50 --weighted_sample --bag_loss ce --inst_loss svm --task tumor_vs_normal --model_type clam_sb --log_data --data_root_dir FEATURES_DIRECTORY
Formulates WSIs as graphs for context-aware analysis.
cd Patch-GCN
# WSI-Graph Construction
python "WSI-Graph Construction.py"
# Training
python main.py --task tcga_kidney_cv --split_dir tcga_kidney_100 --gc 32
High-performance WSI processing with foundation model support.
cd TRIDENT
# Process single slide
python run_single_slide.py --slide_path ./wsis/slide.svs --job_dir ./processed --patch_encoder uni_v1 --mag 20 --patch_size 256
# Batch processing
python run_batch_of_slides.py --task all --wsi_dir ./wsis --job_dir ./processed --patch_encoder uni_v1 --mag 20 --patch_size 256
Graph neural networks with reinforcement learning pooling.
cd SUGAR
python train.py
The project works with several major pathology datasets:
TCGA (The Cancer Genome Atlas): Multi-cancer WSI dataset
Graph Datasets: MUTAG, DD, NCI1, NCI109, PTC_MR, ENZYMES, PROTEINS
TCGA-WSI/
βββ BLCA/ # Bladder cancer WSIs
βββ BRCA/ # Breast cancer WSIs
βββ LUAD/ # Lung cancer WSIs
βββ UCEC/ # Uterine cancer WSIs
TCGA-patches/ # Extracted tissue patches
TCGA-CLAM-graph/ # Graph representations
The project includes comprehensive evaluation scripts and benchmarks:
Detailed documentation for each method can be found in their respective directories:
CLAM/docs/ - CLAM documentation and tutorialsTRIDENT/docs/ - TRIDENT user guidePatch-GCN/docs/ - Patch-GCN implementation detailsThis is a research project developed for academic purposes. For questions or collaboration opportunities, please feel free to reach out.
Each component retains its original license:
If you use this work, please cite the relevant papers:
@article{lu2021data,
title={Data-efficient and weakly supervised computational pathology on whole-slide images},
author={Lu, Ming Y and Williamson, Drew FK and Chen, Tiffany Y and Chen, Richard J and Barbieri, Matteo and Mahmood, Faisal},
journal={Nature biomedical engineering},
volume={5},
number={6},
pages={555--570},
year={2021},
publisher={Nature Publishing Group}
}
@incollection{chen2021whole,
title={Whole Slide Images are 2D Point Clouds: Context-Aware Survival Prediction using Patch-based Graph Convolutional Networks},
author={Chen, Richard J and Lu, Ming Y and Shaban, Muhammad and Chen, Chengkuan and Chen, Tiffany Y and Williamson, Drew FK and Mahmood, Faisal},
booktitle={Medical Image Computing and Computer Assisted Intervention--MICCAI 2021},
pages={339--349},
year={2021},
publisher={Springer}
}
@article{chen2025trident,
title={Trident: A foundation model for digital pathology},
author={Chen, Richard J and others},
journal={arXiv preprint arXiv:2502.06750},
year={2025}
}
Developed as part of UCL Final Dissertation Project
Advancing Computational Pathology through Deep Learning and Graph Neural Networks
1 commits
Jupyter Notebook
64.5%
Python
35.3%