Abstract
Objective
Coeliac disease, an autoimmune disorder affecting approximately 1% of the global population, is typically diagnosed on duodenal biopsy. However, interpathologist agreement on coeliac disease diagnosis is only 80%. Existing machine learning solutions designed to improve coeliac disease diagnosis often lack interpretability, which is essential for building trust and enabling widespread clinical adoption. We aim to develop an interpretable artificial intelligence (AI) model segmenting key histological structures in H&E-stained duodenal biopsies, generating explainable segmentation masks, estimating intraepithelial lymphocyte (IEL)-to-enterocyte and villus-to-crypt ratios and diagnosing coeliac disease.
Methods and Analysis
Semantic segmentation models were trained to identify villi, crypts, IELs and enterocytes using 49 annotated 2048×2048 patches at 40× magnification. Subsequently, IEL-to-enterocyte and villus-to-crypt ratios were calculated from segmentation masks generated by the segmentation model from 172 whole slide images (WSIs), and a logistic regression model was trained to diagnose coeliac disease based on these ratios. Evaluation was performed on an independent test set of 613 WSIs from an independent medical institution.
Results
The villus–crypt segmentation model achieved mean precision-recall area under the curve (AUC) of 80.5%, while the IEL–enterocyte model reached precision-recall AUC of 82%. The diagnostic model classified WSIs with 96% accuracy, 86% positive predictive value and 98% negative predictive value on the independent test set.
Conclusions
Our interpretable AI models accurately segmented key histological structures and diagnosed coeliac disease in unseen WSIs, demonstrating strong generalisation performance. These models provide pathologists with reliable IEL-to-enterocyte and villus-to-crypt ratio estimates, enhancing diagnostic accuracy. Interpretable AI solutions like ours are essential for fostering trust among healthcare professionals and patients, complementing existing black-box methodologies.
Keywords: Machine Learning, Artificial intelligence
WHAT IS ALREADY KNOWN ON THIS TOPIC
Pathologist concordance in diagnosing coeliac disease from duodenal biopsies is consistently reported to be below 80%, highlighting diagnostic variability and the need for improved methods. Several recent studies have leveraged artificial intelligence (AI) to enhance coeliac disease diagnosis. However, most of these models operate as ‘black boxes’, offering limited interpretability and transparency. The lack of explainability in AI-driven diagnostic tools prevents widespread adoption by healthcare professionals and reduces patient trust.
WHAT THIS STUDY ADDS
This study presents an interpretable semantic segmentation algorithm capable of detecting the four key histological structures essential for diagnosing coeliac disease: crypts, villi, intraepithelial lymphocytes (IELs) and enterocytes. The model accurately estimates the IEL-to-enterocyte ratio and the villus-to-crypt ratio, the latter being an indicator of villous atrophy and crypt hyperplasia, thereby providing objective, reproducible metrics for diagnosis. The segmentation outputs allow for transparent, explainable decision-making, supporting pathologists in coeliac disease diagnosis with improved accuracy and confidence.
HOW THIS STUDY MIGHT AFFECT RESEARCH, PRACTICE OR POLICY
This study presents an AI model that automates the estimation of the IEL-to-enterocyte ratio, a labour-intensive task currently performed manually by pathologists in limited biopsy regions. By minimising diagnostic variability and alleviating time constraints for pathologists, the model provides an efficient and practical solution to streamline the diagnostic workflow. Tested on an independent data set from a previously unseen source, the model demonstrates explainability and generalisability, enhancing trust and encouraging adoption in routine clinical practice. Furthermore, this approach could set a new standard for AI-assisted duodenal biopsy evaluation, paving the way for the development of interpretable AI tools in pathology to address the critical challenges of limited pathologist availability and diagnostic inconsistencies.
Introduction
With the emergence of digital pathology, artificial intelligence (AI) has the potential to improve the accuracy and speed of diagnosis. Duodenal (small intestinal) biopsies in particular are well suited to develop novel AI algorithms for, as the percentage of malignant diagnoses (<1%) is small compared with other parts of the body.
The most common pathology found in the duodenum is coeliac disease, a chronic autoimmune disorder triggered by the ingestion of gluten, a protein found in barley, wheat and rye.1 It is estimated to affect approximately 1% of the global population, with significant regional variation.2 3 The only available treatment is following a life-long gluten-free diet.
Coeliac disease can lead to a variety of gastrointestinal and systemic symptoms including vitamin deficiency, anaemia, weight loss, diarrhoea, fatigue and infertility.4 Furthermore, if left untreated, it can significantly increase the risk of developing duodenal adenocarcinoma and lymphoma.4 5
Current diagnosis
Most guidelines suggest a serological test for patients with symptoms suggestive of coeliac disease. Unless the tissue transglutaminase IgA (tTG-IgA) antibody is at least 10 times the upper limit of normal and the IgA endomysial antibody (EMA) test is positive, a duodenal biopsy is recommended as the gold standard for coeliac disease diagnosis.6–8 Pathologists diagnose coeliac disease on histological sections of duodenal biopsies viewed under the microscope or as a scanned image, by identifying a number of abnormalities. These include an increased ratio of intraepithelial lymphocytes (IELs) to enterocytes in the villi, villous atrophy (significant blunting and reduction in size of the villi, sometimes to a flat appearance) and crypt hyperplasia (crypts becoming longer and thinner).9 However, a number of independent studies have shown the agreement between pathologists when diagnosing coeliac disease to be lower than 80%,9–19 underlining the unmet clinical need for a more accurate diagnostic solution.
The role of AI in supporting pathologists
Beyond the technical challenges, the development of AI tools for pathology must be aligned with the realities of clinical workflows and the human elements of diagnostic practice. Pathologists routinely face high workloads, and tasks such as quantifying IELs or measuring villous atrophy are time-consuming, subjective and prone to interobserver variability. Rather than replacing pathologists, well-designed AI tools have the potential to support them, by automating repetitive tasks, offering consistent quantitative metrics and highlighting diagnostically relevant regions, ultimately improving both efficiency and confidence in diagnosis. While this study focuses on developing and validating interpretable AI outputs, we view this as a foundational step toward building tools that could be integrated into real-world diagnostic workflows and accepted as practical aids by the pathology community.
Other work in this area
Several recent studies have aimed to improve the diagnosis of coeliac disease on H&E stained biopsies with AI. The majority20–27 used black-box classification algorithms that output a single diagnosis without providing any explanation or justification, which provides a significant barrier towards adoption: numerous studies on the acceptability of AI solutions in pathology emphasise that successful integration depends on making AI output ‘easily interpretable to clinicians and patients’.28–32 Furthermore, most studies did not test their models on an independent test set which would provide insights into its robustness and ability to handle common variability in image acquisition and staining procedures.20–26
A few recent studies have attempted to use image segmentation techniques to diagnose coeliac disease in a more explainable manner.
Gruver et al 33 used a customised off-the-shelf AI software to segment villous epithelium, lamina propria and crypts on H&E-stained biopsies and IELs and enterocytes on CD3 immunohistochemistry whole slide images (WSIs). The two main drawbacks are, first, that the cell detection is carried out on CD3-stained biopsies which are rarely used in routine reporting practice and, second, the algorithm is trained and tested on images from the same source, therefore not proving any generalisation performance.
Griffin et al 34 created a convolutional neural network to identify cells, tissue and artefact regions in biopsies of coeliac disease and normal duodenal tissue. They extracted features from these regions and correlated them with Marsh scores. Weaknesses of their approach are the small size of the test set (n=28) and the fact that the test set cases came from the same source as the training images.
In this study, we aim to develop an explainable model for the interpretable analysis of duodenal biopsies and the accurate diagnosis of coeliac disease. More specifically, our objectives are to:
Train segmentation models to detect villi, crypts, enterocytes and IELs in duodenal biopsies.
Use these model outputs to predict the IEL-to-enterocyte and villus-to-crypt ratios, key markers in diagnosing coeliac disease.
Train a logistic regression classifier to diagnose coeliac disease based on these ratios and test it on a set of representative biopsies from a new hospital source, to ensure generalisability.
Data
Segmentation training data set
We trained our segmentation models on 49 annotated patches (small subimages taken from larger WSIs) at 40× magnification (approximately 0.25 microns per pixel), each sized 2048×2048 pixels, to ensure they were sufficiently large to be able to include multiple villi. The patches are taken from 43 unique WSIs (several patches were extracted from different parts of the same WSI) from five different medical centres scanned using four different scanners (see online supplemental table S1). Of the 49 patches in the training data set, 27 have been extracted from WSIs with a previous normal diagnosis, 15 from coeliac disease WSIs and 7 from WSIs with other diagnoses. We handpicked patches to ensure they included diverse regions of the biopsies and various cell types. Each patch includes annotations drawn by pathologists using the open source QuPath software35 outlining the villous epithelium (150 unique annotations), crypt epithelium (759), villous enterocyte nuclei (13 853), crypt enterocyte nuclei (23 657) and IELs (4368).
bmjdhai-1-1-bmjdhai-2025-000023-s001.pdf (760.8KB, pdf)
Classification training data set
We further trained a logistic regression model to classify coeliac disease versus normal diagnoses using the IEL-to-enterocyte and villus-to-crypt ratios as input features. We ran our segmentation models on 172 WSIs (77 from coeliac disease cases and 95 normal), sourced from four different institutions. The calculated ratios were then used to train the logistic regression model. This data set only included clinical diagnoses and no further cellular annotations. A breakdown of hospital origins of these images is provided in online supplemental table S1.
Classification test set
Finally, we used an independent test set from a source from which no training data had been included. The test set included 613 WSIs, of which 88 had coeliac disease (60% female, median age 47) and 525 a normal diagnosis (60% female, median age 62). The WSIs were scanned on a Philips IntelliSite Ultra Fast Scanner. The detailed patient demographic breakdown of the test set is provided in online supplemental table S2. Clinical diagnoses were used as the ground truth. In cases where the diagnosis indicated uncertainty, we refined the label using supporting metadata, including blood test results and clinical notes.
Method
The overall pipeline for our proposed method (as highlighted in figure 1) consists of three main stages: preprocessing, semantic segmentation and coeliac disease classification.
Figure 1.

