# Lung Field Segmentation in Chest X-rays:
## 3 Results  
The validation of the segmentation algorithm aims to compare the detected region with the available ground truth mask in the dataset. To achieve this, three different similarity metrics are employed. Two of them measure the overlapping area and one the distance between the two contours. These measures are widely used in relevant studies [12]. Specifically:  
\[\text{Jaccard similarity coefficient:}\ \frac{|\boldsymbol{TP}|}{| \boldsymbol{TP}|\ +\ |\boldsymbol{FP}|\ +\ |\boldsymbol{FN}|} \tag{5}\]  
Figure 4: The region growing procedure. (**a**) The initial lung contour. (**b**) Identified bright border curve. (**c**) The result after stretching the initial contour to the curve. (6)  
where \(|\mathbf{TP}|\) is the number of pixels that were correctly classified as lung area, \(|\mathbf{FP}|\) the number of pixels that were incorrectly classified as lung area, and \(|\mathbf{FN}|\) the number of pixels that were incorrectly classified as background. \[\text{Average Contour Distance:}\frac{\mathbf{1}}{2}\Bigg{(}\frac{\sum_{i}\mathbf{d}( \mathbf{a}_{i},\;\mathbf{R})}{|\mathbf{a}_{i}|}\;+\;\frac{\sum_{j}\mathbf{d}(\mathbf{b}_{j},\;\mathbf{ S})}{\Big{|}\Big{|}\Big{|}}\Bigg{)} \tag{7}\]  
where \(R\) denotes the pixels on the boundary of the calculated lung area, and \(S\) the pixels on the boundary of the ground truth lung area. Therefore, we average the minimum distances between pixels of one boundary to the other and the reverse, and then we average the two results. After executing the algorithm on the full dataset, we obtained an average Jaccard similarity coefficient of 0.862, Dice similarity coefficient of 0.923 and Average Contour Distance of 7.4 pixels. From this point, one can perform an analysis at the image level. The algorithm demonstrates a Jaccard score above 0.84 and close to that of the state-of-the-art methods for about 77.5% of the images in the dataset. On the other hand, the segmentation of about 5.8% of the images is very questionable, where the Jaccard score was between 0.59 and 0.77. Table 3 compares the results of our method, its strengths and its weaknesses to other recent studies, which apply neural networks for the segmentation of lung fields. Table 4 summarizes an analysis of misdetections, where only cases of CXRs with Jaccard score below 0.8 are considered. It is understandable that the intensity homogeneity of the pixels inside the lung area affects the algorithm's segmentation capability. Nevertheless, as the table shows, some of these cases are of crucial medical interest. In a further analysis, we prove that the probability distribution of intensity values inside the lung area can assist in identifying such pathological patterns. For example, Figure 5 demonstrates that an abnormality in the left lung (pleural effusion in this case) is confidently recognized, using the cumulative probability of intensities inside the lung area, sampled around the most probable rib cage points, shown in the left-most image. Cases where the field of one or both lungs extends to bright regions can be assigned a lower segmentation confidence value by the algorithm. Figure 5: Recognition of pleural effusion in the left lung. **(a)** Automatically selected most probable lung points used as samples for the characterization of the lung area. The points around the symmetry line at the center and around the preselected shoulder area have been excluded as they most probably belong to irrelevant structures (these points are illustrated thinner with red color). **(b)** Cumulative probability distribution of intensities inside the lung area calculated around the sample points. **(c)** The intensity along the \(y\)-axis of the image for the right lung (upper) and for the left lung (lower), top to bottom, averaged along the corresponding samples on the \(x\)-axis. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
\begin{tabular}{c} ResNet-trained models.