Lung Segmentation of Chest Radiograph Using Circular Window Based Local Contrast Thresholding (CWLCT) and Adaptive Median Outlier (CWAMO)

. Certain chest illnesses, such as TB, adenocarcinoma, squamous cell carcinoma, large cell carcinoma, atelectasis, etc., can be diagnosed in chest radiographs, and the development of a CAD system relies in part on accurate lung segmentation. In order to partition the lungs in chest radiographs, this work introduces an unsupervised learning approach based on a circular window and local thresholding. The procedure involves pre-processing, a preliminary estimate of the lung field, and the elimination of noise. Images are initially scaled down to 1024x1024 and enhanced using adaptive histogram equalization. Then chest radiographs are binarized using the proposed method. Based on the geometrical and special characteristics, lungs are separated from the chest radiographs. The final step in picture segmentation is the use of morphological processes. Local thresholding, omitting extraneous body parts, filling in gaps, and filtering regions based on their attributes all contribute to preliminary estimates of the lung field. Morphological processes are used as a means of eliminating background noise. A public bone shadow eliminated JSRT dataset consisting of 247 chest x-rays is used to measure the performance of the proposed method. The effectiveness of the proposed method results’ performance is evaluated by comparing it with Active Shape Model (ASM) based lung segmentation for various performance metrics such as F-score, overlap percentage, accuracy rate, sensitivity, specificity, and precision rates. All the parameters for the proposed method are over and above 90%. Our investigations indicate that the suggested method is an unsupervised learning approach that does not require any training.


Introduction
Radiography, magnetic resonance imaging (MRI), and computed tomography (CT) are only few of the imaging modalities frequently used in medical diagnostics with the goal of finding lung cancer.Despite the fact that MRI and CT are more sensitive and accurate techniques, chest radiography continues to receive the highest level of recommendation for curve [11] to segment the lung field in both posteroanterior (PA) and lateral computed tomography (CXR) images.After the intensity profile is processed, an optimization is done on a flexible polynomial template that was made without any training data [12].Due to the shadow of the heart and changes in the shape of the lungs, the right and left lungs are processed separately.Processing intensity profiles involves finding the highest and lowest points in horizontal profile segments or their derivatives.In binarization, the threshold is an important factor.So, choosing the right threshold value in binarization is an important part of making a good binary image.There are two ways to do this: global thresholding and local thresholding.[13] talks about a local thresholding strategy that uses the local contrast and mean.Normal front-to-back chest x-rays require the reader to make mental distinctions between the lung fields, heart, and clavicles.Active structure models, active appearance models, and a multi-resolution pixel categorization approach based on a multi-scale filter bank of Gaussian derivatives and a k-nearest-neighbors classifier are all compared as guided methods for segmentation [14].The approaches were judged using a database of 247 chest x-rays that was available to the public and in which all the objects were separated by hand by two human observers.Using the local mean [15] and standard deviation, a method is made that gets rid of background noise called locally adaptive thresholding.A detailed look at the pros and cons of the different segmentation techniques [16] was given.Different techniques for region-based segmentation and segmentation based on edge detection [17] were looked at and compared.In the section on region-based techniques, we talked about thresholding, region growing, and the watershed algorithm.Edge detection and segmentation techniques talked about the canny edge detector and the active contour algorithms.A fully automatic method [18] for recognizing lungs in CT scans is presented.There are three primary components to the strategy.To begin, CT scans had their lung regions removed using graylevel thresholding.The front and back connections are then used to dissect the lungs apart into their left and right halves [19].The lung edge is then sharpened along the middle of the chest.Suggested lung segmentation begins with lung edge identification using canny edge detection filters, Euler number methodology, and morphology method.In this experiment, it was hard to find a good low and high threshold value for detecting sharp edges.Because of this, the Euler number was used to make the detection process easier.Their unsupervised segmentation algorithm still can't find the lung region correctly.In an iterative framework, a technique is proposed [20] for segmenting lung fields by merging prior shape information with intensity-based thresholding.This method for doing experiments worked well.But the method has two problems: I it needs human experts to figure out the shape of the lung model, and (ii) it can't find the lung tissues that overlap with the heart because the intensity changes in this area.For the automatic segmentation of the lung field in chest x-rays, a fuzzy clustering method based on a Gaussian kernel [21] and spatial constraints is suggested.An Active Shape Model (ASM) is a computer vision technique used to identify and track objects in images [22] - [25].It is based on a statistical model of the shape of the object, which is used to search for the object in an image.The model is made from a set of training images that are used to make a statistical model of the shape of the object.Then, the model is used to find the object in an image by comparing the shape of the object in the image to the shape of the object in the model.[26] Someone came up with a way to make small models of the shape and look of flexible things (like organs) that can be seen in two-dimensional photographs.The models are made by looking at the numbers of images that have been labeled with examples of the things that were labeled.Each model is made up of a flexible form template and a statistical model that says how grey the area around each model point should look.A new way to separate the lungs from digital Posterior-Anterior (PA) chest xray images is shown in [27].This method uses a level set.When using active contours to divide the lungs, the biggest problem is local minima caused by shading effects and the fact that the rib cage and clavicle make the edges very sharp.The method used the fact that there was good contrast at the edges of the lungs to get a set of edge/corner feature points with different sizes.Our active contour model was then based on these features.By using the lung ROI to get the translation and scaling parameters, a method [28] was made to predict an appropriate initial lung border for ASM deformation.Using k-means clustering and silhouette-based cluster validation, an adaptive ASM was made to change as the shape of the lung changed.This was done to get around the fact that everyone's lung shape is different.Experiments showed that adaptive ASM segmentation works better than traditional ASM segmentation techniques.A unique method [29] is shown to make the original ASM more resistant to weak lung field edges, which can cause the contour to leak into the lung fields.The ASM is protected from leakage by a grey-level selective thresholding system that subtracts unnecessary anatomic features from the radiograph.The suggested method works with affine lung field projections and doesn't get messed up by things that are used to monitor and support the patient that are dense [30].Contrary to the original formulation, an active shape model segmentation approach is described that is guided by optimal local features rather than normalized first-order derivative profiles.Instead of using the linear Mahalanobis distance, a nonlinear kNN-classifier is used to figure out how far apart landmarks should be.At each resolution level considered during the segmentation optimization technique, a distinct set of optimal features is determined for each of the shape-describing landmarks.Automatic feature selection is done with the help of training images and forward and backward feature selection in a certain order.A new way to do things that involves two main steps [31].First, the shape of the lungs is roughly divided into different parts using a new method called robust active shape model (RASM) matching.A rib cage detection method is used to find where the RASM is at first.Second, a method for finding the best surface is used to make the first result of segmentation fit the lung even better.Both the left and right lungs have their separate parts.

