MedCAI/HCCExplorer

14

stars

45

commits

Jupyter Notebook

primary language

Mar 4, 2026

updated

README

HCCExplorer: Transforming Histology into Virtual Multiplex Immunofluorescence to Decode Tumor Immune Microenvironment in Hepatocellular Carcinoma

License Python

This repository contains the official implementation of HCCExplorer, a deep learning framework that transforms standard H&E slides into virtual multiplex immunofluorescence (mIF) images and performs spatially resolved survival analysis for hepatocellular carcinoma (HCC). Specific tutorials are in directories.

πŸ”¬ Overview

HCCExplorer Overview
Figure 1: HCCExplorer framework overview. [View Full PNG]

🌟 Key Features

ModuleDescriptionStatus
C3UTCell-Consistent Cross-modal Unpaired Translation for H&E-to-virtual mIF generationβœ…
CellFilterQuality control pipeline for H&E and mIF cell segmentationβœ…
CoOptimizationMulti-modal contrastive learning for H&E-virtual mIF feature alignmentβœ…
GraphLearningGraph-based contextual survival prediction with interpretable attentionβœ…
ImmuneAnalysisSpatial immune feature extraction and prognostic biomarker discoveryβœ…
RegistrationWhole-slide image registration and patch alignmentβœ…

πŸ”¬ Overview

HCCExplorer addresses critical limitations in routine hepatopathology by:

  1. Virtual Immunophenotyping: Generates high-fidelity virtual mIF images (CD3, CD4, CD8, CD19, CD68, Foxp3, DAPI) from standard H&E slides without physical staining
  2. Spatial Prognostic Modeling: Captures tumor-immune microenvironment (TIME) interactions through hierarchical graph learning
  3. Biomarker Discovery: Identifies macrophage-mediated "Containment Niche" as a protective spatial signature at the invasion frontier

Performance Highlights

  • C-index: 0.71 (95% CI: 0.67–0.76) for overall survival prediction
  • Data Efficiency: Trained on only 30 paired slides, generalized to 1,813 patients across 4 centers
  • Superior Generalization: Outperforms pathology foundation models (UNI-h2, CHIEF, Prov-GigaPath, TITAN) and proteomics foundation model (KRONOS)

πŸ“ Repository Structure

HCCExplorer/
β”œβ”€β”€ C3UT/                    # Virtual mIF translation (Cell-Consistent Cross-modal Unpaired Translation)
    └── Tutorial             # Step-by-step guide for H&E-to-mIF generation
β”œβ”€β”€ CellFilter               # Cell segmentation and quality control
    └── Tutorial             # Data preprocessing and cell filtering protocols
β”œβ”€β”€ CoOptimization/          # H&E-virtual mIF feature co-optimization
    └── Tutorial             # Multi-modal contrastive learning pipeline
β”œβ”€β”€ GraphLearning/           # Graph-based survival analysis
    └── Tutorial             # Graph construction and survival prediction
β”œβ”€β”€ ImmuneAnalysis/          # Spatial immune feature extraction
    └── Tutorial             # Immune profiling and biomarker validation
└── Registration/            # WSI registration and spatial alignment
    └── Tutorial             # Image registration workflows

Note: Each module contains a dedicated Tutorial notebook with detailed documentation, usage examples, and step-by-step instructions.

πŸš€ Quick Start

Prerequisites

# Python 3.8+
pip install torch>=1.12.0 torchvision>=0.13.0
pip install openslide-python numpy pandas scikit-learn
pip install torch-geometric torch-scatter torch-sparse  # For GraphLearning

1. Virtual mIF Generation (C3UT)

πŸ“– Detailed tutorial: See C3UT/Tutorial

2. Feature Co-Optimization

πŸ“– Detailed tutorial: See CoOptimization/Tutorial

3. Survival Prediction (GraphLearning)

πŸ“– Detailed tutorial: See GraphLearning/Tutorial

4. Immune Feature Analysis

πŸ“– Detailed tutorial: See ImmuneAnalysis/Tutorial

πŸ“Š Datasets

The framework was validated on four independent cohorts:

