Abstract
The inspection of stained tissue slides by pathologists is essential for the early detection, diagnosis and monitoring of disease. Recently, deep learning methods for the analysis of whole-slide images (WSIs) have shown excellent performance on these tasks, and have the potential to substantially reduce the workload of pathologists. However, successful implementation of deep learning for WSI analysis is complex and requires careful consideration of model hyperparameters, slide and image artefacts, and data augmentation. Here we introduce PathML, a Python library for performing preand post-processing of WSIs, which has been designed to interact with the most widely used deep learning libraries, PyTorch and TensorFlow, thus allowing seamless integration into deep learning workflows. We present the current best practices in deep learning for WSI analysis, and give a step-by-step guide using the PathML framework: from annotating and pre-processing of slides, to implementing neural network architectures, to training and post-processing. PathML provides a unified framework in which deep learning methods for WSI analysis can be developed and applied, thus increasing the accessibility of an important new application of deep learning.
Competing Interest Statement
M.G. is an employee and shareholder of Cyted Ltd. F.M. is the founder and director of Tailor Bio.
Funding Statement
This research was supported by Cancer Research UK (FM: C14303/A17197). A.B. acknowledges support from a Gates Cambridge Scholarship from the Gates Foundation. W.O. acknowledges support from a Peterhouse Studentship from Peterhouse, Cambridge. M.G. acknowledges support from an Enrichment Fellowship from the Alan Turing Institute.
Author Declarations
I confirm all relevant ethical guidelines have been followed, and any necessary IRB and/or ethics committee approvals have been obtained.
Yes
The details of the IRB/oversight body that provided approval or exemption for the research described are given below:
N/A
All necessary patient/participant consent has been obtained and the appropriate institutional forms have been archived.
Yes
I understand that all clinical trials and any other prospective interventional studies must be registered with an ICMJE-approved registry, such as ClinicalTrials.gov. I confirm that any such study reported in the manuscript has been registered and the trial registration ID is provided (note: if posting a prospective study registered retrospectively, please provide a statement in the trial ID field explaining why the study was not registered in advance).
Yes
I have followed all appropriate research reporting guidelines and uploaded the relevant EQUATOR Network research reporting checklist(s) and other pertinent material as supplementary files, if applicable.
Yes
Data Availability
CODE AVAILABILITY: The source code of PathML is freely available at the following public repository: https://github.com/markowetzlab/pathml. The source code of the tutorial presented in the Procedure section of the manuscript is also freely available at the following public repository: https://github.com/markowetzlab/pathml-tutorial. That repository also contains the code used to train PathML's deep tissue detector in its "deep_tissue_detector" subdirectory. DATA AVAILABILITY: The whole-slide images (WSIs) used in the tutorial presented in the Procedure section, along with the annotation files demarcating regions of metastasis in each WSI, are publicly available at the following link: https://drive.google.com/drive/folders/0BzsdkU4jWx9Ba2x1NTZhdzQ5Zjg?resourcekey=0-g2TRih6YKi5P2O1SiBB1LA. Note that the "annotations" directory in the pathml-tutorial repository (https://github.com/markowetzlab/pathml-tutorial) contains corrected versions of some of the annotation files present in the CAMELYON16 Google Drive link above (some of the original annotation files contained small self-overlapping regions), so the .xml files in "annotations" are recommended in lieu of the originals. A copy of the results from a full Procedure run can be found at the pathml-tutorial repository. A complete run of the tutorial presented in the Procedure section of the manuscript include all outputs can be found at the following link: https://doi.org/10.5281/zenodo.5006409. The WSIs used to train PathML's deep tissue detector are governed by data usage policies specified by the data controller (University of Cambridge, Cancer Research UK). We are committed to complying with Cancer Research UK's Data Sharing and Preservation Policy. Whole-slide images used in this study will be available for non-commercial research purposes upon approval by a Data Access Committee according to institutional requirements. Applications for data access should be directed to florian.markowetz{at}cruk.cam.ac.uk. The annotation .xml files corresponding to these WSIs are publicly available in the "deep_tissue_detector" subdirectory of the pathml-tutorial repository.
https://github.com/markowetzlab/pathml