Model pipeline: the pipeline consists of the following steps: (1) artefacts are removed, and the tissue is selected; (2) the tissue is divided into small patches; (3) stain normalisation is applied; (4) villi and crypts are segmented using a U-Net model; (5) IELs and enterocytes are segmented within the already segmented villi and crypts using another U-Net model; (6) the villus-to-crypt ratio and IEL-to-enterocyte ratios in both villi and crypts are computed; (7) a simple logistic classification model diagnoses the sample as either coeliac disease or normal. The outputs, including segmentation masks, the computed ratios and the final diagnosis, are presented to a pathologist for review. AI, artificial intelligence; IEL, intraepithelial lymphocyte.
Preprocessing
We took inspiration from work previously developed within our group, especially those described by Denholm et al,26 to develop our preprocessing pipeline.
Tissue masking
We used Schreiber’s method,36 also from our group, to distinguish tissue areas from white background and unwanted artefacts and to generate tissue masks for the WSI.
Patch extraction
Each WSI was divided into smaller patches at 40× magnification (the highest magnification available) of size 2048×2048 using QuPath.
Stain normalisation
To reduce variation caused by different staining and scanning procedures, we applied a stain normalisation process using the Macenko method.37 Stain normalisation has been shown by many studies to improve generalisation performance.38–40
Cellular segmentation
We trained two separate sets of semantic segmentation models: villus–crypt models and IEL-enterocyte models:
Villus–crypt model
We used the U-Net architecture41 with a ResNet32 encoder42 initialised with ImageNet pretrained weights43 and a final softmax layer applied on a pixel basis. We trained the models using threefold cross-validation for 70 epochs using the Adam optimiser with a cosine cycling learning rate scheduler (with a minimum and maximum learning rate of 1 × 10−5 and 5 × 10−5, respectively, updated at the end of every epoch) and using the focal loss.44 We downsized each patch by a factor of 2 to 1024 × 1024 (at 20× magnification) and applied extensive data augmentation: random horizontal flips, rotations and shifts were applied to introduce spatial variability, while colour jittering (p=0.2) simulated changes in brightness (0.9 to 1.1), contrast (0.9 to 1.1), saturation (0.8 to 1.0) and hue (−0.5 to 0.5). All code was implemented in PyTorch (V.1.13.1).45
IEL–enterocyte model
The IEL–enterocyte model focuses solely on the areas of the WSI that have already been segmented as either villi or crypts. During training, we used the mask provided by the pathologist and during inference, we used the output from the villus–crypt model to determine which parts of the image the models should focus on. We used the same model architecture and a similar set-up as before: we trained the models for 60 epochs and with a cycling learning rate scheduler where the minimum and maximum learning rates were 5 × 10−5and 5 × 10−4, respectively. The most significant difference to the villus–crypt model was that here we split each patch into four smaller patches of size 1024×1024 at 40× magnification, as a form of regularisation. As IELs and enterocytes are significantly smaller than villi and crypts, a higher magnification was needed.
Coeliac disease classification
Finally, we fitted a simple logistic regression classifier that makes either a normal or coeliac disease diagnosis based on the masks produced by the two segmentation models. We first computed the villus-to-crypt area ratio, a surrogate metric for villous atrophy and crypt hyperplasia, by dividing the number of pixels segmented as villus in the entire WSI by the number of pixels classified as crypt. Similarly, we computed the IEL-to-enterocyte ratio separately in the villi and the crypts. We then fitted a simple logistic regression classifier that takes as input the three ratios and outputs a single diagnosis. Online supplemental material D provides a more comprehensive analysis of the classification model.
Patient and public involvement
This study was informed by extensive patient and public involvement activities undertaken before study initiation. Patients consistently raised concerns about the inaccuracy of duodenal biopsy, the current ‘gold standard’ for coeliac disease diagnosis and its contribution to underdiagnosis. More broadly, our ongoing work on developing AI solutions for coeliac disease diagnosis has been guided by a 2024 survey of 192 patients conducted in partnership with Coeliac UK. In this survey, 67% of respondents expressed strong trust in hypothetical AI-based diagnostic tools, compared with only 5% expressing weak trust. However, patients also repeatedly highlighted the importance of explainability within AI models. Feedback from earlier work with AI algorithms for coeliac disease diagnosis26 27 confirmed that a lack of interpretability was a key concern. These insights directly shaped the design of this study, motivating our use of a segmentation-based, interpretable approach.
Results
We first show how accurately we can predict the IEL-to-enterocyte ratio from segmentation masks. We then summarise the validation results of our segmentation before testing our segmentation and classification models on the independent test set.
Predicting IEL-to-enterocyte ratios
As semantic segmentation masks do not specify instances of individual objects, but instead label each pixel as belonging to a type of object (eg, an IEL), we can only estimate the number of instances of an object type (eg, the number of IELs in a biopsy). We can predict the IEL-to-enterocyte ratio by dividing the number of pixels classified as IELs by the number of pixels classified as enterocytes in either crypts or villi while correcting for the different average cell sizes. As shown in figure 2, Pearson correlation analysis showed that the ratio based on the total area covered by pathologists’ annotated IELs and enterocytes correlates very highly with the true IEL-to-enterocyte ratio derived from pathologists’ cell annotations (r=0.92, p=7.2 × 10–19). The mean absolute error was 0.016±0.020 which corresponds to fewer than 2 IELs per 100 enterocytes.
Figure 2.