CohortInstitutionPatientsSlidesUsage
FAZJUFirst Affiliated Hospital, Zhejiang University9491,017Training
FAZJU-TestInternal test set237237Internal validation
SAZJUSecond Affiliated Hospital, Zhejiang University211211External validation
TCGA-LIHCThe Cancer Genome Atlas342342External validation
YWCHYiwu Central Hospital7474External validation

πŸ” Key Biological Findings

HCCExplorer enabled discovery of:

  1. Macrophage Infiltration: Most significant protective factor (HR=0.51, P<0.001)
  2. M1 Polarization: Pro-inflammatory macrophages drive survival benefit (HR=0.40, P<0.05)
  3. Containment Niche: Macrophage-orchestrated immune barrier at invasion frontier (P<0.01)
  4. Spatial Co-localization: Foxp3+ Tregs and CD4+ T cells cooperate with macrophages at tumor boundary

πŸ› οΈ Installation

# Clone repository
git clone https://github.com/MedCAI/HCCExplorer.git
cd HCCExplorer

# Install dependencies in each directory
pip install -r requirements.txt

# Download pretrained weights (available upon request for academic use)

πŸ“š Citation

If you use HCCExplorer in your research, please cite:

@article{cai2026hccexplorer,
  title={Transforming Histology into Virtual Multiplex Immunofluorescence to Decode Prognostic Spatial Immunity in Hepatocellular Carcinoma},
  author={Cai, Linghan and Jiang, Songhan and Liang, Junhao and Liu, Fengchun and Zhang, Buyi and Reitsam, Nic Gabriel and Zeng, Qinghe and Hu, Zheqi and Ma, Yanqing and Li, Ziqian and Shi, Feng and Hu, Maotong and Zhang, Xiuming and Zhang, Jing and Kather, Jakob Nikolas and Zhang, Yongbing and Liang, Wenjie},
  journal={BioRxiv},
  year={2026}
}

πŸ“§ Contact

For questions about the code or model access:

🀝 Contributing

Thanks to the following work for improving our project:

πŸ“œ License

This code is made available for academic research purposes only. Commercial use requires explicit permission from the authors.

Contributors

MedCAI

45 commits

MedCAI/HCCExplorer

14

stars

45

commits

Jupyter Notebook

primary language

Mar 4, 2026

updated

README

HCCExplorer: Transforming Histology into Virtual Multiplex Immunofluorescence to Decode Tumor Immune Microenvironment in Hepatocellular Carcinoma

License Python

This repository contains the official implementation of HCCExplorer, a deep learning framework that transforms standard H&E slides into virtual multiplex immunofluorescence (mIF) images and performs spatially resolved survival analysis for hepatocellular carcinoma (HCC). Specific tutorials are in directories.

πŸ”¬ Overview

HCCExplorer Overview
Figure 1: HCCExplorer framework overview. [View Full PNG]

🌟 Key Features

ModuleDescriptionStatus
C3UTCell-Consistent Cross-modal Unpaired Translation for H&E-to-virtual mIF generationβœ…
CellFilterQuality control pipeline for H&E and mIF cell segmentationβœ…
CoOptimizationMulti-modal contrastive learning for H&E-virtual mIF feature alignmentβœ…
GraphLearningGraph-based contextual survival prediction with interpretable attentionβœ…
ImmuneAnalysisSpatial immune feature extraction and prognostic biomarker discoveryβœ…
RegistrationWhole-slide image registration and patch alignmentβœ…

πŸ”¬ Overview

HCCExplorer addresses critical limitations in routine hepatopathology by:

  1. Virtual Immunophenotyping: Generates high-fidelity virtual mIF images (CD3, CD4, CD8, CD19, CD68, Foxp3, DAPI) from standard H&E slides without physical staining
  2. Spatial Prognostic Modeling: Captures tumor-immune microenvironment (TIME) interactions through hierarchical graph learning
  3. Biomarker Discovery: Identifies macrophage-mediated "Containment Niche" as a protective spatial signature at the invasion frontier

Performance Highlights

  • C-index: 0.71 (95% CI: 0.67–0.76) for overall survival prediction
  • Data Efficiency: Trained on only 30 paired slides, generalized to 1,813 patients across 4 centers
  • Superior Generalization: Outperforms pathology foundation models (UNI-h2, CHIEF, Prov-GigaPath, TITAN) and proteomics foundation model (KRONOS)