Assumptions
The following are presumptions that must be made before the suggested approach for lung segmentation from chest radiographs may be used: 1) Digital x-ray images are taken from the JSRT bone shadow eliminated dataset developed at Budapest University (BSE_BU).There are a total of 154 chest x-rays with lung nodules and 93 without lesions in the sample.
2) For comparing the proposed method results, the Active Shape Model (ASM) lung masks and manually segmented lungs mask using image-J software are used.

Algorithm
As shown in Figure 1, the proposed system consists of five different stages namely-1) Preprocessing 2) Image thresholding using CWLCT 3) Morphological Operations 4) Lung area separation 5) Post processing.

Preprocessing of the chest radiograph
Prior lung segmentation the images are preprocessed for better results.The images are down sampled to 1024x1024 and enhanced for their contrast using adaptive histogram equalization.

Image thresholding using CWLCT
The preprocessed images are then binarized [32] using circular window based local contrast thresholding.For the binarization CWLCT filter with radius 50 and threshold 2 is employed.The CWLCT filter is similar to Bernsen local contrast thresholding filter.Instead of using square window, it uses circular filter detecting the curved boundary regions of the lungs.Calculating the median of the pixel intensities in the image region that was covered by the circular window required centering the circular window at the pixel with the coordinates f(x,y).If the pixel intensity at f(x,y) is higher than that of the median value by the threshold value t, then the standard deviation will be used as the threshold value, and the median value will be used to substitute the pixel intensity at f(x,y); else, the pixel intensity will be left at its original value.
Where I(x,y) is the intensity of the gray level when it was first recorded at pixel f(x,y), and I1(x,y) is the intensity of the gray level after it has been updated at pixel f(x,y).Figure 2a shows original image while Figure 2b shows thresholded image using CWLCT.

Morphological operations
In the morphological operation a combination of dilation followed by erosion is used to fill in small holes or gaps in an image, or to smooth the edges of larger objects.Figure 3c shows the image after morphological operation.

Post Processing
In the post processing the Bottom Hat filter and adaptive median outlier filter [32] is used.The Bottom Hat filter is a morphological operation that is used in image processing to enhance dark and low-contrast features in an image.It is a type of filtering that extracts the information contained in the darker regions of the image.The Bottom Hat filter is obtained by subtracting the original image from its morphological closing operation.The closing operation is performed by dilating the image and then eroding it with a structuring element.This operation removes small details and smooths the image.The result is then subtracted from the original image, which emphasizes the darker regions and small details that were removed in the closing operation.
Where, f is the original image and the closing operator.
The bottom-hat filter has the property of enhancing "valleys" by applying the closing operator.The resulted image in Figure 5b is obtained by subtracting the image in Figure 4c from the original image in Figure 5a. Figure 5c is obtained after thresholding the image shown in Figure 5b.

