Pre- and postprocessing scripts for prediction of biomarker status from HE-stained TMA-cores using. This repository is used to preprocess TMA images to use in the CLAM framework. TMA cores extracted and saved on disk as one image per patient.
To use the code, you need this:
- TMA slides (.tif)
- TMA maps or lists of which ids corresponds to which TMA core
- csv-file with biomarker status for each patient
- Annotate TMA-slides, correct id for each TMA core, in QuPath:
- Use TMA dearrayer to create a grid
- Run tma-to-annotations.groovy for all TMA-slides and add correct ids in the script
- Export TMA cores as separate .tiff images using export_cores.groovy.
- Combine TMA cores from each patient into single images
- If you have patient level labels, not TMA core level labels, you need to combine the TMA core images for each patient into a single image. For example if for id X you have three TMA cores and thus three .tiff images (X_a.tiff, X_b.tiff and X_c.tiff) you have to combine these into one image, X.tiff by:
python /path/to/repository/estrogen-receptor-prediction/preprocess/combine_tmas.py
- If you have patient level labels, not TMA core level labels, you need to combine the TMA core images for each patient into a single image. For example if for id X you have three TMA cores and thus three .tiff images (X_a.tiff, X_b.tiff and X_c.tiff) you have to combine these into one image, X.tiff by:
Note: QuPath script may be run from command line, see QuPath documentation: Command line.
The created core triplets can then be used for example in the CLAM fork to predict biomarkers.
Scripts for visualization or sorting of csv files and eventfiles from tensorboard can be found in the postprocess folder.
A big thank you to @petebankhead and the QuPath team for support and examples when implementing the groovy scripts.
Thank you to @Mahmoodlab for their CLAM pipeline:
@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} }