Open-access ultrasonic diaphragm dataset and an automatic diaphragm measurement using deep learning network
Authors: Zhifei Li, Lin Mao, Fan Jia, Shaohui Zhang, Cuiping Han, Shuiqiao Fu, Yueying Zheng, Yonghua Chu, Zuobing Chen, Daming Wang, Huilong Duan, Yinfei Zheng
Abstract
Background
The assessment of diaphragm function is crucial for effective clinical management and the prevention of complications associated with diaphragmatic dysfunction. However, current measurement methodologies rely on manual techniques that are susceptible to human How does the performance of an automatic diaphragm measurement system based on a segmentation neural network focusing on diaphragm thickness and excursion compare with existing methodologies?
Methods
The proposed system integrates segmentation and parameter measurement, leveraging a newly established ultrasound diaphragm dataset. This dataset comprises B-mode ultrasound images and videos for diaphragm thickness assessment, as well as M-mode images and videos for movement measurement. We introduce a novel deep learning-based segmentation network, the Multi-ratio Dilated U-Net (MDRU-Net), to enable accurate diaphragm measurements. The system additionally incorporates a comprehensive implementation plan for automated measurement.
Results
Automatic measurement results are compared against manual assessments conducted by clinicians, revealing an average error of 8.12% in diaphragm thickening fraction measurements and a mere 4.3% average relative error in diaphragm excursion measurements. The results indicate overall minor discrepancies and enhanced potential for clinical detection of diaphragmatic conditions. Additionally, we design a user-friendly automatic measurement system for assessing diaphragm parameters and an accompanying method for measuring ultrasound-derived diaphragm parameters.
Conclusions
In this paper, we constructed a diaphragm ultrasound dataset of thickness and excursion. Based on the U-Net architecture, we developed an automatic diaphragm segmentation algorithm and designed an automatic parameter measurement scheme. A comparative error analysis was conducted against manual measurements. Overall, the proposed diaphragm ultrasound segmentation algorithm demonstrated high segmentation performance and efficiency. The automatic measurement scheme based on this algorithm exhibited high accuracy, eliminating subjective influence and enhancing the automation of diaphragm ultrasound parameter assessment, thereby providing new possibilities for diaphragm evaluation.
Supplementary Information
The online version contains supplementary material available at 10.1186/s12931-025-03325-3.
Background
The diaphragm is a crucial respiratory muscle in the human body. It is intricately connected to multiple systems, including respiration, circulation, and the nervous system. Diaphragmatic dysfunction refers to muscle atrophy caused by thinning of the diaphragm, resulting in partial or complete loss of diaphragm contraction ability [1, 2]. Diaphragmatic dysfunction can be precipitated by a wide array of clinical diseases. Ultrasound assessment of diaphragm parameters, such as thickness, thickening fraction, and excursion, enables healthcare professionals to identify potential respiratory dysfunction at an earlier stage, notably during the initial asymptomatic period [3, 4]. Conventional techniques for diaphragm measurement such as abdominal CT and X-rays are invasive. Ultrasound measurement has emerged as the preferred method for diaphragm evaluation due to its advantages of non-invasive, simple operation, fast imaging, good real-time performance, and low cost [5, 6]. Although imaging modalities such as CT and MRI also require post-processing and manual annotation, ultrasound-based diaphragm measurement presents unique challenges. On one hand, it relies on manual labeling during the evaluation process; on the other hand, it is highly dependent on the operator’s expertise during image acquisition to ensure accurate visualization of the diaphragm. EXpert consensus On Diaphragm UltraSonography in the critically ill (EXODUS) [6] highlights that there are currently no standardized measurement locations for key ultrasound parameters such as diaphragm thickness, thickening fraction, and excursion. Significant inter-operator variability in measurement techniques severely compromises the consistency and reproducibility of results. Moreover, the learning curve for diaphragm thickness measurement is relatively steep, requiring substantial training time, and image acquisition itself constitutes a specialized technical skill. Therefore, compared to CT or MRI, ultrasound-based diaphragm assessment is more subjective and error-prone in both the acquisition and evaluation stages.
Previous studies proposed diverse algorithms aimed at improving diaphragm measurement accuracy. In 2012, Hwang et al. [7] utilized polynomial set techniques alongside adaptive threshold methods to delineate diaphragm contours and extract respiratory motion signals. Subsequently, in 2016 Liu et al. [8] introduced a tidal volume estimation scheme based on B-mode ultrasound images that employs the Viola-Jones (VJ) detection algorithm to identify the region of interest (ROI) of the diaphragm. The active contour model was then applied for segmenting the diaphragm based on ROI data; measurements of the diaphragmatic excursion were evaluated using three statistical principal direction, centroid location, and minimum area rectangular center. In 2017, Jain and Kumar et al. [9] used the difference in echo of the diaphragm compared to adjacent tissues and the position of the diaphragm in ultrasound images to set appropriate thresholds for diaphragm segmentation. In 2018, Bharath et al. [10] proposed an algorithm that combines the VJ algorithm, Generalized Search Tree descriptor(GIST), Support Vector Machine (SVM) classifier, and active contour segmentation. The algorithm first utilizes the VJ algorithm to detect all potential ROIs containing the diaphragm, followed by an SVM classifier based on the GIST descriptor to further refine the identification of diaphragm-containing regions. Finally, an active contour model is employed for diaphragm segmentation. In 2020, Loizou et al. [11] proposed and evaluated an integrated semi-automatic analysis system for quantitative analysis of diaphragm excursion in ultrasound videos.
In summary, current automatic diaphragm ultrasound measurement schemes primarily adopt a combined approach of diaphragm ultrasound image segmentation and speckle tracking. The segmentation algorithms used in these schemes can generally be divided into two traditional image segmentation methods and AI-based image segmentation algorithms. Existing AI-driven frameworks for automatic measurement of diaphragmatic parameters rarely analyze or compare the segmentation performance of various AI algorithms. Traditional segmentation approaches mainly include classical image processing techniques such as thresholding, Canny edge detection, and active contour models. Thresholding methods classify pixels into different categories by setting a specific threshold. However, due to the heterogeneity of diaphragm regions among different patients and under varying imaging conditions, a single threshold may be insufficient to accurately capture the complex shape of the diaphragm, especially in the presence of noise or grayscale variability. Canny edge detection can be used to identify diaphragm boundaries, but it also struggles to distinguish the diaphragm edge from adjacent anatomical structures. Active contour models are capable of detecting and outlining the diaphragm region; however, they are highly sensitive to initial contour placement and often fail to converge to the correct boundaries in complex or noisy backgrounds. Overall, although these traditional methods can achieve diaphragm region segmentation to some extent, their accuracy is compromised by noise and artifacts, and some algorithms rely on manual initialization, making fully automatic segmentation unattainable.
Deep learning technology has advanced rapidly and has been applied to multiple fields, particularly in the domain of medical image segmentation [12–20]and video segmentation [21]– [22]. This study delineates the automatic measurement of diaphragm parameters into two distinct automatic segmentation and parameter measurement. Utilizing multi-ratio dilated convolution and spatiotemporal ultrasound videos, we obtain masks of diaphragm regions in each frame of the image. Subsequently, we devise automatic measurement protocols for diaphragm thickening fraction and excursion. Corresponding graphical interfaces are developed to acquire comprehensive diaphragm parameter information and enhance the automation level of diaphragm parameter measurement.
In this study, we develop a diaphragm dataset and a neural network for measurement. The dataset comprises B-mode and M-mode ultrasound images and videos for diaphragm thickness and excursion. Our segmentation networks utilize U-Net architecture, with MRDU-NetV1 enhancing feature extraction through multi-ratio dilated convolution. MRDU-NetV3 further improves upon this with a Channel Attention Block and Context Semantic Gating Fusion Module. For video segmentation, we use MRDU-NetV1 and MRDU-NetV3 as backbone networks, designing a Temporal Attention Block between the encoder and decoder to achieve the Spatiotemporal Feature Fusion Network (STFFNet), a diaphragm ultrasound video segmentation Network based on Spatiotemporal Feature Fusion, details are shown in file Supplement and e-Fig. 2. An automatic measurement scheme assesses diaphragm parameters, with results compared to manual measurements for error analysis and a user-friendly interface for automated parameter measurement.
Materials and methods
Datasets
Patient details for the study are shown in Fig. 1. The demographic and clinical characteristics of the study population are summarized in e-Table 1 and e-Table 2 (see file Supplement). Data collection was conducted from May 2022 to May 2023 using the Mindray Resona i9 high-performance color Doppler ultrasound system in the Department of Rehabilitation at the collaborating hospital. A total of 321 diaphragm thickness ultrasound images, 488 diaphragm excursion ultrasound images, 30 diaphragm thickness ultrasound videos, and 50 diaphragm excursion ultrasound videos are collected. All videos are recorded at a frame rate of 30 frames per second (FPS). Notably, the images and videos are acquired independently, and the images are not extracted from video frames. Although the original dataset appears relatively large, a portion of the images and videos present issues such as poor image quality and unclear diaphragm boundaries. To ensure the reliability of segmentation, low-quality samples are excluded. As a result, the final dataset consists of 258 diaphragm thickness images, 407 diaphragm excursion images, 22 thickness videos, and 42 excursion videos.
To facilitate model training and evaluation, the ultrasound videos are divided into training, validation, and test sets based on video length. Videos with 150–200 frames are assigned to the training set, while those with 50–80 frames are used for validation and testing. In total, the diaphragm thickness videos are split into training, validation, and test sets in a 8:5 ratio, and the diaphragm excursion videos are divided in a 13:16 ratio. Additionally, all images and videos undergo cropping to exclude irrelevant regions and protect patient privacy, retaining only the ultrasound regions containing the diaphragm. To support subsequent training and testing, all data receive dense annotation by a single experienced clinician following standardized protocols. Diaphragm images are annotated using the Labelme tool, while videos are labeled using the Pair tool.
Fig. 1Flowchart of the patient screening and recruitment process
Network and training
Three versions of MDRU-Net are proposed and their structure can be seen in file Supplement and e-Fig. 1.
This study employs the PyTorch deep learning framework to develop diaphragm ultrasound image and video segmentation models. Given the limited dataset size for image segmentation, five-fold cross-validation is adopted to reduce the risk of overfitting and enhance the robustness and reliability of performance evaluation. For video segmentation, the STFFNet model is initialized with the best-performing MRDU-NetV3 and MRDU-NetV1 models (from the image segmentation validation sets) and is trained separately on their corresponding video datasets.
To standardize input dimensions, all images and video frames are resampled to a 512 × 512 resolution. To improve data diversity and mitigate overfitting, various data augmentation techniques are applied, including random horizontal and vertical flipping (each with a 0.5 probability), random rotation (0°–360°), cropping, and translation. These augmentations enrich the training set and improve generalization.
For model optimization, the AdamW optimizer is used with an initial learning rate of 0.001. The hyperparameters are set as β1 is set to 0.9, β2 to 0.999, ε to 1e − 8, and the weight decay coefficient λ to 0.01. A cosine annealing learning rate scheduler (CosineAnnealingLR) is employed to promote smoother convergence in later training stages, with the annealing period \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$
:{T}_{\text{m}\text{a}\text{x}}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$
\:{\eta\:}_{\text{m}\text{i}\text{n}}
$$\end{document} of 0.00001. The models are trained for 100 epochs with a batch size of 8. During each epoch, the full training set is iterated once to update the model parameters, and validation is conducted at the end of each epoch to monitor training progress and prevent overfitting.
More training details are shown in file Supplement.
### 2.3 Tracing and measurement
This study proposes a specific implementation plan for the automatic measurement of diaphragm thickness, thickening fraction, and excursion. The comprehensive scheme is illustrated in Fig. 2 and elucidated in the subsequent sections.
Fig. 2Automatic measurement scheme for diaphragm parameters. (**a**) Pixels measurements from the segmentation mask sequence. (**b**) Diaphragm thickness variation curve. (**c**) Comparison of three burr methods including mean filtering, Gaussian filtering, and median filtering. (**d**) Location of peaks and troughs
#### Burr elimination
Filters are widely employed techniques for deburring, and we have chosen the mean filter, Gaussian filter, and median filter to effectively eliminate burrs intending to identify the most suitable filter.
#### Searching for peaks and troughs
Peaks and troughs represent the local maxima and minima of a signal, respectively. However, signals may occasionally exhibit minor fluctuations that result in local extremes. Based on the respiratory pattern and variations in diaphragm thickness, we propose the following filtering
The peaks of the waveform must exceed the average diaphragm thickness while the troughs must fall below it. The diaphragm thickness at the end of inhalation is maximal and should exceed its average; therefore, instances with peak values lower than this average are excluded from consideration. Similarly, since diaphragm thickness is minimum at the end of expiration, those trough values that show a greater than average thickness of the diaphragm are filtered out.Adjacent peaks/troughs should be at least 90 frames apart. The human respiratory cycle is about 3–5 s, and the average frame rate of diaphragm ultrasound video is 30 frames. Therefore, adjacent peaks and troughs should maintain this minimum separation.
#### Calculate diaphragm parameters
Finally, we calculate the diaphragm thickening fraction and diaphragm excursion based on the following
1\documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$
{\text{DTF = }}\frac{{{\text{DTei}} - {\text{DTee}}}}{{{\text{DTee}}}} \times {\text{100}}\%
$$\end{document}
2\documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$
{\text{DE = DDAei}} - {\text{DDAee}}
$$\end{document}
DTei represents the diaphragm thickness at the end of inspiration, DTee represents the Diaphragm thickness at the end of expiration, DDAei represents the diaphragm displacement amplitude at the end of inspiration, and DDAee represents the diaphragm displacement Amplitude at the end of expiration.
## Results
### Comparison of segmentation results of diaphragm ultrasound images
As shown in Fig. 3 (a)(b), four randomly selected diaphragm thickness ultrasound images from the test set of the diaphragm thickness ultrasound image dataset are segmented using U-Net, EGEU-Net, CMU-Net, MRDU-NetV1, MRDU-NetV2, and MRDU-NetV3 for mask comparison. The solid blue area donates the real mask area, while the area delineated by the red line represents the predicted mask area.
Fig. 3Comparison of segmentation results using different neural networks on diaphragm ultrasound images. (**a**) The comparison of segmentation results on the same diaphragm thickness ultrasound image. (**b**) The comparison of segmentation results on the same diaphragm excursion ultrasound image. The blue area in the figure represents the manually annotated reference mask, and the area enclosed by the red line represents the output prediction mask of model
To facilitate a more precise comparison of segmentation performance, we employ five-fold cross-validation on both the diaphragm thickness and excursion ultrasound image datasets to identify the optimal model as a backbone for diaphragm ultrasound video segmentation. The results in Table 1 demonstrate that MRDU-NetV3 outperforms all other networks on the diaphragm thickness ultrasound image dataset, especially with an Intersection over Union (IoU) of 76.57% and a Dice Similarity Coefficient (DSC) of 85.92%. On the diaphragm excursion ultrasound image dataset, MRDU-NetV1 achieves 70.75% IoU and 82.03% DSC, which are the best values among all models, and its standard deviation is the smallest, indicating that its segmentation performance is the most stable.
Table 1Comparison of segmentation performance of different models using Five-Fold Cross-Validation on diaphragm ultrasound image datasetU-NetCMU-NetEGEU-NetMRDU-NetV3MRDU-NetV2MRDU-NetV1Diaphragm Ultrasound Thickness Image DatasetIoU/%73.38 ± 2.1676.18 ± 1.8470.55 ± 1.39
**76.57 ± 2.03**
76.43 ± 1.9676.11 ± 2.01DSC/%83.47 ± 1.5785.35 ± 1.6281.61 ± 1.47
**85.92 ± 1.67**
85.69 ± 1.6985.45 ± 1.57SE/%85.33 ± 1.7787.00 ± 1.4985.14 ± 1.19
**87.26 ± 0.71**
87.16 ± 2.1386.99 ± 1.23PC/%83.88 ± 1.0385.56 ± 2.0880.69 ± 2.11
**86.56 ± 2.78**
86.14 ± 2.2085.94 ± 2.96SP/%99.31 ± 0.1099.35 ± 0.1499.09 ± 0.14
**99.42 ± 0.16**
99.41 ± 0.1399.38 ± 0.23ACC/%98.61 ± 0.1598.76 ± 0.2198.39 ± 0.17
**98.81 ± 0.17**
98.79 ± 0.1598.75 ± 0.21Diaphragm Ultrasound Excursion Image DatasetIoU/%69.26 ± 0.8870.36 ± 1.0368.34 ± 1.8369.94 ± 1.0370.34 ± 0.81
**70.75 ± 0.60**
DSC/%80.74 ± 1.0181.65 ± 1.1780.24 ± 1.6481.40 ± 0.9981.67 ± 0.79
**82.03 ± 0.51**
SE/%81.18 ± 1.49
**83.25 ± 2.14**
82.59 ± 2.5582.44 ± 2.2382.81 ± 1.2783.03 ± 1.39PC/%83.25 ± 1.8882.97 ± 1.4381.09 ± 1.3283.69 ± 1.3783.84 ± 0.92
**84.10 ± 1.45**
SP/%
**99.86 ± 0.03**
99.85 ± 0.0299.83 ± 0.0299.85 ± 0.0299.85 ± 0.0299.85 ± 0.01ACC/%99.67 ± 0.0399.67 ± 0.0399.64 ± 0.0499.67 ± 0.0299.67 ± 0.02
**99.68 ± 0.01**
MRDU-NetV3: Multi-Ratio Dilation U-Net Version 3; MRDU-NetV2: Multi-Ratio Dilation U-Net Version 2; MRDU-NetV1: Multi-Ratio Dilation U-Net Version 1IoU: Intersection over Union; DSC: Dice Similarity Coefficient; SE: Sensitivity; PC: Precision; SP: Specificity; ACC: AccuracyThe best-performing value for each evaluation metric is highlighted in bold
Therefore, in the subsequent video segmentation, we select MRDU-NetV3 and MRDU-NetV1 as the backbone networks for the diaphragm thickness ultrasound video dataset and diaphragm excursion ultrasound video dataset, respectively.
### Comparison of segmentation results of diaphragm ultrasound videos
A comparative analysis of the segmentation results obtained from MRDU-Net and STFFNet on the diaphragm thickness and excursion ultrasound video dataset is conducted, as illustrated in Fig. 4 (a)(b).
Fig. 4Comparison of segmentation results between STFFNet and MRDU-Net on diaphragm ultrasound videos. (**a**) Comparison of segmentation results between STFFNet and MRDU-NetV3 on the first 15 frames of a diaphragm thickness ultrasound video. (**b**) Comparison of segmentation results between STFFNet and MRDU-NetV1 on the first 10 frames of a diaphragm excursion ultrasound video. The blue area in the figure represents the manually annotated reference mask, and the area enclosed by the red line represents the output prediction mask of model
We quantitatively assess their segmentation performance, with specific results detailed in Table 2. It is evident that STFFNet achieves an IoU value of 66.79%, a DSC of 78.64%, and a segmentation speed of 22.72 FPS on the diaphragm thickness ultrasound video dataset. All evaluation metrics surpass those of MRDU-NetV3. Additionally, as presented in Table 2, STFFNet attained an IoU value of 78.58%, a DSC value of 87.79%, and a segmentation speed of 23.72 FPS on the diaphragm excursion ultrasound video dataset—again outperforming MRDU-NetV1 across various evaluation indicators. The results show that STFFNet produces a significantly superior segmentation mask compared to MRDU-NetV3 in diaphragm thickness ultrasound videos, with MRDU-NetV3 erroneously classifying numerous non-diaphragm regions as diaphragm tissue. However, no significant differences are observed in the prediction masks between the two models when applied to the diaphragm excursion ultrasound video dataset.
Table 2Comparison of segmentation performance of different models using Five-Fold Cross-Validation on diaphragm ultrasound video datasetMRDU-NetV3MRDU-NetV1STFFNetDiaphragm Ultrasound Thickness Video DatasetIoU/%55.40 ± 11.32-66.79 ± 7.36DSC/%71.95 ± 6.75-78.64 ± 5.62FPS5.29 ± 1.41-22.72 ± 1.59Diaphragm Ultrasound Excursion Video DatasetIoU/%-77.45 ± 4.4178.58 ± 1.37DSC/%-87.10 ± 2.9387.79 ± 0.89FPS-6.73 ± 1.6323.72 ± 2.52MRDU-NetV3: Multi-Ratio Dilation U-Net Version 3; MRDU-NetV1: Multi-Ratio Dilation U-Net Version 1; STFFNet: Spatiotemporal Feature Fusion Network;IoU: Intersection over Union; DSC: Dice Similarity Coefficient; FPS: Frames Per Second
These results demonstrate that the incorporation of the temporal attention module not only enhances segmentation performance through the effective integration of temporal and spatial features but also significantly improves processing speed for segmentations. The frame rates of both diaphragm thickness and excursion ultrasound videos have attained approximately 23 FPS, thereby preliminarily meeting real-time performance requirements. Consequently, STFFNet is selected as the preferred segmentation network for analyzing diaphragm ultrasound videos for subsequent measurements involving diaphragm parameters.
### Measurement results of diaphragm parameters
#### Obtain the variation curve of diaphragm thickness
In diaphragm thickness ultrasound images, the vertical M-lines intersect the upper and lower boundaries of the diaphragm. The distance between these intersection points represents the diaphragm thickness. By fixing the position of the M-line and measuring the distance from its intersection point to the diaphragm boundary in each frame, a curve of diaphragm thickness variation can be derived. Similarly, in ultrasound images depicting diaphragm excursion, the same vertical M-line intersects both diaphragm boundaries. By tracking the Y-coordinate of the point where this line intersects the upper boundary, a displacement curve of diaphragm movement can be constructed.
#### Burr elimination
We use mean, Gaussian, and median filters to smooth curves representing variations in diaphragm thickness. The results indicate that while mean filters are effective at removing sharper burrs, they struggle with broader variations and require larger windows that may inadvertently diminish critical signal features. Conversely, Gaussian filters preserve significant characteristics but risk losing sharp details in certain areas. The median filter performs well in removing burrs without over-smoothing important signal features. Therefore, this study adopts median filtering as the preferred method for burr elimination.
#### Peaks and troughs detection
Figure 2 (d) shows peaks and troughs corresponding to variations in diaphragm thickness and excursion. The peaks denote the transition at the end of the inspiratory phase, while the troughs indicate the end of the expiratory phase. Utilizing Eqs. (1) and (2), values for the diaphragm thickening fraction and excursion index are calculated.
The average number of pixels reflecting diaphragm thickness during inspiratory and expiratory phases are determined to be 16.5 pixels and 9.5 pixels, respectively. A diaphragm thickening score of 73.68% is calculated. Manual measurements conducted by physicians utilizing M-mode imaging reveal maximum diaphragm thickness of 0.27 cm and 0.25 cm, alongside minimum values of 0.15 cm and 0.13 cm (the standard of accuracy for these measurements is limited to centimeters, with a precision of ± 0.01). The calculated average maximum diaphragm thickness is determined to be approximately 2.6 mm, while the minimum average is approximately 1.4 mm, resulting in an overall thickening score of approximately 85.71%. A comparative analysis of the automated and manual measurement methods yields an absolute error in the thickening fraction of approximately 12.03%.
Furthermore, the average pixel displacement during inspiration is approximately 286.67 pixels, whereas the average pixel displacement during expiration is 277.33 pixels, the image resolution is 20 cm/170 pixels. Multiplication of the pixel values by the resolution yields the actual height of diaphragm displacement at the conclusion of the inspiratory and expiratory phases, with measurements of 33.73 cm and 32.63 cm, respectively. The calculated displacement of the diaphragm is 1.1 cm. Manual measurements produce diaphragm displacements of 1.16 cm, 1.21 cm, and 1.16 cm, respectively, with a computed mean displacement of 1.18 cm. The absolute error between the automatic and manual measurements is 0.08 mm, and the relative error is 6.78%.
#### Error analysis between automatic & manual measurement
To comprehensively assess discrepancies between automatic and manual measurement techniques, ultrasound videos capturing diaphragm thickness in 10 subjects and offset videos in 7 subjects are analyzed in this study. Results are presented in Tables 3 and 4. Diaphragm thickening fraction and excursion are computed utilizing an automated measurement protocol, while physician-conducted manual assessments serve as a baseline for comparison. Findings indicate that the mean error associated with diaphragm thickening scores is approximately 8.12% with a standard deviation of 6.45%, and the mean error related to diaphragm excursion is approximately 4.3%.
Table 3Comparison of diaphragm thickening fraction between automatic and manual measurementsNumberDiaphragm Thickening Fraction/%Absolute error/%Manual/%Automatic/%127.7250.0022.28260.6959.261.43379.4570.189.27456.3866.6710.29542.7441.671.07642.7427.7814.96722.6325.532.9842.0650.007.94946.5348.391.861023.8133.029.21mean--8.12std--6.45
Table 4Comparison of diaphragm excursion between automatic and manual measurementsNumberDiaphragm Excursion/cmAbsolute Error/cmRelative Error/%Manual/cmAutomatic/cm10.420.410.012.3821.571.530.042.5531.211.110.18.2641.371.290.085.8451.471.410.064.0861.471.530.064.0871.371.410.042.92mean--0.064.30std--0.132.11
Given that the validation cohort used to assess measurement accuracy is relatively small, Bland–Altman analysis is performed to evaluate the agreement between automated and manual measurements of diaphragm thickness and excursion, as shown in Fig. 5 For the diaphragm thickening fraction, the mean difference (bias) between automatic and manual measurements is approximately 2.78%, with 95% limits of agreement ranging from − 17.86 to 23.41%. For diaphragm excursion, the mean difference is approximately − 0.027 cm, with 95% limits of agreement from − 0.145 cm to 0.091 cm.
Fig. 5Bland–Altman analysis comparing manual and automatic measurements. (**a**) Bland–Altman plot for diaphragm thickening fraction measurements (%). The x-axis represents the mean of manual and automatic measurements, while the y-axis shows the difference between the two methods (automatic − manual). The solid red line indicates the mean difference (bias), while the green and orange dashed lines represent the upper and lower limits of agreement (mean ± 1.96 SD), respectively. (**b**) Bland–Altman plot for diaphragm excursion measurements (cm). The plot follows the same structure as (**a**)
The correlation between the discrepancy in automatic and manual measurements is closely associated with segmentation outcomes derived from diaphragm ultrasound enhanced segmentation performance results in more precise delineations, consequently reducing errors in automated assessments. In addition, factors such as ultrasound image resolution and the application of smoothing curves via filters may introduce additional sources of inaccuracy.
Furthermore, we develop a simplified system for automated measurement of diaphragm parameters utilizing Python’s Tkinter library, as well as an automated protocol specifically designed for assessing ultrasound parameters related to diaphragms. This system facilitates the acquisition of distribution curves of diaphragm thicknesses, thickened regions, and excursion positions. Additionally, we provide an interactive graphical user interface.
## Discussion
In this study, the automatic diaphragm measurement system is divided into two distinct segmentation and parameter measurement.
### Performance of diaphragm ultrasound image segmentation
We propose an algorithm for diaphragm ultrasound image segmentation utilizing multi-ratio dilated convolution. This approach effectively expands the receptive field without increasing the model’s parameter count. During the initial stages of feature extraction, smaller dilated convolution blocks are employed to capture detailed local information. As feature extraction progresses and resolution decreases, larger dilated convolution blocks are utilized to enhance the receptive field and capture more comprehensive global data. Furthermore, a Channel Attention Block is introduced between the encoder and decoder to selectively emphasize relevant features while suppressing irrelevant ones, thereby improving segmentation accuracy. To bridge the semantic gap between high-level and low-level features, we incorporate an enhanced Context Semantic Gating Fusion Module within the skip connection layer.
The findings presented in U-Net demonstrate that the Multi-ratio Dilated Convolution Block significantly enhances segmentation performance for diaphragm thickness and excursion ultrasound images. While both the Channel Attention and upper-lower semantic gating fusion modules improve performance specifically for diaphragm thickness images, they do not confer similar benefits for diaphragm excursion images.
### Performance of diaphragm ultrasound video segmentation
In the evaluation of diaphragm parameters, the analysis involves a video comprising numerous image frames. Adjacent frames exhibit a degree of similarity and temporal correlation. Traditional image segmentation methodologies predominantly emphasize spatial features, resulting in substantial underutilization of temporal information inherent in sequential frames. To address it, we develop a diaphragm ultrasound video segmentation network that leverages spatiotemporal feature fusion. As illustrated in Table 2, the incorporation of a temporal attention module within STFFNet facilitates the integration of both temporal and spatial features, thereby enhancing diaphragm segmentation accuracy. This approach demonstrates particular efficacy for diaphragm thickness ultrasound videos, substantially reducing instances where surrounding non-diaphragm regions are erroneously classified as diaphragm areas. Moreover, this network enhances segmentation speed, achieving an average frame rate of 23 FPS, which meets real-time performance criteria.
### Errors in automatic and manual measurements
According to Tables 3 and 4, discrepancies persist between automatic measurements and manual evaluations. In the Bland–Altman analysis, all data points for diaphragm thickening fraction (*n* = 10) fall within the limits of agreement, indicating a certain level of consistency between the automated and manual measurements. However, the relatively wide limits of agreement and the presence of notable deviations in some samples suggest a degree of instability in the automated measurements for this parameter. Further optimization of the model’s accuracy and an expansion of the validation sample size are necessary to improve the reliability of the results. For diaphragm excursion (*n* = 7), the differences between automated and manual measurements are more narrowly distributed, with smaller biases observed. This indicates a good level of agreement and consistency between the two measurement methods, demonstrating the feasibility of the automated approach for this parameter.
These inconsistencies mainly stem from factors such as image segmentation results, image resolution variations, and curve smoothing processing.
Image segmentation The segmentation model we developed has generally demonstrated commendable performance. However, its efficacy at the edges of the diaphragm region requires enhancement, particularly at the upper and lower boundaries. Inaccurate classification of edge pixels can lead to significant errors in both the thickness and excursion amplitude of the diaphragm during inhalation and exhalation phases, subsequently resulting in inaccuracies in calculating diaphragm thickening fractions and excursions. In ultrasound images depicting diaphragm thickness, the diaphragm is situated within an anechoic fiber layer between the pleura and peritoneum, surrounded by adjacent muscle tissues exhibiting similar echogenicity, which complicates accurate segmentation. Conversely, in ultrasound images representing diaphragm excursion, the diaphragm manifests as a distinctly hyperechoic area with marked differences from surrounding tissues, facilitating more straightforward segmentation. This discrepancy elucidates why errors associated with measuring diaphragm thickening are greater than those related to assessing diaphragm excursion.
Image resolution As illustrated in Figs. 2 and 3, the diaphragm thickness occupies a relatively small number of pixels relative to image resolution. Higher image resolutions lead to an increased pixel count for measuring diaphragm thickness, thereby enabling more precise calculations of thickening fractions and simultaneously reducing error margins.
Curve smoothing During the process of burr elimination in the diaphragm thickness variation curve, a median filter is employed to mitigate artifacts. While this filter effectively preserves the sharp features of the signal, there is a potential risk of over-smoothing, which could interfere with the accurate identification of peaks and troughs.
### Repeatability of diaphragm parameter measurement
We adopt an “image segmentation” and “position tracking” scheme for diaphragm parameter measurement and design an automatic measurement method based on image segmentation. For a given diaphragm ultrasound video, the diaphragm segmentation mask remains constant. Consequently, measurements of diaphragm thickness, thickening fraction, and excursion taken at the same position on the mask yield consistent results across different assessments. This automated approach reduces subjective influences, thereby enhancing both the repeatability and reliability of the outcomes. By maintaining a uniform segmentation mask, our measurements achieve stability and accuracy while minimizing variability associated with manual assessment and the influence of position on diaphragm parameters.
### The influence of position on diaphragm parameters
There is no consensus regarding the optimal M-line position for measuring diaphragm parameters in clinical practice. To address this issue, we compare diaphragm thickness, diaphragm excursion, and diaphragm thickening fraction at various M-line positions, leading to the following
Diaphragm Thickness Distribution: The distribution of diaphragm thickness is characterized by thinner middle and thicker sides. This consistent distribution facilitates more accurate measurements through careful selection of appropriate M-line positions.
Diaphragm Thickening Fraction: The proportion of thickening in the diaphragm varies according to its location along the M-line. However, no distinct distribution pattern is identified. This suggests that factors beyond mere positional variation along the M-line influence thickening fractions.
Diaphragm Excursion Distribution: The excursion curve of the diaphragm demonstrates an initial increase followed by a decrease from left to right, typically featuring a turning point around the mid-position. Despite this general trend, there is notable variability concerning the exact location of this turning point which does not conform to any consistent distribution pattern.
These findings suggest that although there are some identifiable patterns in diaphragm thickness and excursion distributions, variability exists, particularly in the diaphragm thickening fraction and the exact turning point of diaphragm excursion. Further research and standardization may be required to refine measurement techniques and improve consistency in clinical practice.
### Limitations and future work
Although the proposed method has demonstrated encouraging performance, there are still several limitations that point toward directions for further research and improvement.
One challenge lies in the segmentation performance of diaphragm thickness ultrasound videos. The diaphragm region in these videos is relatively small and often surrounded by complex anatomical structures, making accurate identification of its upper and lower boundaries difficult. Future work may focus on designing more fine-grained segmentation modules to improve boundary localization and enhance the accuracy of automatic thickness measurements.
In addition, some diaphragm ultrasound videos contain considerable noise, which may reduce the contrast and clarity of the diaphragm region, thereby affecting segmentation quality. Incorporating preprocessing steps—such as denoising and image enhancement—prior to segmentation could improve the visibility of anatomical structures and lead to more precise segmentation results.
Another limitation of this study is that all data in this study are collected from a single institution using the same ultrasound system, which ensures consistency in imaging quality and acquisition protocols. However, this also introduces a potential limitation in terms of the generalizability of the proposed method to broader clinical scenarios. To address this, we will focus on exploring the generalizability of the proposed method across diverse patient populations and imaging environments in future research, including potential validation using data from different institutions and ultrasound systems, in order to further assess its robustness and clinical applicability.
Furthermore, the ground truth labels used for model training and evaluation are provided by a single experienced clinician. While this helped maintain annotation consistency, the lack of inter-rater or intra-rater variability assessment represents another limitation. In future studies, we will consider involving multiple annotators and assessing annotation consistency to improve the reliability of the reference standards and further strengthen the validity of our findings.
## Conclusions
Diaphragm thickness, thickening fraction, and excursion are important parameters for evaluating the contractile function and health of the diaphragm. However, in clinical practice, the measurement of ultrasound-derived diaphragm parameters still relies heavily on experienced ultrasound clinicians after long-term learning and training. This process is highly dependent on subjective judgment and is both time-consuming and labor-intensive. Moreover, there is currently no consensus on the optimal anatomical location for measuring diaphragm thickness, thickening fraction, and excursion in clinical settings.
To improve the automation level of diaphragm parameter measurement and reduce the burden on clinicians, while also exploring the variability of diaphragm measurements across different positions and directions, this study reformulates the problem of diaphragm parameter measurement as a diaphragm segmentation task. By accurately segmenting the diaphragm region in ultrasound videos, a complete measurement scheme for diaphragm parameters is proposed. Furthermore, an automated system for diaphragm parameter measurement is designed and developed.
Overall, the proposed algorithm demonstrates commendable performance in terms of speed, accuracy, and real-time applicability. The automatic measurement scheme based on this algorithm exhibits high accuracy while effectively mitigating subjective biases, ensuring reliable segmentation results. Furthermore, the user-friendly interface for automated measurement of ultrasound diaphragm parameters significantly improves operational efficiency. This advancement offers new possibilities for comprehensive diaphragm assessment and holds significant clinical potential.
## Electronic supplementary material
Below is the link to the electronic supplementary material.
Supplementary Material 1