Table of Contents
Fetching ...

AtlasPatch: An Efficient and Scalable Tool for Whole Slide Image Preprocessing in Computational Pathology

Ahmed Alagha, Christopher Leclerc, Yousef Kotp, Omar Metwally, Calvin Moras, Peter Rentopoulos, Ghodsiyeh Rostami, Bich Ngoc Nguyen, Jumanah Baig, Abdelhakim Khellaf, Vincent Quoc-Huy Trinh, Rabeb Mizouni, Hadi Otrok, Jamal Bentahar, Mahdi S. Hosseini

TL;DR

WSI preprocessing is a major bottleneck for scalable computational pathology. AtlasPatch proposes a thumbnail-based tissue-detection approach, fine-tuned efficiently on SAM2 via Layer Normalization fine-tuning, followed by contour extrapolation to full-resolution slides to produce patch coordinates and embeddings for MIL. The method is validated on a large, diverse multi-cohort dataset and demonstrates strong tissue-detection performance, significant runtime reductions, and competitive downstream MIL accuracy across six tasks, with far fewer patches per slide. This work provides an open-source, modular solution that scales with foundation-model-scale pathology workflows and reduces preprocessing costs without compromising accuracy.

Abstract

Whole-slide image (WSI) preprocessing, typically comprising tissue detection followed by patch extraction, is foundational to AI-driven computational pathology workflows. This remains a major computational bottleneck as existing tools either rely on inaccurate heuristic thresholding for tissue detection, or adopt AI-based approaches trained on limited-diversity data that operate at the patch level, incurring substantial computational complexity. We present AtlasPatch, an efficient and scalable slide preprocessing framework for accurate tissue detection and high-throughput patch extraction with minimal computational overhead. AtlasPatch's tissue detection module is trained on a heterogeneous and semi-manually annotated dataset of ~30,000 WSI thumbnails, using efficient fine-tuning of the Segment-Anything model. The tool extrapolates tissue masks from thumbnails to full-resolution slides to extract patch coordinates at user-specified magnifications, with options to stream patches directly into common image encoders for embedding or store patch images, all efficiently parallelized across CPUs and GPUs. We assess AtlasPatch across segmentation precision, computational complexity, and downstream multiple-instance learning, matching state-of-the-art performance while operating at a fraction of their computational cost. AtlasPatch is open-source and available at https://github.com/AtlasAnalyticsLab/AtlasPatch.

AtlasPatch: An Efficient and Scalable Tool for Whole Slide Image Preprocessing in Computational Pathology

TL;DR

WSI preprocessing is a major bottleneck for scalable computational pathology. AtlasPatch proposes a thumbnail-based tissue-detection approach, fine-tuned efficiently on SAM2 via Layer Normalization fine-tuning, followed by contour extrapolation to full-resolution slides to produce patch coordinates and embeddings for MIL. The method is validated on a large, diverse multi-cohort dataset and demonstrates strong tissue-detection performance, significant runtime reductions, and competitive downstream MIL accuracy across six tasks, with far fewer patches per slide. This work provides an open-source, modular solution that scales with foundation-model-scale pathology workflows and reduces preprocessing costs without compromising accuracy.

Abstract

Whole-slide image (WSI) preprocessing, typically comprising tissue detection followed by patch extraction, is foundational to AI-driven computational pathology workflows. This remains a major computational bottleneck as existing tools either rely on inaccurate heuristic thresholding for tissue detection, or adopt AI-based approaches trained on limited-diversity data that operate at the patch level, incurring substantial computational complexity. We present AtlasPatch, an efficient and scalable slide preprocessing framework for accurate tissue detection and high-throughput patch extraction with minimal computational overhead. AtlasPatch's tissue detection module is trained on a heterogeneous and semi-manually annotated dataset of ~30,000 WSI thumbnails, using efficient fine-tuning of the Segment-Anything model. The tool extrapolates tissue masks from thumbnails to full-resolution slides to extract patch coordinates at user-specified magnifications, with options to stream patches directly into common image encoders for embedding or store patch images, all efficiently parallelized across CPUs and GPUs. We assess AtlasPatch across segmentation precision, computational complexity, and downstream multiple-instance learning, matching state-of-the-art performance while operating at a fraction of their computational cost. AtlasPatch is open-source and available at https://github.com/AtlasAnalyticsLab/AtlasPatch.
Paper Structure (17 sections, 2 equations, 12 figures)