Comparisons of IEL-to-enterocyte ratio estimates. Left: the IEL-to-enterocyte ratio derived from pathologists’ cell annotations was compared with the ratio estimated based on the total area covered by pathologists’ annotated IELs and enterocytes. Pearson correlation analysis revealed a strong correlation with an r-value of 0.92 (p=7.20 × 10−19). The mean absolute was 0.016 ± 0.02. Right: the IEL to-enterocyte ratio from pathologists’ annotations was compared with the ratio estimated by the AI model on a validation data set of 49 images. Pearson correlation analysis showed a strong correlation, with an r-value of 0.90 (p=4.04 × 10−17). The mean absolute error was 0.028± 0.019. AI, artificial intelligence; IEL, intraepithelial lymphocyte.
Validation of semantic segmentation models
We trained and validated both the villus–crypt models and the IEL–enterocyte models using threefold cross-validation on the 49 annotated 2048×2048 patches. As summarised in online supplemental table S3, the villus–crypt models segmented villi with a mean accuracy of 90%, precision (positive predictive value) of 67% and recall (sensitivity) of 80%. The same models segment crypts with a mean accuracy of 90%, precision (positive predictive value) of 78% and recall (sensitivity) of 71%.
The IEL–enterocyte models achieve mean accuracies of 91% and 99%, precision (positive predictive values) of 85% and 65% and recall (sensitivity) values of 85% and 67% for enterocytes and IELs, respectively, as summarised in online supplemental table S3. We include confusion matrices and some example patches in figure 3, thereby further visualising the models’ validation performance.
Figure 3.

