Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Analysis of Tissue Heterogeneity in Graph Neural Networks

This project evaluates how graph construction methods affect a GNN's capability to capture spatial heterogeneity in cancerous tissue in the Grand Challenge on Breast Cancer Histology Images.

About the Dataset

The Grand Challenge included 400 microscopy images of 4 classes of breast cancer. For the purpose of this project, I used two classes (cancerous and non-cancerous). While the model achieved relatively high classification accuracy (around 90%), the primary focus of this work is on evaluating how different graph construction strategies preserve spatial heterogeneity patterns.

Repository Structure

  • notebooks/

    • analysis.ipynb — Explanation of full experimental pipeline and visualization of results
  • src/

    • graph_construction_helpers.py — Spatial graph construction methods
    • visualizers.py — All plotting and visualization utilities
    • data_helpers.py — Dataset loading and preprocessing
    • extract_features.py - Extracts and saves DenseNet-121 features from WSIs
    • macenko_normalizer.py - Helper class for macenko normalization
    • train_gnn.py — GNN model definition and training
    • test_heterogeneity.py - Analyzes tissue heterogeneity in DenseNet features and trained GNNs
    • test_gnn.py - Tests GNN ensemble accuracy
  • data/

    • CSV outputs from heterogeneity experiments
  • requirements.txt

How to Run

  1. Install dependencies:
    pip install -r requirements.txt
  2. Update the bach_directory path in constants.py to match the path to the Photos folder of the BACH dataset.
  3. Open and run notebooks/analysis.ipynb. All figures and results will be generated.
  4. The training pipeline from start to end involves running train_test_split.pyextract_features.pytrain_gnn.py.
  5. To rerun heterogeneity metrics, run test_heterogeneity.py.
  6. To retrain models, run train_gnn.py.

The project also includes support for the BreakHis dataset, although no data from BreakHis was used in analysis due to variations in magnification between the two datasets. Update the breakhis_directory path in constants.py. Each file contains a flag that defines

dataset = "bach"

To run that file on BreakHis, change the flag to

dataset = "breakhis"

Methods Overview

  • Patch-level feature extraction using pretrained CNNs
  • Graph construction based on spatial and feature relationships:
    • Euclidean radius
    • Spatial k-NN
    • Delaunay triangulation
    • Feature k-NN
  • Local heterogeneity quantified via neighborhood cosine dissimilarity
  • GraphSAGE used to study learned aggregation effects

References

[1] Brussee, S., Buzzanca, G., Schrader, A. M. R., & Kers, J. (2025). Graph neural networks in histopathology: Emerging trends and future directions. Medical Image Analysis, 101, 103444. https://doi.org/10.1016/j.media.2024.103444

[2] Dolezal, J.M., Kochanny, S., Dyer, E. et al. Slideflow: deep learning for digital histopathology with real-time whole-slide visualization. BMC Bioinformatics 25, 134 (2024). https://doi.org/10.1186/s12859-024-05758-x

[3] Hameed, Z., Garcia-Zapirain, B., Aguirre, J.J. et al. Multiclass classification of breast cancer histopathology images using multilevel features of deep convolutional neural network. Sci Rep 12, 15600 (2022). https://doi.org/10.1038/s41598-022-19278-2

[4] Hamilton, William & Ying, Rex & Leskovec, Jure. (2017). Inductive Representation Learning on Large Graphs. 10.48550/arXiv.1706.02216.

[5] Huang, G., Liu, Z., Van Der Maaten, L., & Weinberger, K. Q. (2017). Densely connected Convolutional Networks. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2261–2269. https://doi.org/10.1109/cvpr.2017.243

[6] Macenko, M., Niethammer, M., Marron, J. S., Borland, D., Woosley, J. T., Xiaojun Guan, Schmitt, C., & Thomas, N. E. (2009). A method for normalizing histology slides for quantitative analysis. 2009 IEEE International Symposium on Biomedical Imaging: From Nano to Macro, 1107–1110. https://doi.org/10.1109/isbi.2009.5193250

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages