Arpit Aggarwal and Anant Madabhushi
Matlab and Python were used for this study.
The packages required for running this code are PyTorch, Numpy, Openslide, PIL, OpenCV, Pandas, Sklearn, and Matplotlib.
The main steps involved in the Collagen biomarker are as follows:
- Preprocessing steps (Stroma segmentation)
- Extracting collagen features
-
Preprocessing steps
a. Epithelium/Stroma segmentation - To segment the epithelium/stromal regions on the patches extracted above, run the pretrained epithelium/stroma model 'python3 code/epithelium_stroma_segmentation.py'. The model weights file are located at 'code/epi_seg_unet.pth'.
In the epithelium/stroma mask, the white regions correspond to the tumor/epithelium areas and the black regions correspond to the stromal areas. We will use the black regions for segmenting collagen fibers and the following code automatically handles it (255-epi_stroma_mask). -
Extracting collagen features
For extracting the collagen features run the file (code/main_patchLevelFeatures.py) that generates the Collagen Fiber Orientation Disorder map for each patch extracted. The feature maps will be stored over here 'results/patches'.
After obtaining the feature maps for each tile, run the file (code/main_patientLevelFeatures.py) that gives patient-level features (mean and maximum) for each patient, giving a total of 36 features. The features for each patient will be stored over here 'results/features' which can be used for downstream tasks like survival analysis etc.
Using the extracted features, use the notebook 'code/collagen_signature_TAM.ipynb' for an example demo for running the survival analysis pipeline.
Madabhushi Lab - This code is made available under Apache 2.0 with Commons Clause License and is available for non-commercial academic purposes.