Validation performance. (a) Confusion matrix showing the mean validation performance of the two segmentation models on a pixel basis, normalised per true label (ie, per row). For example, 72% of pixels annotated as crypts by pathologists were correctly segmented as crypts by the models. The most common misclassification was labelling IEL pixels as enterocyte pixels. (b) Examples of validation images for each model set. Columns 1 and 4 display the raw image patches, columns 2 and 5 show pathologists' annotations and columns 3 and 6 show the corresponding model predictions. Bkg, background. IEL, intraepithelial lymphocyte.
Finally, we validated how accurately our segmentation models can estimate the IEL-to-enterocyte ratio, a key feature in the pathologist’s diagnosis of coeliac disease. As shown in figure 2b, the IEL-to-enterocyte ratio estimated by the segmentation models only differs from the ratio calculated from the pathologists’ manual annotations by a mean absolute value of 0.028 (which corresponds to 3 IELs per 100 enterocytes). The Pearson test further showed a strong correlation (r=0.90, p=7.20 × 10−19) between the pathologists’ and the model’s ratios. We further analysed the different IEL-to-enterocyte ratios in online supplemental figures S1–S4, and the accompanying text.
Test of the coeliac disease classification models
We also tested our coeliac disease classification pipeline that takes as input an entire WSI, then first carries out the preprocessing steps described in the methods section (background/artefact removal, patch extraction, stain normalisation), second, runs the villus–crypt segmentation model, third, runs the IEL–enterocyte segmentation model, fourth, computes the villus-to-crypt ratio as well as the IEL-to-enterocyte ratios in the villi and the crypts, and fifth, runs a classifier that takes as input these three ratios and outputs a diagnosis of either ‘normal’ or ‘coeliac disease’.
We tested our segmentation models on a data set comprising 613 WSIs from a previously unseen source to test the diagnostic accuracy and generalisation performance of our models. We visualise the output of the segmentation models on a few selected patches in figure 4. As illustrated in figure 5, the ratios we get for the normal and the coeliac disease populations are significantly different. The mean villus-to-crypt ratios were 0.91±0.52 for the coeliac disease population and 2.83±2.56 for the normal population (p=7.0 × 10−12) using the independent samples t-test, reflecting the significant level of villous blunting that can be observed in the majority of coeliac disease biopsies. Conversely, the IEL-to-enterocyte ratio in the villi is significantly higher (p=2.4 × 10−68) for coeliac disease cases (14.44±3.58) than it is for normal ones (7.81±2.75), which matches clinical practice where pathologists use an increased IEL count in the villi as a key indication for coeliac disease. A statistically significant difference (p=1.3 × 10−6) is also observed in the crypt IEL-to-enterocyte ratio, even though this metric is not typically considered by pathologists when diagnosing coeliac disease.
Figure 4.

Sample visual outputs of segmentation models on test images: We showcase patches from five coeliac disease biopsies and five normal biopsies, collected from four different hospitals. For each patch, three visualisations are provided: (1) the original H&E-stained image, (2) the segmentation mask for IELs and enterocytes and (3) the segmentation mask for villi and crypts. These outputs demonstrate the models’ robustness and effectiveness across diverse sources and tissue characteristics. IEL, intraepithelial lymphocyte.
Figure 5.