Results and discussion
The performance analysis of the proposed method is done by comparing it with the lung segmentation using Active Shape Model (ASM).Active Shape Model (ASM) [22]is used for segmenting the lungs from the pre-processed original chest radiograph.When it comes to segmenting images, ASM is one of the most reliable algorithms available.Parameterized contour analysis is the focus of the Active Shape Model.The parameters are calculated using principal component analysis (PCA) and the statistics of many sets of points extracted from various contours of similar pictures.In ASM, an object's border is established by a set of n points.The resulting descriptor vector may be written as Where xi and yi are x and y coordinates on i-th point on the contour.The s training vectors calculated for principal component analysis have a mean shape of The covariance matrix will be The first t largest Eigen values λi of the covariance matrix are chosen.Because only the most significant Eigen values are considered, the number of parameters is drastically reduced and falls below n.The matrix is filled with the corresponding eigenvectors.The model parameters are calculated as from this the approximation of the shape is calculated as An appropriate b vector is identified for a given contour such that all components of b are within the interval ±m√λi, with an appropriate constant m.The parametric description of an object's contour is searched starting with the mean shape.Two alternating steps are applied until convergence or a predetermined number of iterations are reached.In the first phase of the method, each contour point perpendicular to the contour is moved.The optimal position is found after multiple cycles of position testing on both sides of the contour.During the training model, picture resolution is employed to locate the optimal position of an intensity gradient profile at each contour node.Finally, Mahalanobis distance is used to identify the optimal new position for the contour point.Then, to fit a model to the new point set, all of the contour points are updated.According to Eq.8, the best b parameter is sought As the image's spatial resolution increases, the procedure is repeated many times.For training the model 100 images from the JSRT dataset are used [1].
Figure 7a shows original chest radiograph.The segmented lung mask obtained using ASM is shown in Figure 7b.To prove the results obtained in the Figure -8, 50 images from the JSRT dataset were used.The lungs are segmented using ASM (Supervised method) and proposed method (Unsupervised method).The lung masks are generated manually using ImageJ tool.These manually generated lung masks are verified using clinical experts and further used for evaluating the performance of the proposed method in comparison with the existing ASM algorithm.
The performance of the proposed method is evaluated using following measures False positive (FP) means the pixel belonging to background is identified as lung pixel.False negative (FN) means pixel belonging lung classified as background and finally true negative (TN) means background pixel is correctly classified as background.The following formulae may be used to calculate values for overlap, accuracy, sensitivity, specificity, precision, and the F-score, all of which will be put to use in evaluating the quality of the results.Table I shows the comparison of segmentation using proposed method and ASM for different quality measures.From the table it can observed that using proposed method for lung segmentation the accuracy, specificity, and precision are above 95% and sensitivity, overlap and F-score lies above 90%.If we compare the results of the proposed method with the ASM lung segmentation technique, the proposed method gives over and above results.From the Figure 9 it can be observed that minimum percentage of image pixels correctly classified using ASM is greater than the proposed method.On the other hand, the mean and maximum percentage of image pixels accurately classified as lung area pixels using proposed method are greater than the ASM. Figure 10, Figure11, Figure 12, Figure 13 and Figure 14 show that the other image quality measures for the proposed method perform equal and above as that of the ASM lung segmentation method.

Conclusions and Future Work
Improved lung segmentation quality measures were the motivation for the proposed study of lung segmentation of chest radiographs utilizing the suggested approach (CWLCT & CWAMO).Using circular window based local contrast thresholding the lungs are segmented.Morphological operations such as to-hat window was employed for recovering the missing area.Finally, noise is reduced by applying the circular window based adaptive median outlier method.From the experimentation it can be concluded that by using proposed method for lung segmentation the accuracy, specificity, and precision are above 95% and sensitivity, overlap and F-score lies above 90%.For computing above parameters, manually segmented lungs that are verified by two medical experts are used.Since method is unsupervised, it does not require large image dataset and extensive effort for training the model.The results are compared with that supervised lung segmentation method (ASM) and it is found that for most of the parameters proposed method performs over and above the ASM.

Fig. 3 . 2 . 2 . 4 .
Fig. 3. Morphological operation a) Original image b) Thresholded image c) Image after morphological operation 2.2.4.Lung area separation from chest radiograph By using geometrical and spatial properties of the segmented parts of the chest radiograph, left and the right lungs are separated.First all the segmented parts of the chest radiograph are labeled as shown in Figure 4b and then the centroid and the areas are calculated.The first two of the segmented parts having largest area and smallest Euclidean distance as shown in Figure 4c from the center of the image are separated.Since the left and right lungs are the parts having larger areas as compared to the other labeled parts and closer to the center of the image, they are separated easily.

Fig. 4 . 6 ITM
Fig. 4. Lungs Separation a) Thresholded image b) Labeled image c) Image after lung separation a b c

Fig. 5 .Fig. 6 .
Fig. 5. Post Processing using Bottom hat filter a) Original image b) Bottom hat filtered image c) Binarized Image

Fig. 7 .
Fig. 7. Lung segmentation using ASM a) Original image b) Segmented lungs using ASM

Figure- 8 9 ITMFig. 8 .
Fig. 8. Lung segmentation of sample images by using proposed method and ASM a) Original Images b) Lung segmentation using proposed method c) Lung segmentation using ASM)

b c 10 ITM
TP is True Positive, TN is True Negative, FP is False Positive and FN is False Negative.A "goodness" index is necessary for measuring the efficacy of the suggested strategy.True positive (TP) means the pixel belonging to foreground or lung is classified as lung pixel.a Web of Conferences 57, 02007 (2023) ICAECT 2023 https://doi.org/10.1051/itmconf/20235702007

Table 1 .
Segmentation measure parameters comparison