Enhancing lung segmentation in chest X-rays via SAM with anatomical priors and boundary-aware loss

Accurate lung segmentation in chest X-rays is a foundational step for computer-aided diagnosis of respiratory diseases such as pneumonia, tuberculosis, and lung cancer. While the Segment Anything Model (SAM) has demonstrated remarkable zero-shot segmentation capabilities on natural images, its direct application to medical imaging remains limited due to domain shift, low contrast, and ambiguous anatomical boundaries. To address these challenges, we propose a lightweight yet effective adaptation of SAM that integrates (i) a Mask Autoencoder (MAE) as an anatomical prior to enforce global shape consistency, and (ii) a composite loss function combining Binary Cross-Entropy (BCE), Dice, and Boundary losses to jointly optimize pixel-level accuracy, region overlap, and edge fidelity. Our parameter-efficient fine-tuning strategy trains only 0.3% of SAM's parameters, specifically the mask decoder, while freezing the image and prompt encoders. Evaluated on the MedSeg Chest X-ray Lung Dataset, our method achieves a Dice score of 87.3%, outperforming both full fine-tuning (MedSAM: 81.2%) and recent parameter-efficient variants (S-SAM: 84.6%, SAM-PARSER: 85.1%). Moreover, our model demonstrates exceptional robustness across the test set, with median Dice and Specificity exceeding 0.90, and runs at 78 ms per image, the fastest among compared methods. Qualitative results confirm precise delineation of lung fields even under challenging conditions such as rib overlap and cardiac silhouette interference. By combining anatomical constraints with boundary-aware supervision, our framework improves prompt-conditioned lung segmentation performance and provides a lightweight segmentation component that can be integrated into larger clinical decision-support pipelines.

Authors

Institutions

Publication Details

Journal
Scientific Reports
Published
2026-06-29
DOI
https://doi.org/10.1038/s41598-026-57878-4
Primary Topic
COVID-19 diagnosis using AI
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Enhancing lung segmentation in chest X-rays via SAM with anatomical priors and boundary-aware loss

K. Thiruthanigesan, Kithusshand Raveendran, Princiha JacobSelvakumar, Kajaraj Arunthavarajah et al.
Scientific Reports
COVID-19 diagnosis using AI
article

Enhancing lung segmentation in chest X-rays via SAM with anatomical priors and boundary-aware loss

K. Thiruthanigesan, Kithusshand Raveendran, Princiha JacobSelvakumar, Kajaraj Arunthavarajah, Logathas Tharshikan, Ravikkumar Rajeethan, Lingajan Senthinathan
article en

Abstract

Accurate lung segmentation in chest X-rays is a foundational step for computer-aided diagnosis of respiratory diseases such as pneumonia, tuberculosis, and lung cancer. While the Segment Anything Model (SAM) has demonstrated remarkable zero-shot segmentation capabilities on natural images, its direct application to medical imaging remains limited due to domain shift, low contrast, and ambiguous anatomical boundaries. To address these challenges, we propose a lightweight yet effective adaptation of SAM that integrates (i) a Mask Autoencoder (MAE) as an anatomical prior to enforce global shape consistency, and (ii) a composite loss function combining Binary Cross-Entropy (BCE), Dice, and Boundary losses to jointly optimize pixel-level accuracy, region overlap, and edge fidelity. Our parameter-efficient fine-tuning strategy trains only 0.3% of SAM's parameters, specifically the mask decoder, while freezing the image and prompt encoders. Evaluated on the MedSeg Chest X-ray Lung Dataset, our method achieves a Dice score of 87.3%, outperforming both full fine-tuning (MedSAM: 81.2%) and recent parameter-efficient variants (S-SAM: 84.6%, SAM-PARSER: 85.1%). Moreover, our model demonstrates exceptional robustness across the test set, with median Dice and Specificity exceeding 0.90, and runs at 78 ms per image, the fastest among compared methods. Qualitative results confirm precise delineation of lung fields even under challenging conditions such as rib overlap and cardiac silhouette interference. By combining anatomical constraints with boundary-aware supervision, our framework improves prompt-conditioned lung segmentation performance and provides a lightweight segmentation component that can be integrated into larger clinical decision-support pipelines.

Scientific Reports
Sri Lanka Institute of Information Technology (LK), University of Jaffna (LK)
Peace, Justice and strong institutions
Openalex Percentile: Top 7%
COVID-19 diagnosis using AI
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.