Ratio distributions on the test set. We highlight the distributions of (a) villus-to-crypt ratios, (b) IEL-to-enterocyte ratios in the villi and (c) IEL-to-enterocyte ratios in the crypts for the normal and coeliac disease populations on the independent test data. We observed statistically significant differences for all three ratios (p values of 7.0 × 10−12, 2.4 × 10−68 and 1.3 × 10−6, respectively). More information about the three outliers in the villus-to-crypt ratio plot can be found in online supplemental material E. IEL, intraepithelial lymphocyte.
Next, we evaluated the logistic regression-based classifier on the same independent test set and achieved 96% accuracy, 86% positive predictive value (precision) and 98% negative predictive value. We further show that our overall classification process for coeliac disease, based on semantic segmentation, followed by logistic regression-based classification, achieved greater than 89% accuracy for all patient groups regardless of age and sex. Online supplemental figures S5–S8, along with the accompanying text, provide a more comprehensive analysis of the classification model.
Discussion
We have presented an accurate, explainable and generalisable method for coeliac disease diagnosis in this work. We trained two sets of segmentation models to highlight villi, crypts, IELs and enterocytes in duodenal biopsies. The segmentation masks can be reviewed by pathologists to develop trust in the model. We further showed how the model is able to estimate accurately the IEL-to-enterocyte ratio, one of the key characteristics on which pathologists base their coeliac disease diagnosis. Given that the threshold indicating coeliac disease used by pathologists varies between 0.2 and 0.4 (equivalent to 20–40 IELs per 100 enterocytes),46–48 and the range of pathologist’s cell ratios across the patches spans from 0.02 to 0.28, we conclude that a mean error of 0.028 is acceptable and unlikely to be significant. We then demonstrated how the IEL-to-enterocyte and the villus-to-crypt ratios returned by the segmentation models are significantly different (p<0.00001) for the normal and coeliac disease populations. We subsequently trained a classifier that takes these ratios as input and which gives a coeliac disease or normal diagnosis with over 94% accuracy. Unlike other previous works that aimed to train segmentation models for the diagnosis of coeliac disease, we tested our models on an independent test set, including 613 WSIs from a new hospital not previously used to train the models. We thus demonstrated very strong generalisability of our models, which, combined with the interpretable nature of our model outputs, increases the likelihood of clinical adoption.
The work we presented marks an important step towards improving coeliac disease diagnosis for several key reasons. First, there is a global shortage of pathologists, resulting in long waiting times.49 50 Second, studies consistently report high rates of disagreement among pathologists when diagnosing coeliac disease.9–19 Third, most existing AI studies aimed at improving coeliac disease diagnosis function as ‘black boxes’, limiting their acceptance by healthcare professionals and patients due to a lack of transparency.20–26
Our interpretable AI approach marks a significant first step toward software that could support faster, more accurate and trustworthy coeliac disease diagnosis. Whereas pathologists typically estimate cell ratios from a few selected regions, our model performs a slide-wide, cell-by-cell analysis across the entirety of the biopsy, encompassing thousands or even tens of thousands of cells. To the best of our knowledge, this is the first explainable segmentation-based AI approach for coeliac disease diagnosis that has been evaluated on a large, independent test set from a separate clinical institution.
In a potential clinical workflow, a refined version of this software could be integrated into an image management system (IMS), where it would provide the pathologist with quantitative outputs including the IEL-to-enterocyte ratio, as well as a suggested diagnosis. These metrics would be displayed alongside the original biopsy image, allowing for rapid assessment and validation. To further aid diagnostic efficiency, the pathologist could request a set of top n patches with the highest IEL-to-enterocyte ratios, directing their attention to the most abnormal regions. This form of interaction maintains human oversight while leveraging the model’s analytical capabilities to support, rather than replace, clinical judgement.
Future work could extend the segmentation models to different types of cells, such as goblet cells, Paneth cells or Brunner’s glands. Instance segmentation models may also return more accurate cell counts. The main limitation of this work is the lack of a perfect ground truth due to the imperfect nature of pathologists’ coeliac disease diagnosis. We hope that, in the future, our work can improve this situation by providing more reproducible diagnosis of duodenal biopsies.
Limitations and future work
Tissue orientation during sectioning is a known source of diagnostic variability in histopathology, particularly in the assessment of villous and crypt architecture. In this study, we did not explicitly account for orientation or sectioning angle, which may lead to misrepresentation of crypt structures and impact the derived metrics (see, eg, the three-dimensional model by Taavela et al 51). This limitation is especially evident in some poorly oriented slides (eg, figures 3 and 4, and online supplemental material D.4). In future work, we aim to incorporate automated orientation assessment and filtering, or correction strategies, to ensure more reliable interpretation of morphometric features.
In this study, we used the ratio of segmented villus and crypt pixel counts as a surrogate metric for the villous height to crypt depth (VH:CD) ratio commonly assessed by pathologists. While this proxy does not replicate the exact methodology used in manual measurements, it offers a scalable and interpretable measure derived directly from the segmentation output. In future work, we plan to develop an algorithm that aims to replicate the clinical measurement process by identifying well-oriented villi and crypts within the segmentation masks and computing their average heights. This would enable a more direct and clinically meaningful comparison with pathologist-derived VH:CD ratios. Notably, despite the current simpler surrogate approach, our results in figure 5 show a highly significant difference between normal and coeliac disease cases (p<0.1 × 10−¹¹), highlighting the potential diagnostic relevance of the segmentation-based metric.
Beyond technical development, future work must also address how an improved interpretable AI tool would be deployed and evaluated in clinical settings. This includes prospective studies to assess its performance in real-world workflows, as well as qualitative studies to understand how pathologists perceive the tool’s utility, acceptability and interpretability. Broader implementation questions, such as integration with IMSs, information technology infrastructure requirements and energy consumption, are also key to ensuring that the solution is scalable and sustainable. Health economic evaluations will be important to assess the potential cost-effectiveness of automating labour-intensive tasks, reducing diagnostic variability and potentially shortening time to diagnosis. These aspects are critical for the delivery of AI tools that are not only technically robust but also feasible and impactful in routine pathology practice.
Conclusion
This study presents an interpretable AI model that estimates key diagnostic features in coeliac disease, including the IEL-to-enterocyte and villus-to-crypt ratios (a surrogate metric for the VH:CD ratio) tasks that are currently time-consuming, subjective and inconsistently performed by pathologists. By delivering a comprehensive, high-resolution analysis across entire biopsy slides, our approach provides objective and reproducible metrics that align closely with clinical criteria.
Tested on an independent data set from a previously unseen institution, our model demonstrates strong generalisability and avoids the pitfalls of black-box systems by offering transparent, reviewable segmentation outputs. This allows pathologists to verify model predictions and focus their attention on diagnostically relevant regions, laying the foundation for clinical workflows that are both efficient and trustworthy.
Our interpretable AI approach marks a significant first step toward software that could support faster, more accurate and consistent coeliac disease diagnosis. While additional work is required to evaluate the tool in live clinical settings and explore implementation at scale, this study provides a compelling proof-of-concept for how AI can meaningfully assist pathologists. In doing so, it helps to address the pressing challenges of limited workforce capacity, diagnostic variability and increasing demand in modern histopathology.
Acknowledgments
We would like to thank and acknowledge Graham Snudden for organisational support.
Funding Statement
This work has been supported by Coeliac UK, Innovate UK (grant INOV03-19 to ES), NIHR (grant NIHR205502) and the Cambridge Centre for Data-Driven Discovery (C2D3).
Footnotes
FJ and RB contributed equally.
Contributors: FJ, RB, JD and JRD developed the underlying methodology. ES conceived and set up the overall study. FJ and RB drafted the manuscript. VS and DE created the cellular annotations for the training and validation dataset under the supervision of MJA; JD, BS, VS, SCE and ES set up the annotation pipeline. All authors contributed to and had the opportunity to review and correct drafts of the manuscript. FJ is the guarantor. I used LLMs to proofread the text and make suggestions to improve clarity.
Funding: This work has been supported by Coeliac UK, Innovate UK (grant INOV03-19 to ES), NIHR (grant NIHR205502) and the Cambridge Centre for Data-Driven Discovery (C2D3).
Competing interests: The authors declare the following financial interests/personal relationships which may be considered as potential competing interests: the following authors are shareholders in Lyzeum: FJ, JD, MJA and ES.
Patient and public involvement: Patients and/or the public were involved in the design, or conduct, or reporting, or dissemination plans of this research. Refer to the Methods section for further details.
Provenance and peer review: Not commissioned; externally peer reviewed.
Supplemental material: This content has been supplied by the author(s). It has not been vetted by BMJ Publishing Group Limited (BMJ) and may not have been peer-reviewed. Any opinions or recommendations discussed are solely those of the author(s) and are not endorsed by BMJ. BMJ disclaims all liability and responsibility arising from any reliance placed on the content. Where the content includes any translated material, BMJ does not warrant the accuracy and reliability of the translations (including but not limited to local regulations, clinical guidelines, terminology, drug names and drug dosages), and is not responsible for any error and/or omissions arising from translation and adaptation or otherwise.
Data availability statement
No data are available. The data sets analysed during this current study have not been made publicly available as we do not have ethical approval or patient agreements to publish the whole-slide images.
Ethics statements
Patient consent for publication
Not applicable.
Ethics approval
All slide scans (and accompanying fully anonymised patient data) were obtained with full ethical approval (IRAS: 162057; PI: Dr ES). Organisation: South Central—Oxford A (formally known as Oxfordshire Research Ethics Committee A).
References
- 1. van Berge-Henegouwen GP, Mulder CJ. Pioneer in the gluten free diet: Willem-Karel Dicke 1905-1962, over 50 years of gluten free diet. Gut 1993;34:1473–5. 10.1136/gut.34.11.1473 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2. Guandalini S, Assiri A. Celiac disease: a review. JAMA Pediatr 2014;168:272–8. 10.1001/jamapediatrics.2013.3858 [DOI] [PubMed] [Google Scholar]
- 3. Singh P, Arora A, Strand TA, et al. Global Prevalence of Celiac Disease: Systematic Review and Meta-analysis. Clin Gastroenterol Hepatol 2018;16:823–36. 10.1016/j.cgh.2017.06.037 [DOI] [PubMed] [Google Scholar]
- 4. Caio G, Volta U, Sapone A, et al. Celiac disease: a comprehensive current review. BMC Med 2019;17:142. 10.1186/s12916-019-1380-z [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5. Silano M, Volta U, Mecchia AM, et al. Delayed diagnosis of coeliac disease increases cancer risk. BMC Gastroenterol 2007;7:8. 10.1186/1471-230X-7-8 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6. Ludvigsson JF, Bai JC, Biagi F, et al. Diagnosis and management of adult coeliac disease: guidelines from the British Society of Gastroenterology. Gut 2014;63:1210–28. 10.1136/gutjnl-2013-306578 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7. Downey L, Houten R, Murch S, et al. Recognition, assessment, and management of coeliac disease: summary of updated NICE guidance. BMJ 2015;351:h4513. 10.1136/bmj.h4513 [DOI] [PubMed] [Google Scholar]
- 8. Nasser J, Jansson-Knodell C, Rubio-Tapia A. Celiac disease: Who should I test, and how? Cleve Clin J Med 2023;90:349–52. 10.3949/ccjm.90a.22062 [DOI] [PubMed] [Google Scholar]
- 9. Villanacci V, Magazzù G, Pellegrino S, et al. Comparison of the Marsh-Oberhuber classification with a new grading system in identifying patients with latent celiac disease. Minerva Gastroenterol Dietol 2010;56:371–5. [PubMed] [Google Scholar]
- 10. Corazza GR, Villanacci V, Zambelli C, et al. Comparison of the interobserver reproducibility with different histologic criteria used in celiac disease. Clin Gastroenterol Hepatol 2007;5:838–43. 10.1016/j.cgh.2007.03.019 [DOI] [PubMed] [Google Scholar]
- 11. Arguelles-Grande C, Tennyson CA, Lewis SK, et al. Variability in small bowel histopathology reporting between different pathology practice settings: impact on the diagnosis of coeliac disease. J Clin Pathol 2012;65:242–7. 10.1136/jclinpath-2011-200372 [DOI] [PubMed] [Google Scholar]
- 12. Niveloni SI, Cabanne AM, Vázquez H, et al. 1042 “Experts” Assess the Accuracy of Celiac Disease Diagnosis Performed in the Community Setting. Gastroenterology 2012;142:S–183. 10.1016/S0016-5085(12)60685-4 [DOI] [Google Scholar]
- 13. Weile B, Hansen BF, Hägerstrand I, et al. Interobserver variation in diagnosing coeliac disease. A joint study by Danish and Swedish pathologists. APMIS 2000;108:380–4. 10.1034/j.1600-0463.2000.d01-72.x [DOI] [PubMed] [Google Scholar]
- 14. Mubarak A, Nikkels P, Houwen R, et al. Reproducibility of the histological diagnosis of celiac disease. Scand J Gastroenterol 2011;46:1065–73. 10.3109/00365521.2011.589471 [DOI] [PubMed] [Google Scholar]
- 15. Kaur Bilkhoo H, Ducruet T, Marchand V, et al. Revisiting Pathological Criteria for Earlier Diagnosis of Coeliac Disease. J pediatr gastroenterol nutr 2016;62:734–8. 10.1097/MPG.0000000000001026 [DOI] [PubMed] [Google Scholar]
- 16. Ghanghoria S, Sharma S, Jain P, et al. Celiac Disease: Comparison of Oberhuber Classification and Corazza- Villanacci Classification. APALM 2019;6:A135–140. 10.21276/apalm.2190 [DOI] [Google Scholar]
- 17. Montén C, Bjelkenkrantz K, Gudjonsdottir AH, et al. Validity of histology for the diagnosis of paediatric coeliac disease: a Swedish multicentre study. Scand J Gastroenterol 2016;51:427–33. 10.3109/00365521.2015.1101486 [DOI] [PubMed] [Google Scholar]
- 18. Webb C, Halvarsson B, Norström F, et al. Accuracy in celiac disease diagnostics by controlling the small-bowel biopsy process. J Pediatr Gastroenterol Nutr 2011;52:549–53. 10.1097/MPG.0b013e3181fa434f [DOI] [PubMed] [Google Scholar]
- 19. Denholm J, Schreiber BA, Jaeckle F, et al. CD, or not CD, that is the question: a digital interobserver agreement study in coeliac disease. BMJ Open Gastroenterol 2024;11:e001252. 10.1136/bmjgast-2023-001252 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20. Wei JW, Wei JW, Jackson CR, et al. Automated Detection of Celiac Disease on Duodenal Biopsy Slides: A Deep Learning Approach. J Pathol Inform 2019;10:7. 10.4103/jpi.jpi_87_18 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21. Sali R, Ehsan L, Kowsari K, et al. CeliacNet: celiac disease severity diagnosis on duodenal histopathological images using deep residual networks. Proc - 2019 IEEE Int Conf Bioinforma Biomed BIBM 2019; San Diego, CA, USA, 2019:962–7. 10.1109/BIBM47256.2019.8983270 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22. Syed S, Al-Boni M, Khan MN, et al. Assessment of Machine Learning Detection of Environmental Enteropathy and Celiac Disease in Children. JAMA Netw Open 2019;2:e195822. 10.1001/jamanetworkopen.2019.5822 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23. Kowsari K, Sali R, Ehsan L, et al. HMIC: Hierarchical Medical Image Classification, A Deep Learning Approach. Information (Basel) 2020;11:318. 10.3390/info11060318 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24. Koh JEW, De Michele S, Sudarshan VK, et al. Automated interpretation of biopsy images for the detection of celiac disease using a machine learning approach. Comput Methods Programs Biomed 2021;203:106010. 10.1016/j.cmpb.2021.106010 [DOI] [PubMed] [Google Scholar]
- 25. Tabacchi ME, Tegolo D, Cascio D, et al. A Fuzzy-Based Clinical Decision Support System for Coeliac Disease. IEEE Access 2022;10:102223–36. 10.1109/ACCESS.2022.3208903 [DOI] [Google Scholar]
- 26. Denholm J, Schreiber BA, Evans SC, et al. Multiple-instance-learning-based detection of coeliac disease in histological whole-slide images. J Pathol Inform 2022;13:100151. 10.1016/j.jpi.2022.100151 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 27. Jaeckle F, Denholm J, Schreiber B, et al. Machine Learning Achieves Pathologist-Level Coeliac Disease Diagnosis. NEJM AI 2025;2:aioa2400738. 10.1056/AIoa2400738 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 28. Fan W, Liu J, Zhu S, et al. Investigating the impacting factors for the healthcare professionals to adopt artificial intelligence-based medical diagnosis support system (AIMDSS). Ann Oper Res 2020;294:567–92. 10.1007/s10479-018-2818-y [DOI] [Google Scholar]
- 29. Esmaeilzadeh P. Use of AI-based tools for healthcare purposes: a survey study from consumers’ perspectives. BMC Med Inform Decis Mak 2020;20:170. 10.1186/s12911-020-01191-1 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30. Tran V-T, Riveros C, Ravaud P. Patients’ views of wearable devices and AI in healthcare: findings from the ComPaRe e-cohort. NPJ Digit Med 2019;2:53. 10.1038/s41746-019-0132-y [DOI] [PMC free article] [PubMed] [Google Scholar]
- 31. Scott IA, Carter SM, Coiera E. Exploring stakeholder attitudes towards AI in clinical practice. BMJ Health Care Inform 2021;28:e100450. 10.1136/bmjhci-2021-100450 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 32. King H, Williams B, Treanor D, et al. How, for whom, and in what contexts will artificial intelligence be adopted in pathology? A realist interview study. J Am Med Inform Assoc 2023;30:529–38. 10.1093/jamia/ocac254 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33. Gruver AM, Lu H, Zhao X, et al. Pathologist-trained machine learning classifiers developed to quantitate celiac disease features differentiate endoscopic biopsies according to modified marsh score and dietary intervention response. Diagn Pathol 2023;18:122. 10.1186/s13000-023-01412-x [DOI] [PMC free article] [PubMed] [Google Scholar]
- 34. Griffin M, Gruver AM, Shah C, et al. Fully automated histological classification of cell types and tissue regions of celiac disease is feasible and correlates with the marsh score. medRxiv 2023. 10.1101/2023.12.11.23299520 [DOI] [Google Scholar]
- 35. Bankhead P, Loughrey MB, Fernández JA, et al. QuPath: Open source software for digital pathology image analysis. Sci Rep 2017;7:16878. 10.1038/s41598-017-17204-5 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36. Schreiber BA, Denholm J, Jaeckle F, et al. Rapid artefact removal and H&E-stained tissue segmentation. Sci Rep 2024;14:309. 10.1038/s41598-023-50183-4 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 37. Macenko M, Niethammer M, Marron JS, et al. A method for normalizing histology slides for quantitative analysis. 2009 IEEE Int. Symp. Biomed. Imaging Nano Macro, IEEE; 2009:1107–10. 10.1109/isbi.2009.5193250 [DOI] [Google Scholar]
- 38. Schreiber BA, Denholm J, Gilbey JD, et al. Stain normalization gives greater generalizability than stain jittering in neural network training for the classification of coeliac disease in duodenal biopsy whole slide images. J Pathol Inform 2023;14:100324. 10.1016/j.jpi.2023.100324 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 39. Ciompi F, Geessink O, Bejnordi BE, et al. The importance of stain normalization in colorectal tissue classification with convolutional networks. 2017 IEEE 14th International Symposium on Biomedical Imaging (ISBI 2017); Melbourne, Australia, 2017:160–3. 10.1109/ISBI.2017.7950492 [DOI] [Google Scholar]
- 40. Salvi M, Caputo A, Balmativola D, et al. Impact of Stain Normalization on Pathologist Assessment of Prostate Cancer: A Comparative Study. Cancers (Basel) 2023;15:1503. 10.3390/cancers15051503 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 41. Ronneberger O, Fischer P, Brox T. U-net: convolutional networks for biomedical image segmentation. In: Navab N, Hornegger J, Wells WM, et al., eds. Med. Image Comput. Comput.-Assist. Interv. – MICCAI 2015. 9351. Cham: Springer International Publishing, 2015: 234–41. Available: 10.1007/978-3-319-24574-4_28 [DOI] [Google Scholar]
- 42. He K, Zhang X, Ren S, et al. Deep residual learning for image recognition. Proc. IEEE Comput. Soc. Conf. Comput. Vis. Pattern Recognit., vol. 2016- Decem, IEEE Computer Society; Las Vegas, NV, USA, 2016:770–8. 10.1109/CVPR.2016.90 [DOI] [Google Scholar]
- 43. Deng J, Dong W, Socher R, et al. ImageNet: a large-scale hierarchical image database. Institute of Electrical and Electronics Engineers (IEEE); 2010. Available: 10.1109/cvpr.2009.5206848 [DOI] [Google Scholar]
- 44. Ross T-Y, Dollár G. Focal loss for dense object detection. Proc IEEE Conf Comput Vis Pattern Recognit 2017;2980–8. Available: 10.1109/iccv.2017.324 [DOI] [Google Scholar]
- 45. Paszke A, Gross S, Massa F, et al. Pytorch: An imperative style, high-performance deep learning library. Adv Neural Inf Process Syst 2019;32. 10.48550/arXiv.1912.01703 [DOI] [Google Scholar]
- 46. Walker MM, Murray JA, Ronkainen J, et al. Detection of celiac disease and lymphocytic enteropathy by parallel serology and histopathology in a population-based study. Gastroenterology 2010;139:112–9. 10.1053/j.gastro.2010.04.007 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 47. Mahadeva S, Wyatt JI, Howdle PD. Is a raised intraepithelial lymphocyte count with normal duodenal villous architecture clinically relevant? J Clin Pathol 2002;55:424–8. 10.1136/jcp.55.6.424 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 48. Hayat M, Cairns A, Dixon MF, et al. Quantitation of intraepithelial lymphocytes in human duodenum: what is normal? J Clin Pathol 2002;55:393–4. 10.1136/jcp.55.5.393 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 49. Robboy SJ, Weintraub S, Horvath AE, et al. Pathologist workforce in the United States: I. Development of a predictive model to examine factors influencing supply. Arch Pathol Lab Med 2013;137:1723–32. 10.5858/arpa.2013-0200-OA [DOI] [PubMed] [Google Scholar]
- 50. Adesina A, Chumba D, Nelson AM, et al. Improvement of pathology in sub-Saharan Africa. Lancet Oncol 2013;14:e152–7. 10.1016/S1470-2045(12)70598-3 [DOI] [PubMed] [Google Scholar]
- 51. Taavela J, Koskinen O, Huhtala H, et al. Validation of morphometric analyses of small-intestinal biopsy readouts in celiac disease. PLoS One 2013;8:e76163. 10.1371/journal.pone.0076163 [DOI] [PMC free article] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
bmjdhai-1-1-bmjdhai-2025-000023-s001.pdf (760.8KB, pdf)
Data Availability Statement
No data are available. The data sets analysed during this current study have not been made publicly available as we do not have ethical approval or patient agreements to publish the whole-slide images.