πŸ“ Repository Structure

HCCExplorer/
β”œβ”€β”€ C3UT/                    # Virtual mIF translation (Cell-Consistent Cross-modal Unpaired Translation)
    └── Tutorial             # Step-by-step guide for H&E-to-mIF generation
β”œβ”€β”€ CellFilter               # Cell segmentation and quality control
    └── Tutorial             # Data preprocessing and cell filtering protocols
β”œβ”€β”€ CoOptimization/          # H&E-virtual mIF feature co-optimization
    └── Tutorial             # Multi-modal contrastive learning pipeline
β”œβ”€β”€ GraphLearning/           # Graph-based survival analysis
    └── Tutorial             # Graph construction and survival prediction
β”œβ”€β”€ ImmuneAnalysis/          # Spatial immune feature extraction
    └── Tutorial             # Immune profiling and biomarker validation
└── Registration/            # WSI registration and spatial alignment
    └── Tutorial             # Image registration workflows

Note: Each module contains a dedicated Tutorial notebook with detailed documentation, usage examples, and step-by-step instructions.

πŸš€ Quick Start

Prerequisites

# Python 3.8+
pip install torch>=1.12.0 torchvision>=0.13.0
pip install openslide-python numpy pandas scikit-learn
pip install torch-geometric torch-scatter torch-sparse  # For GraphLearning

1. Virtual mIF Generation (C3UT)

πŸ“– Detailed tutorial: See C3UT/Tutorial

2. Feature Co-Optimization

πŸ“– Detailed tutorial: See CoOptimization/Tutorial

3. Survival Prediction (GraphLearning)

πŸ“– Detailed tutorial: See GraphLearning/Tutorial

4. Immune Feature Analysis

πŸ“– Detailed tutorial: See ImmuneAnalysis/Tutorial

πŸ“Š Datasets

The framework was validated on four independent cohorts:

CohortInstitutionPatientsSlidesUsage
FAZJUFirst Affiliated Hospital, Zhejiang University9491,017Training
FAZJU-TestInternal test set237237Internal validation
SAZJUSecond Affiliated Hospital, Zhejiang University211211External validation
TCGA-LIHCThe Cancer Genome Atlas342342External validation
YWCHYiwu Central Hospital7474External validation

πŸ” Key Biological Findings

HCCExplorer enabled discovery of:

  1. Macrophage Infiltration: Most significant protective factor (HR=0.51, P<0.001)
  2. M1 Polarization: Pro-inflammatory macrophages drive survival benefit (HR=0.40, P<0.05)
  3. Containment Niche: Macrophage-orchestrated immune barrier at invasion frontier (P<0.01)
  4. Spatial Co-localization: Foxp3+ Tregs and CD4+ T cells cooperate with macrophages at tumor boundary

πŸ› οΈ Installation

# Clone repository
git clone https://github.com/MedCAI/HCCExplorer.git
cd HCCExplorer

# Install dependencies in each directory
pip install -r requirements.txt

# Download pretrained weights (available upon request for academic use)

πŸ“š Citation

If you use HCCExplorer in your research, please cite:

@article{cai2026hccexplorer,
  title={Transforming Histology into Virtual Multiplex Immunofluorescence to Decode Prognostic Spatial Immunity in Hepatocellular Carcinoma},
  author={Cai, Linghan and Jiang, Songhan and Liang, Junhao and Liu, Fengchun and Zhang, Buyi and Reitsam, Nic Gabriel and Zeng, Qinghe and Hu, Zheqi and Ma, Yanqing and Li, Ziqian and Shi, Feng and Hu, Maotong and Zhang, Xiuming and Zhang, Jing and Kather, Jakob Nikolas and Zhang, Yongbing and Liang, Wenjie},
  journal={BioRxiv},
  year={2026}
}

πŸ“§ Contact

For questions about the code or model access:

🀝 Contributing

Thanks to the following work for improving our project:

πŸ“œ License

This code is made available for academic research purposes only. Commercial use requires explicit permission from the authors.

Contributors

MedCAI

45 commits

Languages

Jupyter Notebook

96.9%

Python

2.8%