Abstract
Lung size measurements play an important role in transplantation, as optimal donor-recipient size matching is necessary to ensure the best possible outcome. While several strategies for size matching are currently used, all have limitations, and none has proven superior. In this pilot study, we leveraged deep learning and computer vision to develop an automated system for generating standardized lung size measurements using portable chest radiographs to improve accuracy, reduce variability, and streamline donor/recipient matching. We developed a two-step framework involving lung mask extraction from chest radiographs followed by feature points detection to generate six distinct lung height and width measurements, which we validated against measurements reported by two radiologists for 50 lung transplant recipients. Our system demonstrated <2.5% error (< 7 mm) with robust inter- and intra-rater agreement compared to expert radiologist review. This is especially promising given that the radiographs used in this study were purposely chosen to include images with technical challenges such as consolidations, effusions, and patient rotation. While validation in a larger cohort is necessary, this study highlights AI’s potential to both provide reproducible lung size assessment in real patients and enable studies on the effect of lung size matching on transplant outcomes in large datasets.
Keywords: Lung Transplant, Donor Assessment, Artificial Intelligence
Brief Communication
While lung transplantation is the only effective treatment for end-stage lung disease, precise donor/recipient lung size matching is essential for optimal therapeutic outcomes 1–3. Several methods exist to optimize lung size matching—including 2D size measurement on chest radiographs (CXRs)4–6, predicted total lung capacity (pTLC)7,8, and volumetric assessments using CT imaging 3,9. Each has its limitations, however, and there is no consensus best method. For example, pTLC can be misleading if height is reported inaccurately and does not account for weight, race, or disease—all of which affect chest cavity size. Volumetric assessments have not been easily implemented outside of research applications, and hemodynamic instability may preclude their acquisition. Finally, CXR measurements, while having been shown to correlate well with actual TLC5,10, are prone to technique-related errors including rotation, effusion or consolidation that obscures images, and are also inevitably affected by reader subjectivity despite that fact that averaging multiple radiographs does decrease this error 4. Given these challenges, there is a pressing need to develop automated approaches that both provide standardized lung size measurements and are capable of processing large datasets to compare different size matching strategies. A similar need for improved precision medicine approaches in other fields has prompted an increased focus on using artificial intelligence (AI) for computer-assisted lung assessment 11,12: e.g., for diagnosis and treatment planning. We therefore sought to develop a scalable, easy to use automated system capable of accurately reporting standardized metrics used for donor/recipient lung size matching.
Materials and Methods
This study was conducted under an institutional review board approved protocol (#848398). A novel two-step framework for obtaining automated lung size measurements was developed, as shown in Figure 1: 1) automatic lung segmentation on CXRs, 2) computer vision post-processing to identify six distinct size measurements. In Step 1, we extracted lung masks from posteroanterior CXRs using PSPNet 13, a segmentation model capable of exploiting the image’s global context information, which not only looks at the individual pixels around the lung boundary but also considers the overall structure and shape of the entire thoracic cavity, making it possible to accurately identify the lung boundaries even in the presence partial obstructions.
Figure 1:

Schematic illustration of the proposed framework. First, lung mask segmentation is extracted from chest radiographs. Second, computer vision techniques are used to identify the lung apices, costophrenic angles, mid-diaphragm points, and lateral midpoints. The distances between these points, shown in the final image, are calculated and reported in mm.
We trained the model on the publicly available Darwin dataset 14, comprised of 6500 CXRs and lung masks. Lung segmentations were initially generated by Darwin’s Auto-Annotate AI and subsequently reviewed and fine-tuned by human annotators. To enhance the model’s robustness and generalizability across various scenarios, data augmentation techniques such as rotation, scaling, and translation were applied. Additionally, contrast-limited adaptive histogram equalization (CLAHE) was used to improve image contrast, further aiding the segmentation process. In Step 2, computer vision techniques were utilized to automatically identify crucial feature points from the extracted lung masks, enabling acquisition of the following measurements: Right/Left Lung Apex-to-Costophrenic Angle (R-APCA; L-ACPA), Right and Left Apex-to-Diaphragm (R-AMD; L-AMD), as well as lung width at both hilum and diaphragm. These feature points were defined as follows:
Lung Apex: A point with the highest y-coordinate of the lung contour and an x-coordinate equal to the average of the x-coordinates along the top 20% of that contour.
Lung Midpoint: the average x- and y-coordinates of the lung contour, representing the midpoint inside the lung.
Costophrenic Angle Point: the farthest point from the lung midpoint on the lateral part of the lung contour. A point on the lateral part of the lung contour that has the same y-coordinates as the shorter of the costophrenic angles of the two lungs was used to ensure horizontal measurement accuracy.
Mid-Diaphragm Point: a point on the inferior part of the lung contour with the same x-coordinate as the lung midpoint.
Lateral Midpoint: a point positioned on the lateral part of the lung contour sharing y-coordinates with the average of the midpoints of the two lungs (ensuring horizontal measurements).
Lung size measurements were generated using the distances between these defined feature points for reference, without regard to height or weight, to ensure standardization across patients. We validated our automated measurements against those independently reported by two radiologists in a blinded setting for 50 portable CXRs acquired in lung transplant recipients at the University of Pennsylvania (demographic information shown in Table 1). As shown in Figure 2, this dataset included images displaying consolidation, infiltrates and effusion, as well as technical issues such as rotation. Linear regression was then performed to further align the calculated measurements with the average of the radiologists’ measurements. We further calculated the r-value of linear regression to demonstrate agreement between AI-generated and radiologist measurements; the intra-rater correlation coefficient was calculated to assess measurement consistency between radiologists.
Table 1.
Cohort Demographics
| Cohort Demographics (n=50) | |
|---|---|
| Age | 59.4 (10.8) |
| Male | 35 (70%) |
| Race | |
| White | 38 (78%) |
| Black | 3 (6%) |
| Hispanic | 3 (6%) |
| Asian | 4 (8%) |
| Native American | 1 (2%) |
| Other | 5 (10%) |
| Height (inches) | 67.8 (4.1) |
| Weight (lbs) | 176.1 (33.7) |
| BMI | 26.9 (4.3) |
| Image Classification | |
| Normal | 27 (54%) |
| Abnormal | |
| Pleural Effusion | 8 (16%) |
| Atelectasis | 10 (20%) |
| Consolidation | 1 (2%) |
| Opacities | 4 (8%) |
Continuous variables expressed as mean (standard deviation); categorical variables as n (percent).
Figure 2:

Representative chest radiographs with automated measurements. Our dataset includes chest radiographs without lung abnormalities (A, B) as well as with unilateral or bilateral lung opacities (C-F), pleural effusions (C, E), and technical issues such as rotation (C, D). Despite the presence of these conditions, the automated measurements were executed successfully, exhibiting no discernible errors.
Results
Automated standardized lung segmentations and measurements were successfully obtained for all subject images. The average error between automated measurements and the average of two separate radiologist-generated measurements was less than 2.5% (7 mm; Figure 3), and inter-rater agreement between AI and radiologists was almost identical to that observed between radiologists alone, with a Pearson’s correlation coefficient of 0.97. Intra-rater correlations, both between radiologists and between radiologists and AI, also exceeded 0.90, underscoring the consistency and reliability of our automated measurements (Table 2).
Figure 3:

Comparison of reference size (average of two radiologists) vs. AI measurements, showing an average error of less than 2.5% (< 7 mm).
Table 2.
Intraclass correlation coefficient (ICC) with confidence interval as a measure of raters’ reliability. Note that the AI measurements incorporate a linear regression calibration towards the radiologists’ mean values.
| R-ACPA | R-AMD | L-ACPA | L-AMD | Width-at-hilum | Width-at-base | |
|---|---|---|---|---|---|---|
| Radiologist 1 vs Radiologist 2 | 0.98 [0.96, 0.99] | 0.96 [0.93, 0.97] | 0.96 [0.94, 0.98] | 0.98 [0.96, 0.99] | 0.94 [0.89, 0.96] | 0.95 [0.92, 0.97] |
| AI vs Radiologist 1 | 0.98 [0.97, 0.99] | 0.97 [0.94, 0.98] | 0.97 [0.95, 0.98] | 0.98 [0.96, 0.99] | 0.97 [0.95, 0.98] | 0.96 [0.92, 0.97] |
| AI vs Radiologist 2 | 0.97 [0.96, 0.99] | 0.98 [0.97, 0.99] | 0.95 [0.92, 0.99] | 0.97 [0.95, 0.98] | 0.97 [0.94, 0.98] | 0.98 [0.96, 0.99] |
| AI vs Reference size (average of two radiologists) | 0.98 [0.97, 0.99] | 0.99 [0.98, 0.99] | 0.97 [0.95, 0.98] | 0.98 [0.96, 0.99] | 0.99 [0.97, 0.99] | 0.98 [0.96, 0.99] |
Discussion
This pilot study demonstrated that deep learning and computer vision are powerful tools for generating standardized lung measurements in a cohort of recipients with both normal and abnormal images (including effusion, consolidation, and patient rotation). Performing comparably to expert radiologists’ readings from CXRs, this approach not only provides accurate and consistent measurements, but has the potential to dramatically streamline clinical workflows, reduce the burden on radiologists, and improve overall patient care. Our system’s ability to rapidly perform all lung measurements in seconds, without the need for radiologist availability or technical knowledge, has significant potential to enhance clinical efficiency and decrease pre-procurement evaluation time. This is particularly relevant given that the time from electronic donor offer to cross clamp has increased from 29 to 32 hours with initiation of continuous distribution 15—an increase that also highlights the difficulties in assessing 4, managing, and obtaining suitable organs for transplant. Our rapid, standardized assessment system also opens new avenues for research on donor/recipient size mismatch and size matching strategies using large imaging datasets.
Despite the excellent reliability and consistency demonstrated between our automated measurements and those of radiologists, there were several particularly challenging cases—such as in the presence of pleural effusion, which can obscure the costophrenic angle—when both radiologists encountered difficulties in accurately assessing lung size and had to use their best judgment. As a result, these correlations cannot necessarily be taken to indicate correct measurements. Further validation in a larger cohort is necessary to establish the system’s applicability across diverse clinical scenarios and to address potential influences from lung pathologies, as well as technical issues in portable CXR acquisition including rotation, distance from the source, and cutoffs at the apex or sides. It must also be acknowledged that, despite its ubiquity, CXR interpretation presents notable challenges, including interpretational variability, technical limitations, and the potential for human error; indeed, overall error rates are estimated to be between 4-30% dependent on the underlying prevalence of lung abnormalities in the population studied 16. With respect to lung measurements in particular, the reported error rate has varied between 4-8 cm depending on the specific measurement 4. However, because radiologist assessment remains the gold standard for interpretation, it represents the reference point against which our automated system’s performance must be judged.
Given that our automated tool does not currently report any technical challenges it encounters, transplant clinicians should verify that the measurements provided are accurate and appropriate for the image. However, we are currently working to develop an enhanced three-step framework to replace the two-step model presented here, which will not only report lung measurements but also identify abnormalities or technical limitations that may compromise measurement accuracy and thus warrant additional imaging to ensure more precise measurement determination.
Lastly, though not the focus of this manuscript, the use of pTLC as an alternative to direct measurement for donor/recipient size matching must also be addressed. While pTLC is easily calculated, it not uncommonly will over- or underestimate volumes in recipients due to the fact that it does not account for underlying disease, race or age, and has not been validated in different patient groups 3,5,8,17. Proponents have argued that actual TLC measurements should be used to overcome this limitation; however, not all programs routinely collect this information—either as standard practice or because of recipient illness levels 5,6. Even though CXRs measurements have been shown to corelate well with actual TLC5,10,18, they suffer from the limitations discussed above. While CT volumetry can be used to overcome some of these limitations, it is not usually obtained from transplant donors. CT measurements are also affected by mechanical ventilation settings, can be challenging to obtain due to donor instability, and require staff to perform who may not be available at off hours—likely limiting its adoption.
In summary, we have developed an automated system capable of consistently and efficiently delivering precise, standardized lung measurements from the portable chest radiographs universally used for lung transplant donor evaluation. The user-friendly nature and inherent scalability of our automated framework makes it a particularly valuable tool—capable of deployment even by resource-constrained remote hospitals without compromising accuracy. In future collaborative work with our Organ Procurement Organization (OPO), we intend to explore having the on-site transplant coordinator deploy this system at the donor hospital. An additional advantage of AI-automated lung measurement is its ability to facilitate comparison between strategies for donor/recipient size matching—enabling the analysis of large imaging datasets collected as part of donor offers to better understand the strengths and weaknesses of each strategy. Future investigations should also prioritize addressing the limitations identified above to further Improve the robustness and generalizability of our findings.
Acknowledgments
This study was supported by National Institutes of Health grants HL155821 (EC).
Financial Disclosure Statement
Dr. Gefter receives grant support and consultant fees from Siemens Healthineers. Dr. Cantu receives grant support from XVIVO and consultant fees from United Therapeutics and CSL Behring. All other authors have no disclosures to report.
Abbreviations:
- 2D
2 Dimensional
- AI
Artificial Intelligence
- CXR
Chest X-Ray
- L-ACPA
Left Lung Apex-to-Costophrenic Angle
- L-AMD
Left Apex-to-Diaphragm
- pTLC
Predicted Total Lung Capacity
- R-APCA
Right Lung Apex-to-Costophrenic Angle
- R-AMD
Right Apex-to-Diaphragm
- OPO
Organ Procurement Organization
Footnotes
Publisher's Disclaimer: This is a PDF file of an unedited manuscript that has been accepted for publication. As a service to our customers we are providing this early version of the manuscript. The manuscript will undergo copyediting, typesetting, and review of the resulting proof before it is published in its final form. Please note that during the production process errors may be discovered which could affect the content, and all legal disclaimers that apply to the journal pertain.
Declaration of interests
The authors declare the following financial interests/personal relationships which may be considered as potential competing interests:
Edward Cantu reports financial support was provided by National Institutes of Health. Edward Cantu reports a relationship with United Therapeutics Corporation that includes: board membership and consulting or advisory. Edward Cantu reports a relationship with OPTN that includes: board membership. Edward Cantu reports a relationship with International Society for Heart and Lung Transplantation that includes: board membership and travel reimbursement. 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 paper.
Data Sharing and Data Accessibility
Due to the sensitive nature of the DICOMs used and the potential for loss of confidentiality, raw data will remain confidential and will not be shared. Code used for analysis has been made publicly available at https://pypi.org/project/AILungMeasure/.
References
- 1.Eberlein M, Arnaoutakis GJ, Yarmus L, et al. The effect of lung size mismatch on complications and resource utilization after bilateral lung transplantation. J Heart Lung Transplant. May 2012;31(5):492–500. doi: 10.1016/j.healun.2011.12.009 [DOI] [PubMed] [Google Scholar]
- 2.Eberlein M, Reed RM, Bolukbas S, et al. Lung size mismatch and primary graft dysfunction after bilateral lung transplantation. J Heart Lung Transplant. Feb 2015;34(2):233–40. doi: 10.1016/j.healun.2014.09.030 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Shepherd HM, Farahnak K, Harrison MS, et al. Utilizing computed tomography volumetry for size matching prior to lung transplantation: a case series. J Thorac Dis. Apr 28 2023;15(4):2233–2239. doi: 10.21037/jtd-22-1203 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Vazquez Guillamet R, Vazquez Guillamet MC, Rjob A, et al. Uncertainty analysis of chest X-ray lung height measurements and size matching for lung transplantation. Journal of thoracic disease. Apr 2022;14(4):1042–1051. doi: 10.21037/jtd-21-1755 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Li DV, Weinkauf J, Hirji A, et al. Chest X-ray Sizing for Lung Transplants Reflects Pulmonary Diagnosis and Body Composition and Is Associated With Primary Graft Dysfunction Risk. Transplantation. Feb 2021;105(2):382–389. doi: 10.1097/Tp.0000000000003238 [DOI] [PubMed] [Google Scholar]
- 6.Roach DJ, Szugye NA, Moore RA, et al. Improved donor lung size matching by estimation of lung volumes based on chest X-ray measurements. Pediatr Transplant. Dec 2023;27(8):e14594. doi: 10.1111/petr.14594 [DOI] [PubMed] [Google Scholar]
- 7.Ouwens JP, van der Mark TW, van der Bij W, Geertsma A, de Boer WJ, Koeter GH. Size matching in lung transplantation using predicted total lung capacity. Eur Respir J. Dec 2002;20(6):1419–22. doi: 10.1183/09031936.02.00294402 [DOI] [PubMed] [Google Scholar]
- 8.Riddell P, Ma J, Dunne B, et al. A simplified strategy for donor-recipient size-matching in lung transplant for interstitial lung disease. J Heart Lung Transplant. Nov 2021;40(11):1422–1430. doi: 10.1016/j.healun.2021.06.013 [DOI] [PubMed] [Google Scholar]
- 9.Chen F, Kubo T, Shoji T, Fujinaga T, Bando T, Date H. Comparison of pulmonary function test and computed tomography volumetry in living lung donors. J Heart Lung Transplant. May 2011;30(5):572–5. doi: 10.1016/j.healun.2010.11.019 [DOI] [PubMed] [Google Scholar]
- 10.Pierce RJ, Brown DJ, Holmes M, Cumming G, Denison DM. Estimation of lung volumes from chest radiographs using shape information. Thorax. Dec 1979;34(6):726–34. doi: 10.1136/thx.34.6.726 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Topalovic M, Das N, Burgel PR, et al. Artificial intelligence outperforms pulmonologists in the interpretation of pulmonary function tests. Eur Respir J. Apr 2019;53(4)doi: 10.1183/13993003.01660-2018 [DOI] [PubMed] [Google Scholar]
- 12.Chassagnon G, De Margerie-Mellon C, Vakalopoulou M, et al. Artificial intelligence in lung cancer: current applications and perspectives. Jpn J Radiol. Mar 2023;41(3):235–244. doi: 10.1007/s11604-022-01359-x [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Zhao H, Shi J, Qi X, Wang X, Jia J. Pyramid scene parsing network. 2017:2881–2890. [Google Scholar]
- 14.Data from: COVID-19 X-ray dataset.
- 15.Weiss S, Weibel C. Lung Continuous Distribution Six Month Monitoring Report. https://optn.transplant.hrsa.gov/media/4feooi1h/data_report_lung_cd_6month_20231027.pdf
- 16.Gefter WB, Post BA, Hatabu H. Commonly Missed Findings on Chest Radiographs: Causes and Consequences. Chest. Mar 2023;163(3):650–661. doi: 10.1016/j.chest.2022.10.039 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Mason DP, Batizy LH, Wu J, et al. Matching donor to recipient in lung transplantation: How much does size matter? J Thorac Cardiovasc Surg. May 2009;137(5):1234–40 e1. doi: 10.1016/j.jtcvs.2008.10.024 [DOI] [PubMed] [Google Scholar]
- 18.Schlesinger AE, White DK, Mallory GB, Hildeboldt CF, Huddleston CB. Estimation of total lung capacity from chest radiography and chest CT in children: comparison with body plethysmography. AJR Am J Roentgenol. Jul 1995;165(1):151–4. doi: 10.2214/ajr.165.1.7785574 [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
Due to the sensitive nature of the DICOMs used and the potential for loss of confidentiality, raw data will remain confidential and will not be shared. Code used for analysis has been made publicly available at https://pypi.org/project/AILungMeasure/.
