Automated measurement of CD8+ T-cell distribution at the tumor epithelial–stromal interface is associated with NSCLC immunotherapy benefit and transcriptomic pathways Authors: Patrick Leo, Hauke Kolster, Hartmut Koeppen, Jennifer Giltnane, Namrata S. Patil, Niha Beig, Barzin Y. Nabet, Velimir Gayevskiy, Daniel Ruderman, Cleopatra Kozlowski Published: 2026 ABSTRACT Whereas anti-PD-(L)1 therapies are widely used in cancer treatment, only a subset of patients achieve long-term survival. Companion diagnostics based on PD-L1 expression have limited predictive power for these therapies, motivating development of additional predictive markers. We demonstrate a digital pathology (DP) method to quantify the density and epithelial infiltration of cytotoxic T cells near the tumor epithelial–stromal interface (ESI) using pancytokeratin-CD8 immunohistochemistry slides. We used POPLAR (n = 188), a phase 2 clinical trial of atezolizumab vs. docetaxel in previously treated non-small cell lung cancer, to train a machine learning outcome prediction model, generating a novel score, the Digital Assessment of Cytotoxic T cell Infiltration (DACTI). DACTI correlated with bulk RNAseq signatures of immune infiltration, providing verification that the DP measurements captured genuine aspects of the tumor microenvironment. A greater concentration of CD8+ T cells at the ESI and greater infiltration of those cells into the tumor epithelium were associated with benefit from atezolizumab, but not docetaxel. We validated DACTI in OAK (n = 879), a randomized phase 3 trial with treatment arms identical to POPLAR. Atezolizumab-treated DACTI-high patients in the validation set had longer overall survival than docetaxel-treated patients (n = 337, hazard ratio [HR] = 0.67, 95% confidence interval [CI]: 0.53–0.86; treatment interaction Cox model p-value = 0.028), including in patients with PD-L1 negative tumors (n = 61, HR = 0.47, 95% CI:0.27–0.84). This difference between arms was not observed in the DACTI-low group (n = 518, HR = 0.94, 95% CI: 0.78–1.13). These results suggest that automated analysis of pathology images may be able to direct immunotherapy treatments to patients who will most benefit. Glossary Definition Fraction of cells within 8 μm of the ESI which are CD8-positive Fraction of cells 8–24 μm into the tumor which are CD8-positive divided by the same in the stroma A model consisting of the weighted sums of TESI and TInf The area of tumor epithelium and intra-tumoral stroma annotated by the pathologist The panCK-negative tissue area inside the tumor lesion The panCK-positive tissue area inside the tumor lesion Number of CD8-positive cells in the tumor lesion divided by the area of the tumor lesion The number of CD8-positive cells in the tumor stroma divided by the area of the tumor stroma The number of CD8-positive cells in the tumor epithelium divided by the area of the tumor epithelium Introduction Cancer immunotherapy has revolutionized treatment across multiple cancers, including non-small cell lung cancer (NSCLC).1 However, only one-third of eligible patients with advanced lung cancer respond to immunotherapy.2 It is therefore vital to develop reliable and reproducible biomarkers that can identify patients likely to benefit from these treatments. One of the most successfully targeted immune checkpoint inhibition pathways is the PD1–PD-L1 interaction, which prevents cytotoxic T cells from killing tumor cells.3 PD-L1-positive patients would be expected to respond to therapies that disrupt the PD1–PD-L1 interaction, such as pembrolizumab, atezolizumab, or nivolumab.4, 5 To identify patients likely to respond to this therapy, numerous PD-L1 immunohistochemical (IHC) assays have been developed6 and found to be predictive of response and survival benefit from immune checkpoint inhibitors (ICI) in many cancers including NSCLC.7 Reflecting this, regulatory approvals of anti-PD(L)1 monotherapies in the first-line setting have been restricted to PD-L1-positive patients.8 However, there is evidence that PD-L1 IHC has only moderate analytical concordance in immune cell staining9 and that spatial and temporal variation in PD-L1 expression may affect the predictive power of IHC analysis.10 Studies of anti-PD-(L)1 molecules have reached different conclusions on the PD-L1 antibody, which best predicts response and the threshold at which patients benefit.11 Reflecting this, a 2019 review of 45 FDA approvals of anti-PD-(L)1 therapies found that PD-L1 tissue assays were predictive in just 29% of approvals.12 This motivates further investigation of factors influencing response and potential biomarkers to augment PD-L1 testing.7 Several potential mechanisms by which PD-L1-positive patients do not respond to ICI therapy have been identified. Cancer cells may have low immunogenicity, the tumor microenvironment (TME) may have other immunosuppressive mechanisms that upregulate regulatory T cells and myeloid-derived suppressor cells, or rely on other inhibitory signals besides PD1–PD-L1.13 Especially relevant to immune–tumor interactions are CD8+ cytotoxic T cells, which are immune cells that directly kill tumor cells. The density of CD8+ T cells infiltrated into the tumor is positively correlated with patient survival in several cancers, including NSCLC,14 and with response to ICIs.15 Apart from density, tumor–T cell proximity may be another factor in tumor-killing response.16 After T cells have entered the tumor lesion through blood vessels, they use environmental stimuli as cues to arrive at the tumor site via chemotaxis.17 Once the T cell reaches the target tumor cell, an immunological synapse18 must form at the interface between the T cell and tumor cell, for killing to commence. Greater killing of tumor cells by T cells is associated with greater T cell density near the epithelium–stroma interface (ESI) because T cells kill tumors by additive toxicity.19 To further characterize the association between immune infiltrates at the tumor site and clinical response to immunotherapy, a system has been developed to categorize tumor CD8+ T cell distribution patterns into “immunophenotypes”: “desert” (dispersed CD8+ cells at low density), “excluded” (infiltrate around the edge of the tumor epithelium), and “inflamed” (highly infiltrated).20, 21 When immunotherapies fail to elicit a response, there may be insufficient CD8+ T cells in the vicinity of the tumor lesion, as in desert cases, or there may be forces that impede the ability of T cells to reach their target tumor cells, as in excluded cases.22 Pathologist-assigned immunophenotypes have been shown to be predictive, with ICI-treated patients with inflamed tumors having a one-third longer median overall survival (OS) time compared to those with non-inflamed tumors and no difference was observed among chemotherapy-treated patients.23 However, this method does not perfectly predict immunotherapy benefit, either alone or in combination with PD-L1 scoring. Additionally, a reliance on a pathologist's subjective evaluation may not be repeatable in low-volume or resource-limited health centers. Furthermore, immunophenotypes are categorical, whereas tumor–immune interactions operate on a continuum20 that may not be well captured by three discrete T cell distribution patterns. More granular measurement of this continuum could improve patient stratification and aid future biomarker discovery and drug development. We hypothesized that quantitative analysis of the CD8+ T cells in the TME at the ESI could predict benefit from anti-PD-L1 therapy. Because T cell density and tumor proximity are important for tumor killing, characterizing those two elements could yield a predictive morphological signature for ICI therapy. However, manual measurement of the distance of every T cell from the ESI would be impractical, tedious, and time-consuming. Digital pathology (DP), computer vision, and machine learning approaches to quantify tissue features in digitally scanned slides, offer a high-throughput, reproducible method for quantifying cell localization in the TME. DP analysis of tumor and immune cell spatial relationships has previously been shown to be predictive in several cancer types, including lung,24 gynecological,25, 26 and breast27 cancers. We therefore implemented DP methods to evaluate the relationship of T cells with tumor epithelium and quantified their infiltration. Herein, we demonstrate the use of novel T cell distribution measurements to characterize the immune microenvironment, evaluate their correlation with transcriptomic findings, and train a machine learning model that uses these automated measurements to predict atezolizumab benefit in an independent validation dataset. Methods Dataset This study's dataset was drawn from two clinical trials comparing docetaxel to atezolizumab (anti-PD-L1) as single-agent second-line therapy in patients with advanced-stage NSCLC who had experienced progression after platinum chemotherapy. A dual chromogenic pan cytokeratin (panCK)-CD8 IHC assay was performed for at least one tissue sample per patient, labeling the epithelial cells and cytotoxic T cells. Inclusion criteria for this analysis were a successfully digitized panCK/CD8 slide with at least 100 viable tumor cells visible in the image. Samples from 197 patients met these criteria from the phase II POPLAR (NCT01903993) study as did 879 from the follow-on phase III study, OAK (NCT02008227), for a total study dataset of 1076 patients (see Table 1, Fig. 1). This constituted 69% and 72% of total POPLAR and OAK patients, respectively. The DP biomarker evaluable population (BEP) showed a similar benefit from atezolizumab as the full-trial datasets. The POPLAR BEP cohort had an OS hazard ratio (HR) (95% confidence interval (CI)) of 0.68 (0.50, 0.93) between treatment arms compared with 0.73 (0.53, 0.99) in the full-trial POPLAR dataset. For OAK, the BEP had a HR of 0.81 (0.70, 0.94) compared to a full-trial value of 0.80 (0.70, 0.92).Table 1Clinical characteristics of patients in this study in total and separately for the training and validation sets.TotalTraining set (POPLAR)Validation set (OAK)n1076197879Collection type, n (%)Biopsy398 (37.0)56 (28.4)342 (38.9)Core needle biopsy279 (25.9)54 (27.4)225 (25.6)Resection353 (32.8)69 (35.0)284 (32.3)Excision1 (0.1)1 (0.5)0 (0.0)Indeterminate45 (4.2)17 (8.6)28 (3.2)Anatomic location, n (%)Lung373 (34.7)62 (31.5)311 (35.4)Bronchus212 (19.7)36 (18.3)176 (20.0)Lymph node88 (8.2)3 (1.5)85 (9.7)Soft tissue48 (4.5)5 (2.5)43 (4.9)Liver35 (3.3)9 (4.6)26 (3.0)Pleura30 (2.8)5 (2.5)25 (2.8)Brain20 (1.9)4 (2.0)16 (1.8)Other47 (4.4)21 (10.7)26 (3.0)Not specified223 (20.7)52 (26.4)26 (3.0)Arm, n (%)Atezolizumab536 (49.8)95 (48.2)441 (50.2)Docetaxel511 (47.5)97 (49.2)414 (47.1)Not treated29 (2.7)5 (2.5)24 (2.7)PFS event, n (%)No78 (7.2)12 (6.1)66 (7.5)Yes997 (92.7)184 (93.4)813 (92.5)Unavailable1 (0.1)1 (0.5)0 (0.0)OS event, n (%)No200 (18.6)34 (17.3)166 (18.9)Yes875 (81.3)162 (82.2)713 (81.1)Unavailable1 (0.1)1 (0.5)0 (0.0)Immunophenotype, n (%)Desert209 (19.4)32 (16.2)177 (20.1)Excluded408 (37.9)68 (34.5)340 (38.7)Inflamed307 (28.5)68 (34.5)239 (27.2)Not evaluated152 (14.1)29 (14.7)123 (14.0)PD-L1 SP142 immune cell score, n (%)IC0364 (33.8)72 (36.5)292 (33.2)IC1430 (40.0)81 (41.1)349 (39.7)IC2189 (17.6)29 (14.7)160 (18.2)IC392 (8.6)14 (7.1)78 (8.9)Unavailable1 (0.1)1 (0.5)0 (0.0)PD-L1 SP142 tumor cell score, n (%)TC0739 (68.7)112 (56.9)627 (71.3)TC1108 (10.0)30 (15.2)78 (8.9)TC2132 (12.3)29 (14.7)103 (11.7)TC394 (8.7)25 (12.7)69 (7.8)Unavailable3 (0.3)1 (0.5)2 (0.2)PD-L1 22C3 tumor proportion score, n (%)<1%225 (20.9)0 (0.0)225 (25.6)1–49%97 (9.0)0 (0.0)97 (11.0)≥50%106 (9.9)0 (0.0)106 (12.1)Unavailable648 (60.2)197 (100.0)451 (51.3)Fig. 1Flow diagram for patient inclusion in this study for: (a) the training set, drawn from the POPLAR trial, and (b) the validation set, drawn from the OAK trial.Fig. 1 Table 1Clinical characteristics of patients in this study in total and separately for the training and validation sets.TotalTraining set (POPLAR)Validation set (OAK)n1076197879Collection type, n (%)Biopsy398 (37.0)56 (28.4)342 (38.9)Core needle biopsy279 (25.9)54 (27.4)225 (25.6)Resection353 (32.8)69 (35.0)284 (32.3)Excision1 (0.1)1 (0.5)0 (0.0)Indeterminate45 (4.2)17 (8.6)28 (3.2)Anatomic location, n (%)Lung373 (34.7)62 (31.5)311 (35.4)Bronchus212 (19.7)36 (18.3)176 (20.0)Lymph node88 (8.2)3 (1.5)85 (9.7)Soft tissue48 (4.5)5 (2.5)43 (4.9)Liver35 (3.3)9 (4.6)26 (3.0)Pleura30 (2.8)5 (2.5)25 (2.8)Brain20 (1.9)4 (2.0)16 (1.8)Other47 (4.4)21 (10.7)26 (3.0)Not specified223 (20.7)52 (26.4)26 (3.0)Arm, n (%)Atezolizumab536 (49.8)95 (48.2)441 (50.2)Docetaxel511 (47.5)97 (49.2)414 (47.1)Not treated29 (2.7)5 (2.5)24 (2.7)PFS event, n (%)No78 (7.2)12 (6.1)66 (7.5)Yes997 (92.7)184 (93.4)813 (92.5)Unavailable1 (0.1)1 (0.5)0 (0.0)OS event, n (%)No200 (18.6)34 (17.3)166 (18.9)Yes875 (81.3)162 (82.2)713 (81.1)Unavailable1 (0.1)1 (0.5)0 (0.0)Immunophenotype, n (%)Desert209 (19.4)32 (16.2)177 (20.1)Excluded408 (37.9)68 (34.5)340 (38.7)Inflamed307 (28.5)68 (34.5)239 (27.2)Not evaluated152 (14.1)29 (14.7)123 (14.0)PD-L1 SP142 immune cell score, n (%)IC0364 (33.8)72 (36.5)292 (33.2)IC1430 (40.0)81 (41.1)349 (39.7)IC2189 (17.6)29 (14.7)160 (18.2)IC392 (8.6)14 (7.1)78 (8.9)Unavailable1 (0.1)1 (0.5)0 (0.0)PD-L1 SP142 tumor cell score, n (%)TC0739 (68.7)112 (56.9)627 (71.3)TC1108 (10.0)30 (15.2)78 (8.9)TC2132 (12.3)29 (14.7)103 (11.7)TC394 (8.7)25 (12.7)69 (7.8)Unavailable3 (0.3)1 (0.5)2 (0.2)PD-L1 22C3 tumor proportion score, n (%)<1%225 (20.9)0 (0.0)225 (25.6)1–49%97 (9.0)0 (0.0)97 (11.0)≥50%106 (9.9)0 (0.0)106 (12.1)Unavailable648 (60.2)197 (100.0)451 (51.3) Clinical characteristics of patients in this study in total and separately for the training and validation sets. Flow diagram for patient inclusion in this study for: (a) the training set, drawn from the POPLAR trial, and (b) the validation set, drawn from the OAK trial. Images from POPLAR patient samples were used to train a machine learning model to predict patient atezolizumab benefit, which was validated on images from OAK. Splitting the dataset in this way ensured the training and validation sets were entirely independent while using the larger trial for validation. For each patient, a single panCK/CD8 slide was digitized using a Ventana DP200 whole-slide scanner at a resolution of 0.24 μm per pixel. Following digitization, the images were loaded into an internal DP viewing and annotation platform, and the tumor lesion area and significant necrosis or artifacts were annotated on each image by one of four board-certified anatomic pathologists following a unified protocol. Slides exhibiting technical staining failures (e.g., extremely weak staining or heavy background staining) were excluded during pathologist review. In total, 11 slides from POPLAR and 1 slide from OAK were excluded on this basis. The tumor lesion was defined as panCK-positive areas containing morphologically invasive carcinoma and contiguous desmoplastic stroma. Based on these annotations, non-tumor areas and areas with necrosis or artifacts were computationally excluded from analysis. Digital pathology feature extraction Stain separation and compartment segmentation The method for deriving cell identities and locations from digitized images is illustrated in Fig. 2. First, to measure the spatial distribution of cytotoxic T cells relative to the ESI, it was necessary to identify the CD8+ cells and segment the epithelial and stromal regions in each image. To accomplish this, color deconvolution was applied within the pathologist-annotated tumor lesion to digitally separate the hematoxylin, panCK, and CD8 color profiles and allow for each to be used in downstream analysis. The optical density matrix used for color deconvolution was initialized by the automated method of Macenko et al.,28 then manually refined to produce the best qualitative color separation. This matrix was then used for color separation in all the images.Fig. 2Visualization of the digital pathology analysis process starting with: (a) pathologist tumor lesion annotation on a panCK/CD8 IHC slide. (b) A high-magnification ROI for visualization. Color deconvolution results are shown for: (c) hematoxylin, (d) panCK, and (e) CD8 channels. Those channels are used for: (f) nuclear segmentation, (g) defining the epithelial region (shown in yellow) and stromal region (shown in green), and (h) identifying CD8+ cells. Features are extracted using: (i) the final labeled nuclei and (j) the ESI. (For interpretation of the references to color in this figure legend, the reader is referred to the web version of this article.)Fig. 2 Visualization of the digital pathology analysis process starting with: (a) pathologist tumor lesion annotation on a panCK/CD8 IHC slide. (b) A high-magnification ROI for visualization. Color deconvolution results are shown for: (c) hematoxylin, (d) panCK, and (e) CD8 channels. Those channels are used for: (f) nuclear segmentation, (g) defining the epithelial region (shown in yellow) and stromal region (shown in green), and (h) identifying CD8+ cells. Features are extracted using: (i) the final labeled nuclei and (j) the ESI. (For interpretation of the references to color in this figure legend, the reader is referred to the web version of this article.) For each image, color deconvolution produced a chromogenic intensity map for each of the three stain channels. An intensity threshold was then applied to the panCK and CD8 maps to produce binary masks. These binary masks were further algorithmically processed to smooth edges and remove small objects and small holes. All image processing parameters (intensity thresholds, morphological operations, and size filters) were determined by visual quality assessment on a development set of slides and are listed in Supplementary Tables S5 and S6. No image processing parameters were optimized against clinical outcomes. The parameter selection was performed before and independently of any survival analysis. Identification of stroma required two steps because no biomarker assay was used for stromal cells. First, a brightness threshold was applied to the image to detect tissue. Image areas that were darker than the background and panCK-negative were labeled as stroma. However, this process did not capture the entirety of the stroma due to the cytoplasmic transparency of panCK-negative cells. Therefore, in a second step, the segmentations of all nuclei in the panCK-negative regions were dilated by 5 μm. The union of the masks produced by the first and second steps, with panCK regions subtracted, formed the stromal region label. Nucleus segmentation and labeling Nuclei were segmented from the deconvolved hematoxylin image using the publicly available Cellpose method29 with the pretrained cyto2 model.30 Before segmentation, contrast-limited adaptive histogram equalization31 was applied to the hematoxylin intensity maps to increase image contrast, improving segmentation performance. Within the pathologist tumor lesion annotation, each nucleus whose boundary intersected the panCK region was labeled as epithelial, and the remaining nuclei were labeled as stromal. Similarly, each nucleus was labeled for CD8 positivity according to intersection with the CD8 regions. Finally, all nuclei outside the pathologist tumor lesion annotation or within pathologist-annotated necrotic or artifact regions were removed. CD8+ T cell-ESI distance was calculated as the distance between each nucleus centroid and the nearest stromal or epithelial region for cells in the epithelium and stroma, respectively. The nearest epithelial or stromal region was used instead of the boundary of the tissue region containing the nucleus to avoid misidentifying tissue edges or lumens as ESI locations. Immune tumor spatial analysis feature extraction Two hypothesis-driven features were extracted to quantify the TME. The first feature measured T cell involvement with the tumor epithelium as the density of T cells at the ESI (TESI), defined as the fraction of cells within 8 μm of the ESI which were CD8+. A value of 8 μm was chosen to match the estimated average diameter of lymphocytes.32 This distance threshold was informed by empirical data in the training set showing a peak in lymphocyte density in the 0–8 μm band (see Supplementary Fig. S1). A distance matching the size of a lymphocyte was required to define an “at-ESI” compartment in the tissue. Because the ESI is defined by stromal fibroblasts and cancer cells, not lymphocytes, a lymphocyte at the ESI cannot be said to be either in the tumor epithelium or in the stroma, only at the ESI. The second feature measured the infiltration of T cells into the tumor epithelium (Tinf) as the ratio of cells close to the ESI in the epithelium to that in the stroma. This was defined as the fraction of cells in the epithelium between 8 and 24 μm from the ESI, which were CD8+, divided by the fraction in the corresponding band in stroma. This 16-μm band size was chosen to match the width of the “at-ESI” band. These two features are illustrated in Fig. 3. A higher TESI value would therefore be associated with greater T cell density near the tumor epithelium, whereas a higher Tinf would be associated with a higher proportion of T cells being in the tumor epithelium compared to the stroma. These features, therefore, enable testing of our hypothesis that the immune makeup at the ESI is correlated with atezolizumab benefit.Fig. 3Visualization of (a, b) TESI and (c, d) TInf in a sample region of interest. Shown is (a) the area within 8 μm of the ESI. (b) Nuclei within 8 μm of the ESI. TESI is equal to the fraction of these nuclei which are CD8+. (c) The area between 8 and 24 μm from the ESI. (d) Nuclei 8–24 μm from the ESI. TInf is equal to the fraction of nuclei in this band in the epithelial compartment, which are CD8+ divided by that measure in the corresponding band in the stroma.Fig. 3 Visualization of (a, b) TESI and (c, d) TInf in a sample region of interest. Shown is (a) the area within 8 μm of the ESI. (b) Nuclei within 8 μm of the ESI. TESI is equal to the fraction of these nuclei which are CD8+. (c) The area between 8 and 24 μm from the ESI. (d) Nuclei 8–24 μm from the ESI. TInf is equal to the fraction of nuclei in this band in the epithelial compartment, which are CD8+ divided by that measure in the corresponding band in the stroma. An additional series of three features, measuring the CD8+ cell density (cells per square micrometer) in the tumor lesion overall (⍴L) and specifically in the intra-tumoral stroma (⍴S) and in the tumor epithelium (⍴E) were also extracted. Previous literature has indicated that ⍴S may be a predictive marker for ICI in NSCLC.33 To verify that our novel features, TESI and Tinf, contribute additional predictive information rather than recapitulating lymphocyte density, we also tested the predictive power of each density feature. A substantial performance difference between ⍴L, ⍴S, or ⍴E and our novel features would indicate that our features contained information orthogonal to existing measures of T cell density. Experiment 1: Characterization of the tumor immune microenvironment We first verified that our computed DP features characterized two distinct characteristics of CD8+ T cell distribution: concentration, using TESI, and infiltration, using Tinf. This was assessed by measuring the degree to which these two features distinguished pathologist-called immune desert, excluded, and inflamed patients as well as the independence of the two features from each other. The correlation between each pair of DP features was also measured by Spearman correlation coefficient (SCC). Whereas these DP features were not developed with the intention of recapitulating pathologist scoring, they were inspired by the approach of pathologists in categorizing patients by T cell concentration and infiltration. We therefore expected these features to be correlated with pathologist immunophenotyping calls to an extent. The separation of pathologist-called immunophenotypes was assessed by the top-1 accuracy and macro-weighted F1 score of a quadratic discriminant analysis (QDA) classifier trained on TESI and Tinf in the training set and tested on the validation set. A high accuracy would indicate that the features could predict pathologist labels, and therefore that the features were associated with characteristics of the immune morphology also apparent to pathologists. Experiment 2: Correlation of DP features with bulk RNAseq signatures Because TESI and TInf are novel measures for characterizing the TME, we sought to verify that these measures were capturing genuine characteristics of immune distribution. To provide this orthogonal validation, feature values were compared with bulk RNA-sequencing data from the same tissue blocks. Each feature was separately used in gene set enrichment analysis (GSEA)34 with these matched RNA-seq transcriptomes. A strong correlation between TESI and TInf and immune signatures, especially those related to CD8, would verify that the pathological measurements were indeed capturing aspects of immune infiltration. Associations with non-CD8-related genes could potentially elucidate the molecular underpinning of the atezolizumab-benefiter phenotype. For this analysis, the training and testing sets were combined into a single dataset, of which n = 709 patients had available matched RNA-seq data. Supplementary Tables S3 and S4 compare baseline demographics of the RNA-seq evaluable and full IHC-BEP populations for patients with specimens submitted for panCK/CD8 IHC processing. Patients were then stratified as being above or below the median Tinf and TESI values, and signatures were selected for a broad variety of TME cell types.35 GSEA was carried out using the qusage R package (v2.34.0)36 in R v4.3.1. Gene signatures that were significantly different between below- and above-median groups were identified. Tissue histology (squamous vs. non-squamous) and collection type (resection vs. non-resection) were used as covariates in the GSEA, due to their known transcriptional differences. Trial identity (POPLAR vs. OAK) was not included as a covariate, as both trials used the same RNA-seq platform and processing pipeline. Experiment 3: DP features as biomarkers of atezolizumab benefit DACTI construction Given atezolizumab's mechanism of action, which promotes tumor killing by T effector cells, we hypothesized that TESI and Tinf would be useful predictors of patient survival after atezolizumab treatment, but not after docetaxel treatment. Greater immune cell density and infiltration into the tumor, as captured by TESI and Tinf, would then be associated with more tumor killing and potentially longer survival. Because this mechanism of action is not known to be shared with docetaxel, the correlation of TESI and Tinf with outcome in docetaxel-treated patients would be expected to be lower. To test this hypothesis, and the potential utility of our features for identifying patients, who were more likely to benefit from atezolizumab, we fit a Cox proportional hazards model using TESI and Tinf to predict OS in the training set. This training produced the Digital Assessment of Cytotoxic T cell Infiltration (DACTI) by fitting coefficients β1 and β2 in:DACTI=β1TESI+β2Tinf This model was then applied to all patients of the training and validations sets to calculate each patient's DACTI score. The entire training set was used to identify the DACTI threshold that maximized the difference in median survival time, calculated with a Kaplan–Meier function,37 between the atezolizumab and docetaxel arms among patients above the threshold. This threshold was then used to categorize validation set patients as DACTI-low or DACTI-high. This process for selecting an optimal threshold was repeated for each of the CD8 density measures (⍴L, ⍴S, and ⍴E). Statistical analysis First, we measured DACTI's predictive ability as a categorical low/high marker. Validation set patients were split into DACTI-low and DACTI-high groups based on the score threshold identified in the training set. The OS HR between atezolizumab- and docetaxel-treated patients was then measured in the DACTI-low group and the DACTI-high group. A biomarker specifically associated with atezolizumab benefit would produce a difference in OS hazard between atezolizumab-treated patients with low and high DACTI values, without a difference between groups in the docetaxel arm. Second, we used Harrell's concordance index (c-index)38 to evaluate DACTI as a continuous marker in the validation set. The c-index measures the association of a continuous score with right-censored survival data and ranges from 0 to 1 with a value of 0.5 equivalent to random guessing and a value of 1 reflecting perfect sorting of survival times in descending order. A marker associated with atezolizumab benefit would have a c-index very close to 0.5 in the docetaxel arm and a 95% CI not including 0.5 in the atezolizumab arm. Calculations of c-indexes, HRs, and 95% CI, were performed using the Cox proportional hazards method of the lifelines Python package, version 0.27.4.39 In addition to testing the predictive power of DACTI in the validation set overall, we also tested it separately in the PD-L1-negative (SP142 TC = 0 and IC = 0) and PDL1-positive subpopulations, as well as in squamous and non-squamous subpopulations. Analysis of these subgroups was prespecified due to the known difference in atezolizumab outcomes between them. Data for a subset of validation set patients (n = 401), who had PD-L1 TC scoring from another PD-L1 clone, 22C3, are included in the supplemental material. Lastly, the interaction between the DACTI low/high category and atezolizumab treatment in predicting OS was tested in the validation set. A Cox regression model was fit on the validation set, including the interaction between DACTI category and treatment arm. A p-value less than 0.05 and a HR point estimate less than 1 for the interaction term of DACTI and atezolizumab treatment would indicate that the DACTI category was associated with OS specifically in atezolizumab-treated patients. This would imply that DACTI was specifically associated with atezolizumab benefit, rather than being a prognostic marker. Results Experiment 1: TESI and TInf describe independent aspects of the tumor immune landscape TESI and Tinf were moderately correlated, with an SCC of 0.44 (p = 4e-9) in the training set and 0.41 (p = 4e-42) in the validation set (see Fig. 4). Whereas TESI was strongly correlated with the density of CD8+ T cells in the tumor lesion and intra-tumoral stroma in the validation set (SCC = 0.78 p = 4e-267, SCC = 0.80 p = 1e-149, respectively), Tinf showed weaker correlation (SCC = 0.33 p = 2e-21, SCC = 0.32 p = 3e-170). Both measures correlated with overall CD8+ T cell density in the tumor epithelium (SCC = 0.72, SCC = 0.77). Overall, TESI and Tinf appear to measure largely independent aspects of the immune spatial landscape and provide insight beyond what is captured by CD8+ T cell density alone.Fig. 4SCCs between TESI, TInf, and measures of CD8+ cell density in the tumor overall, in the intra-tumoral stroma, and in the tumor epithelium in: (a) the training set and (b) the validation set. All correlations were significant at the p < 0.001 confidence level.Fig. 4 SCCs between TESI, TInf, and measures of CD8+ cell density in the tumor overall, in the intra-tumoral stroma, and in the tumor epithelium in: (a) the training set and (b) the validation set. All correlations were significant at the p < 0.001 confidence level. The QDA model fit on the training set to predict immunophenotype had a macro-weighted F1 score of 0.60 and top-1 accuracy of 0.60 on the validation set. Qualitatively, clusters of immunophenotypes are evident in the scatterplot of TESI and TInf (see Fig. 5). Inflamed cases tended to have high TESI and TInf, excluded cases had high TESI and low TInf, and desert cases had low TESI.Fig. 5Distribution of patient TESI and TInf values in: (a) the n = 168 training set patients and (b) n = 756 validation set patients, who had a pathologist immunophenotype call available. Patients are colored according to the assigned immunophenotype. Axes use a symmetrical logarithmic scale, which is linear near zero and logarithmic elsewhere.Fig. 5 Distribution of patient TESI and TInf values in: (a) the n = 168 training set patients and (b) n = 756 validation set patients, who had a pathologist immunophenotype call available. Patients are colored according to the assigned immunophenotype. Axes use a symmetrical logarithmic scale, which is linear near zero and logarithmic elsewhere. Experiment 2: TESI and TInf are correlated with distinct transcriptomic signatures Both TESI and TInf were positively associated with T cell-related gene signatures (Fig. 6a–b) and individual genes (Fig. 6c–d). Broadly, TESI enriched for signatures related to total immune cell infiltration, including lymphocyte and myeloid genes and signatures. The TInf-high subgroup displayed a more modest, though still significant, enrichment of pan-immune signatures. Among individual genes, TESI-high tumors were enriched for both B and T cell related genes, whereas TInf-high tumors were specifically enriched for T cell-related genes. For both features, the greatest enrichment was seen in genes related to CD8 T cells. Overall, these data suggest that both the TESI- and TInf-high groups were enriched for immune-infiltrated NSCLC tumors, with a specific enrichment for tumors with high expression of CD8 T cell-related genes. This suggests that TESI and TInf are indeed capturing signals of immune distribution in the TME.Fig. 6(a–b) RNA-seq gene set analyses comparing: (a) TESI high vs. low and (b) TInf high vs. low. Gene signatures corresponding to previously identified cancer and TME cell types and pathway signatures35 are shown. Dotted lines indicate Benjamini–Hochberg false-discovery rate (FDR) = 0.05, whereas the sign on the x-axis denotes the direction: positive values indicate enrichment in the high subgroup and negative values indicate enrichment in the low subgroup. Bars extending beyond the axis limits indicate p-values of 0 (log(P-val) of infinity). Colors denote FDR p-value <0.05 matching the color of the specific subset where the gene signature is enriched, gray indicates enrichment FDR p ≥ 0.05. (c–d) RNA-seq volcano plot depicting differentially expressed genes comparing (c) TESI high vs. low or (d) TInf high vs. low by median split. Highlighted are genes related to the indicated cell types.Fig. 6 (a–b) RNA-seq gene set analyses comparing: (a) TESI high vs. low and (b) TInf high vs. low. Gene signatures corresponding to previously identified cancer and TME cell types and pathway signatures35 are shown. Dotted lines indicate Benjamini–Hochberg false-discovery rate (FDR) = 0.05, whereas the sign on the x-axis denotes the direction: positive values indicate enrichment in the high subgroup and negative values indicate enrichment in the low subgroup. Bars extending beyond the axis limits indicate p-values of 0 (log(P-val) of infinity). Colors denote FDR p-value <0.05 matching the color of the specific subset where the gene signature is enriched, gray indicates enrichment FDR p ≥ 0.05. (c–d) RNA-seq volcano plot depicting differentially expressed genes comparing (c) TESI high vs. low or (d) TInf high vs. low by median split. Highlighted are genes related to the indicated cell types. Experiment 3: DACTI is correlated with longer OS with atezolizumab monotherapy TESI and TInf had positive coefficients in the DACTI model, indicating that both were positively associated with longer OS. As shown in Table 2, DACTI was significantly associated with OS in atezolizumab-treated patients (c-index = 0.56, 95% CI: 0.54–0.60), but not in docetaxel-treated patients (c-index = 0.52 95% CI: 0.49–0.55). Among the 337 DACTI-high validation set patients, the atezolizumab arm had significantly longer survival than the docetaxel arm (Fig. 7, HR = 0.67, 95% CI: 0.53–0.86). There was not a significant difference in OS between the arms in the 518 DACTI-low patients (HR = 0.94, 95% CI: 0.78–1.13). As a continuous marker, increasing DACTI was associated with longer survival in the atezolizumab arm (c-index = 0.56, 95% CI: 0.54–0.60), but not conclusively in the docetaxel arm (c-index = 0.52, 95% CI: 0.49–0.55). In a Cox model for OS prediction with treatment arm, DACTI had a significant interaction with atezolizumab treatment (p = 0.028).Table 2Predictive performance of DACTI, DACTI's individual component features TESI, and TInf, and cell density features ⍴L, ⍴S, and ⍴E. DACTI's point estimates of HR and c-index differential between arms indicate greater predictive power than either of its component features or any T cell density feature.Feature c-index (95% CI)Atezolizumab/docetaxel HR (95% CI)FeatureAtezo. armDoce. armFeature-low patientsFeature-high patientsDACTI0.56 (0.54, 0.60)0.52 (0.49, 0.55)0.94 (0.77, 1.13)0.65 (0.49, 0.88)TESI0.56 (0.53, 0.59)0.52 (0.50, 0.55)0.91 (0.74, 1.12)0.77 (0.60, 0.99)TInf0.54 (0.51, 0.57)0.51 (0.48, 0.54)0.90 (0.75, 1.09)0.68 (0.51, 0.92)⍴L0.54 (0.51, 0.56)0.52 (0.50, 0.56)0.91 (0.75, 1.12)0.74 (0.57, 0.95)⍴S0.53 (0.51, 0.57)0.52 (0.49, 0.54)0.93 (0.76, 1.14)0.71 (0.54, 0.93)⍴E0.55 (0.51, 0.57)0.51 (0.48, 0.54)0.91 (0.75, 1.10)0.71 (0.54, 0.95)Fig. 7Overall survival for patients in the validation set stratified by: (a) treatment arm and (b) both treatment arm and DACTI category.Fig. 7 Table 2Predictive performance of DACTI, DACTI's individual component features TESI, and TInf, and cell density features ⍴L, ⍴S, and ⍴E. DACTI's point estimates of HR and c-index differential between arms indicate greater predictive power than either of its component features or any T cell density feature.Feature c-index (95% CI)Atezolizumab/docetaxel HR (95% CI)FeatureAtezo. armDoce. armFeature-low patientsFeature-high patientsDACTI0.56 (0.54, 0.60)0.52 (0.49, 0.55)0.94 (0.77, 1.13)0.65 (0.49, 0.88)TESI0.56 (0.53, 0.59)0.52 (0.50, 0.55)0.91 (0.74, 1.12)0.77 (0.60, 0.99)TInf0.54 (0.51, 0.57)0.51 (0.48, 0.54)0.90 (0.75, 1.09)0.68 (0.51, 0.92)⍴L0.54 (0.51, 0.56)0.52 (0.50, 0.56)0.91 (0.75, 1.12)0.74 (0.57, 0.95)⍴S0.53 (0.51, 0.57)0.52 (0.49, 0.54)0.93 (0.76, 1.14)0.71 (0.54, 0.93)⍴E0.55 (0.51, 0.57)0.51 (0.48, 0.54)0.91 (0.75, 1.10)0.71 (0.54, 0.95) Predictive performance of DACTI, DACTI's individual component features TESI, and TInf, and cell density features ⍴L, ⍴S, and ⍴E. DACTI's point estimates of HR and c-index differential between arms indicate greater predictive power than either of its component features or any T cell density feature. Overall survival for patients in the validation set stratified by: (a) treatment arm and (b) both treatment arm and DACTI category. When patients were stratified by PD-L1 score (see Table 3), a significant association of DACTI with atezolizumab benefit was seen in patients with PD-L1-negative tumors, defined as being both IC0 and TC0. Whereas the trend of DACTI being associated with longer OS among atezolizumab-treated patients was also seen in other PD-L1 subgroups, the effect was not significant in these groups. The HR (95% CI) of atezolizumab vs. docetaxel in the PD-L1-negative group, was 0.47 (0.27, 0.84) in the 61 patients of the DACTI-high group vs. 0.98 (0.74, 1.30) in the 212 patients of the DACTI-low group.Table 3Performance of DACTI in subcohorts of the validation set. Sets are stratified by PD-L1 expression according to the SP142 assay. Shown are the c-index (95% CI) values of DACTI as a continuous measure in the atezolizumab and docetaxel arms, as well as the HRs (95% CI) between the arms in the DACTI-low and DACTI-high groups. High DACTI was significantly associated with longer OS on atezolizumab in the PD-L1-negative (TC0 and IC0) subcohort.n DACTI-DACTI c-index (95% CI)Atezolizumab/docetaxel HR (95% CI)PD-L1 groupLowHighAtezo. armDoce. armDACTI-low pts.DACTI-high pts.TC0 and IC0212610.56 (0.50, 0.63)0.48 (0.42, 0.56)0.98 (0.74, 1.30)0.47 (0.27, 0.84)Max(TC,IC) = 1185970.54 (0.49, 0.60)0.49 (0.43, 0.56)1.05 (0.76, 1.44)0.67 (0.43, 1.05)Max(TC,IC) = 277930.54 (0.47, 0.61)0.49 (0.42, 0.57)1.09 (0.66, 1.79)0.73 (0.73, 1.15)Max(TC,IC) = 344860.53 (0.44, 0.61)0.61 (0.52, 0.68)0.28 (0.12, 0.61)0.77 (0.47, 1.27) Table 3Performance of DACTI in subcohorts of the validation set. Sets are stratified by PD-L1 expression according to the SP142 assay. Shown are the c-index (95% CI) values of DACTI as a continuous measure in the atezolizumab and docetaxel arms, as well as the HRs (95% CI) between the arms in the DACTI-low and DACTI-high groups. High DACTI was significantly associated with longer OS on atezolizumab in the PD-L1-negative (TC0 and IC0) subcohort.n DACTI-DACTI c-index (95% CI)Atezolizumab/docetaxel HR (95% CI)PD-L1 groupLowHighAtezo. armDoce. armDACTI-low pts.DACTI-high pts.TC0 and IC0212610.56 (0.50, 0.63)0.48 (0.42, 0.56)0.98 (0.74, 1.30)0.47 (0.27, 0.84)Max(TC,IC) = 1185970.54 (0.49, 0.60)0.49 (0.43, 0.56)1.05 (0.76, 1.44)0.67 (0.43, 1.05)Max(TC,IC) = 277930.54 (0.47, 0.61)0.49 (0.42, 0.57)1.09 (0.66, 1.79)0.73 (0.73, 1.15)Max(TC,IC) = 344860.53 (0.44, 0.61)0.61 (0.52, 0.68)0.28 (0.12, 0.61)0.77 (0.47, 1.27) Performance of DACTI in subcohorts of the validation set. Sets are stratified by PD-L1 expression according to the SP142 assay. Shown are the c-index (95% CI) values of DACTI as a continuous measure in the atezolizumab and docetaxel arms, as well as the HRs (95% CI) between the arms in the DACTI-low and DACTI-high groups. High DACTI was significantly associated with longer OS on atezolizumab in the PD-L1-negative (TC0 and IC0) subcohort. DACTI low/high category had significant interaction with atezolizumab treatment (HR = 0.71 95% CI: 0.50–0.96, p = 0.03) in a Cox regression model on the validation set (see Table 4). Neither DACTI category nor atezolizumab treatment alone was associated with OS in this model (p > 0.05), suggesting that the majority of atezolizumab benefit was seen in the DACTI-high patients. None of the CD8 density measures had a significant interaction with atezolizumab treatment in Cox regression models with those terms. Additionally, a greater magnitude of interaction between DACTI status and atezolizumab treatment was seen among PD-L1-negative patients (HR = 0.44, 95% CI: 0.23–0.82, p = 0.010), though not among PD-L1-positive patients (HR = 0.79, 95% CI: 0.54–1.14, p = 0.211).Table 4HRs (95% CI) when using DACTI and three measures of CD8+ cell density as the experimental variable in Cox regression models fitted for OS on the validation set. Each variable was tested in a model containing the experimental variable, atezolizumab treatment, and an interaction term between the experimental variable and atezolizumab treatment. All variables were dichotomized at the optimal threshold identified on the training set. Only DACTI had a significant interaction with atezolizumab treatment.Experimental variableDACTI⍴L⍴S⍴EExperimental var.0.95 (0.77–1.19)0.91 (0.73–1.13)1.02 (0.82–1.27)0.84 (0.68–1.05)Atezolizumab treat.0.94 (0.78–1.13)0.88 (0.72–1.06)0.91 (0.76–1.10)0.89 (0.74–1.06)Atezolizumab:Expr. var0.71 (0.50–0.96)0.86 (0.63–1.16)0.76 (0.54–1.03)0.81 (0.59–1.11) Table 4HRs (95% CI) when using DACTI and three measures of CD8+ cell density as the experimental variable in Cox regression models fitted for OS on the validation set. Each variable was tested in a model containing the experimental variable, atezolizumab treatment, and an interaction term between the experimental variable and atezolizumab treatment. All variables were dichotomized at the optimal threshold identified on the training set. Only DACTI had a significant interaction with atezolizumab treatment.Experimental variableDACTI⍴L⍴S⍴EExperimental var.0.95 (0.77–1.19)0.91 (0.73–1.13)1.02 (0.82–1.27)0.84 (0.68–1.05)Atezolizumab treat.0.94 (0.78–1.13)0.88 (0.72–1.06)0.91 (0.76–1.10)0.89 (0.74–1.06)Atezolizumab:Expr. var0.71 (0.50–0.96)0.86 (0.63–1.16)0.76 (0.54–1.03)0.81 (0.59–1.11) HRs (95% CI) when using DACTI and three measures of CD8+ cell density as the experimental variable in Cox regression models fitted for OS on the validation set. Each variable was tested in a model containing the experimental variable, atezolizumab treatment, and an interaction term between the experimental variable and atezolizumab treatment. All variables were dichotomized at the optimal threshold identified on the training set. Only DACTI had a significant interaction with atezolizumab treatment. Discussion Whereas anti-PD(L)1 therapy has demonstrated improved efficacy over chemotherapy in trials across a variety of indications, not all patients experience improved survival from these therapies.40, 41 Given this paradigm, a biomarker capable of selecting patients most likely to benefit could extend survival while allowing patients who would not benefit to avoid the morbidities associated with these treatments. However, PD-L1 IHC scoring by pathologists, currently the most widely used biomarker for these treatments,42 has limited predictive power.12 Accordingly, there has been interest in developing alternative biomarkers which overcome these limitations. In this study, we drew on the concept of immunophenotyping, in which a pathologist labels pathology samples as “desert”, “excluded”, or “inflamed” based on the number and spatial distribution of CD8+ T cells in the tumor lesion. We then applied these concepts to develop an automated method for quantifying the concentration and infiltration of CD8+ T cells at the tumor epithelial boundary. Specifically, we used DP to generate a DACTI. We then demonstrated that a machine learning model incorporating these features was associated with patient OS after atezolizumab treatment in advanced NSCLC. DACTI was calibrated for differentiation of OS in patients in our training cohort (n = 197) drawn from a phase 2 trial (POPLAR). DACTI was then evaluated for predictive power in an independent validation set of patients (n = 879) drawn from OAK, a randomized phase 3 trial with treatment arms identical to POPLAR. In the OAK atezolizumab monotherapy arm, the high-DACTI patients had longer OS than low-DACTI patients (HR = 0.67, 95% CI: 0.53–0.86). High DACTI was also associated with improved OS with atezolizumab treatment within the PD-L1-negative subcohort (HR = 0.47, 0.27–0.84), a group which has exhibited minimal benefit from anti-PD-(L)1 monotherapy in NSCLC.43 In contrast, no such difference was observed in the docetaxel-treated patients. This suggests that DACTI may be associated specifically with benefit from atezolizumab treatment, rather than being just a prognostic marker and that spatial immune features can identify immunotherapy-responsive tumors missed by PD-L1 alone. This predictive signal in independent validation on data from a large, randomized clinical trial distinguishes this work from previous approaches. Whereas DP has been used extensively in cancer detection, grading, and outcome prognosis, there is much more limited literature on predicting treatment benefit.44, 45 Recent work in this area has identified the spatial arrangement of immune cells in the tumor lesion as prognostic and predictive in lung,24 gynecological,25, 26 and breast27 cancers. However, previous work using hematoxylin and eosin-stained images could not specifically quantify the distribution of CD8-positive lymphocytes, which play a key role in determining immunotherapy benefit.46 Our use of IHC staining allowed for precise measurement of CD8+ cells in the stromal and epithelial compartments without higher-complexity immunofluorescence assays. A smaller number of studies have examined the density distribution of CD8-positive cells between the stroma and epithelium in breast and colorectal cancers47 and in urothelial cancer.48 Notably, these studies found a prognostic benefit from increased CD8-positive cell infiltration into the tumor but did not include data from randomized trials, and were therefore unable to evaluate the predictive power of these signals. We build on this previous work by adding an IHC tumor marker for precise tumor localization, by specifically focusing on the ESI, and by developing and validating a machine learning model for prediction of immunotherapy benefit. Additionally, whereas previous work has used DP to directly predict immunophenotype,23, 49 our extracted features do not solely recapitulate immunophenotype, but instead quantify aspects of the tumor-immunity continuum to drive the predictive power of that method. Further, we used bulk RNAseq data from matched samples to correlate the phenotypic findings from DP with transcriptomic signatures associated with CD8 T cell infiltration. The genes most strongly correlated with the features of DACTI were related to T cell infiltration, providing orthogonal verification that our novel DP approach is accurately characterizing immune distribution in the TME. To our knowledge, this is the first study to quantify CD8+ T cell density specifically at the ESI and to validate its predictive value for checkpoint inhibitor benefit in an independent phase 3 randomized controlled trial. Unlike categorical immunophenotyping approaches that assign tumors to qualitative categories (desert, excluded, and inflamed), DACTI provides a continuous, quantitative score based on two biologically motivated features tied to the mechanism of action of checkpoint inhibitors: T cell concentration at the ESI and T cell infiltration into the tumor epithelium. Overcoming the epithelial–stromal barrier is now recognized as a hurdle for emerging modalities beyond checkpoint inhibitors, including armored CAR-T cell therapies50 and next-generation lymphocyte-based therapies,51 underscoring the broader relevance of a robust, scalable method for quantifying T cell penetration into tumor nests. Our approach is highly interpretable due to its use of specific, hypothesis-driven features of cytotoxic T cell distribution, the effector cell of anti-tumor immunity. This is in contrast to “black box” deep learning approaches in which it is a challenge to relate specific tissue morphologies to the machine's predictions. Such a lack of transparency has been identified as a detrimental factor for clinician trust in machine learning approaches.52 A limitation of this study is its retrospective nature, which prevents establishing a causal relationship between CD8+ T cell spatial distribution and immunotherapy benefit. However, the independent validation in a randomized phase 3 trial provides the strongest level of evidence attainable from retrospective biomarker analysis. Future work in this area could include prospective validation in a biomarker-stratified trial. The use of archival material also meant that whereas our correlation of DP features with RNAseq data was restricted to cases where both samples came from the same block, it was not possible to ensure that the pathology slide was taken from the area adjacent to the tissue used for RNAseq. And, whereas the atezolizumab benefit seen among patients with material available for this study matched the effect observed in the trials they were drawn from, it is possible these patients had an undetected difference from the full trial datasets. In addition, the slides of both the training and validation sets were stained and digitized in the same lab and annotated by the same set of pathologists. Whereas this reduced variability in our measurement of tissue morphology, it also prevented analysis of the robustness of our method to these preanalytical sources of variability. Related to this point, image processing steps to identify the epithelial and stromal compartments and label cells within them were optimized by subjective evaluation and were not compared to objective ground truth. Finally, both the training set and independent validation set contained a mix of NSCLC subtypes, of biopsies and resections, and of primary and metastatic tumors. Because the clinical trial these patients were drawn from was not powered to examine effects in these subcohorts, we were not able to determine whether the predictive power of DACTI varied across these subsets. For future work, the ESI concept and CD8+ spatial analysis framework are applicable to any solid tumor with a defined epithelial–stromal boundary. The panCK stain is broadly reactive across carcinomas, and CD8 is the standard marker for cytotoxic T cells regardless of tumor type. Adaptation to tumor types with less distinct epithelial–stromal boundaries (e.g., diffuse gastric cancer) may require modification of the tissue segmentation approach. For incorporation in a clinical workflow, DACTI requires a panCK/CD8 dual IHC slide. Whereas this is a low-cost assay, which can be executed on the standard instruments of a histopathology lab, it is not routinely performed and has not been developed as a clinically validated assay. Formal analytical validation of both the assay and image processing pipeline across sources of preanalytic variation would be required before clinical deployment of this method. The successful independent cohort validation across two clinical trials provides preliminary evidence of analytical robustness but does not substitute for a dedicated analytical validation study. Future work in implementing these steps would be necessary before clinical adoption. Additionally, future work in this area may include automating the tumor lesion detection step in order to fully automate the digital processing and scoring. We have demonstrated a DP methodology for assessing tumor immune infiltration, used bulk RNAseq to verify the signal detected by our novel measures, and used this method to predict patient benefit from atezolizumab monotherapy in a large phase 3 randomized clinical trial. Future clinical trials could apply this method for patient selection to test the expansion of treatment eligibility to DACTI-high, PD-L1-negative patients in indications not currently considered likely to benefit from atezolizumab monotherapy. Ethics statement and patient consent Material used in this study was collected in accordance with the ethics approval and research consent obtained in the POPLAR (NCT01903993) and OAK (NCT02008227) clinical trials. Declaration of competing interest The authors declare the following financial interests/personal relationships, which may be considered as potential competing interests: Patrick Leo reports financial support was provided by Genentech. Patrick Leo, Hauke Kolster, Hartmut Koeppen, Jennifer Giltnane, Namrata S. Patil, Niha Beig, Barzin Y. Nabet, Daniel Ruderman, and Cleopatra Kozlowski report a relationship with Genentech that includes: employment and equity or stocks. Patrick Leo, Hauke Kolster, Daniel Ruderman, and Cleopatra Kozlowski have patent #WO2024238970A1 pending to Genentech. If there are other authors, they declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this article.