Integrated tumor and microenvironment subtyping refines the colorectal cancer classification system with prognostic and therapeutic implications
This repository contains the official implementation of CT4CMSPlus, a deep learning framework for predicting CMSPlus molecular sutypes of colorectal cancer from preoperative CT scans.
-
Python 3.8
-
PyTorch 2.4.1, torchvision 0.19.1
-
CUDA 11.3
-
For common packages, simply run:
pip install -r requirements.txt
If additional dependencies are missing, please install them manually.
All preprocessing scripts are located in the preprocess_data folder.
This script preprocesses colon CT scans by performing:
- Spatial alignment validation between CT and segmentation masks.
- Anisotropic resampling to 1.0 × 1.0 × 3.0 mm spacing.
- Hounsfield Unit (HU) windowing normalization with WL = 35, WW = 300.
python preprocess_colon_ct.pyThis unified script performs two major operations:
-
Radiomic Feature Extraction
-
Significant Radiomics Features Selection
python pyradiomics/extract_and_select_radiomics_features.pyDatasets should be defined in structured JSON format for model training and inference.
- Example —
training_dataset.json
{
"fold0": {
"training": {
"images/image1.nii.gz": {
"label": 0,
"roi": "labels/image1_roi.nii.gz"
},
"images/image2.nii.gz": {
"label": 1,
"roi": "labels/image2_roi.nii.gz"
}
},
"validation": {
"images/image3.nii.gz": {
"label": 0,
"roi": "labels/image3_roi.nii.gz"
},
"images/image4.nii.gz": {
"label": 1,
"roi": "labels/image4_roi.nii.gz"
}
}
},
"fold1": { "...": "..." }
}- Example —
inference_dataset.json
{
"training": null,
"validation": {
"images/image1.nii.gz": {
"label": "CMS4",
"roi": "labels/image1_roi.nii.gz"
},
"images/image2.nii.gz": {
"label": "CMS4",
"roi": "labels/image2_roi.nii.gz"
}
...
}
}All inference scripts are located in the train_infer_code folder.
Use CT4CMS to first predict CMS1–CMS4 molecular subtypes from preoperative CT scans:
Reference: [arXiv: Preprint link]
Then, use CT4CMSPlus to further stratify CMS4 cases into CMS4-TME(+) and CMS4-TME(-) subtypes.
Before running inference, prepare inference_dataset.json.
python inference.py --data_path ./preprocessed/1_1_3 \
--label_path ./path/inference_dataset.json \
--radiomics_path ./path/selected_radiomics_features.csv \
--pretrained ./pretrained_weights/model.pth \
--optimal_threshold 0.5We thank the developers of:
- [CT4CMS] for CMS classification
- Med3D (MedicalNet) for 3D-ResNet pretrained models used for transfer learning
This project is licensed for academic research use only.
Commercial or clinical usage is prohibited without explicit permission.