This paper contains 17 sections, 2 equations, 12 figures.

Figures (12)

  • Figure 1: Overview of the AtlasPatch pipeline, dataset curation, and efficient finetuning of the tissue detection model. A. AtlasPatch slide-preprocessing pipeline. Following the acquisition of diagnostic WSIs as multi-resolution pyramids, AtlasPatch utilizes the thumbnail for tissue detection using the finetuned SAM2 model, then extrapolates the resulting contour into the desired high resolution. This is followed by computing patch coordinates for downstream patch image export or feature embeddings. B. Diverse dataset curation and semi-manual annotation for training the tissue detector. The model in AtlasPatch is finetuned on a heterogeneous multi-organ corpus combining multiple public cohorts as well as private in-house WSIs. Slides from each dataset are curated, and annotators performed semi-manual boundary tracing of tissue on WSI thumbnails under a standardized protocol using Labelbox, yielding a large annotated dataset ($\sim$30k pairs) of tissue-versus-background masks. C. Thumbnail-based efficient finetuning of SAM2. The segmentation model is trained on the curated thumbnails dataset by only finetuning the normalization layers of the SAM2 model, which represent approximately 0.076% of the parameters in the hiera-tiny variant of SAM2.
  • Figure 2: a. Composition of the $\sim$36,000 WSI thumbnail corpus across four cohorts (CHUM in-house, TCGA, Radboud UMC and Karolinska), illustrating multi-institutional and multi-organ coverage. b. Example thumbnails ordered along key axes of variation, highlighting challenging edge cases for tissue detection. c. Quantitative characterization of this variability via Lab chroma maps and slide-level statistics, showing broad distributions. d. Semi-automatic annotation pipeline in Labelbox, where pre-segmentation is refined by annotators with quality control, yielding high-quality tissue-versus-background masks for SAM2 finetuning and evaluation. An example illustrates the inefficiency of the automated segmentation features in such tools, and the need for semi-manual annotations.
  • Figure 3: Qualitative examples of annotated masks as well as AtlasPatch tissue masks across datasets and artifacts. Representative WSI thumbnails from multiple sources are shown alongside their annotated ground-truth tissue masks, AtlasPatch predictions, and mask overlays. Ground-truth tissue is displayed in green, model predictions in red, and overlapping regions in brown, illustrating close agreement between AtlasPatch and annotations across organs and cohorts. The bottom row shows challenging cases with scanner or preparation artifacts, where AtlasPatch masks largely follow true tissue while ignoring non-tissue structures. These samples come from a testing set that was not seen by the model during training. More examples are available in Extended Data Figs. 1-2 showing different cohorts and IHC stained samples.
  • Figure 4: Quantitative and qualitative analysis of AtlasPatch tissue detection against existing slide-preprocessing tools. Representative WSI thumbnails are shown from diverse tissue features and artifact conditions, with tissue masks predicted by thresholding methods (TIAToolbox, CLAM) and deep learning methods (pretrained "non-finetuned" SAM2 model, Trident-GrandQC, Trident-Hest, and AtlasPatch), highlighting differences in boundary detection, artifact suppression, and handling of fragmented tissue (more tools are shown in Extended Data Figs. 3-5). Tissue detection performance is also shown on the held-out test set, highlighting that AtlasPatch matches or exceeds the other methods. The segmentation complexity–performance trade-off shows F1-score against segmentation runtime (per 100 WSIs), shows AtlasPatch achieves high performance with substantially lower wall-clock time than patch-based methods, underscoring its suitability for large-scale WSI preprocessing.
  • Figure 5: Multiple experiments to validate the importance of data diversity in the curated dataset. A. Effect of restricted/unvaried training sets. Subsets of the original dataset are created for varying conditions (machines, tissue brightness, object count, etc). For each subset, the SAM2 model is finetuned on the given data, and tested on the remainder of the dataset. Results show training on a restricted set with no diversity cannot generalize to larger heterogeneous data, as shown by the six examples. B. Model performance across varying test sets. The model finetuned on the full heterogeneous training set is tested on stratified subsets (unseen during training), each covering a certain level of a given feature. Results show more adaptability and robustness to variance.
  • ...and 7 more figures