Skip to main content

Lung segmentation on standard and mobile chest radiographs using oriented Gaussian derivatives filter



Unsupervised lung segmentation method is one of the mandatory processes in order to develop a Content Based Medical Image Retrieval System (CBMIRS) of CXR. The purpose of the study is to present a robust solution for lung segmentation of standard and mobile chest radiographs using fully automated unsupervised method.


The novel method is based on oriented Gaussian derivatives filter with seven orientations, combined with Fuzzy C-Means (FCM) clustering and thresholding to refine the lung region. In addition, a new algorithm to automatically generate a threshold value for each Gaussian response is also proposed. The algorithms are applied to both PA and AP chest radiographs from both public JSRT dataset and our private datasets from collaborative hospital. Two pre-processing blocks are introduced to standardize the images from different machines. Comparisons with the previous works found in the literature on JSRT dataset shows that our method gives a reasonably good result. We also compare our algorithm with other unsupervised methods to provide fairly comparative measures on the performances for all datasets.


Performance measures (accuracy, F-score, precision, sensitivity and specificity) for the segmentation of lung in public JSRT dataset are above 0.90 except for the overlap measure is 0.87. The standard deviations for all measures are very low, from 0.01 to 0.06. The overlap measure for the private image database is 0.81 (images from standard machine) and 0.69 (images from two mobile machines). The algorithm is fully automated and fast, with the average execution time of 12.5 s for 512 by 512 pixels resolution.


Our proposed method is fully automated, unsupervised, with no training or learning stage is necessary to segment the lungs taken using both a standard machine and two different mobile machines. The proposed pre-processing blocks are significantly useful to standardize the radiographs from mobile machines. The algorithm gives good performance measures, robust, and fast for the application of the CBMIRS.


Chest radiography is the most frequently used diagnostic imaging examination for chest diseases such as lung cancer, pulmonary edema (fluid in the lung), pleural effusion (fluid between lung and chest cavity), pneumonia (infection by bacteria, viruses, fungi, or parasites) and tuberculosis (bacterial infection). More than 10 million people worldwide die annually from chest diseases. Based on the survey done by [1], the mortality rates for chest diseases in 1990 are 6.3 million (ischaemic heart disease), 4.3 million (lower respiratory infections), 2.2 million (chronic obstructive pulmonary disease), 2 million (tuberculosis) and 0.9 million (lung cancer). For most diseases, many cures are only effective in the early stage and symptomless stage of disease. Screening can help early diagnosis, but a sensitive, side effect-free as well as economical method has to be used to enable mass usage. Standard chest radiography meets these requirements, except that current methods have moderate sensitivity. It is still more favourable despite the development of advances radiological exams like Computed Tomography (CT). The main reason is because the CT exams expose the patient to a higher dose of radiation. By comparing the conventional CXR and CT chest, it is estimated that the latter is about 400 times higher than the former, which equivalent to 3.6 years of background exposure [2]. Another reason for the widespread use of conventional chest radiograph over CT is its economic feasibility. The study on literature and challenges for current direction of computer aided detection (CADe) system for lung cancer in CT scans are reviewed by Firmino et al. in [3]. There are some recent works found on analysing the chest in CT images, including the pulmonary fissure detection and lobe segmentation [4-8]. However, the topic of interest for this research is only on chest radiography, thus the previous literature on related work will be discussed thoroughly in the next section.

Previous work

Medical image segmentation plays a crucial role in many imaging applications by automating or facilitating the delineation of anatomical structures and other regions of interest. Segmentation of lung fields in CXR has received considerable attention in the literature since the past decade. An exhaustive survey on the lung segmentation techniques for chest radiographs has been done for this work, and is summarized in Table 1. Most of the listed work used JSRT dataset as their image database. JSRT dataset is the database of chest radiographs (with and without lung nodules) that publicly made available by the Japanese Society of Radiological Technology (JSRT), with their ground truth clinical data [9]. This dataset only consists of posterior-anterior (PA) chest radiographs, taken by stationary X-Ray machine. To the best of our knowledge there are only two work [10,11] that used chest radiographs from portable device. This shows the lack of study in mobile chest radiographs that is also relatively important especially for very sick patients whenever their radiographs will be taken using portable X-Ray machine.

Table 1 Summary of related work on lung segmentation techniques for chest radiographs

In [12], the early segmentation methods for CXR have been classified into roughly four categories: rule-based methods, pixel classification-based methods, deformable model-based methods and hybrid methods. A rule-based scheme consists of a sequence of steps, tests and rules. The methods used are thresholding (local), region growing, edge detection, ridge detection, morphological operations, fitting of geometrical models, functions or dynamic programming. The usage of rule-based scheme is demonstrated in [13], based on Bezier interpolation of salient control points is used in [10] and based on fuzzy subsets of the image space in [14]. Pixel classification-based scheme on the other hand is more general and mainly model the intensities of the image and classify the pixels into lung field or background. [15,16] employed the scheme based on fuzzy clustering method (FCM) and [17] tested the post-processed pixel classification method as one of their comparative results.

The FCM algorithm is the best known, although it has many drawbacks in applying into finding appropriate groups in data analysing problems. Many researchers have tried to modify the basic objective function to have more robust FCM [18-23]. However, the ideal segmentation of an image is usually application-dependent; and FCM has been used with some success in the soft or fuzzy segmentation in medical imaging of chest CT [7,23-28], chest MRI [18] and brain MRI [16,19-22,25,29]. In CT and MRI images, the edges of the lung or brain can be easily distinguished due to the distinct bone and cell tissue, thus motivated the authors to apply the FCM in their work. For CXR, Shi, et al. [15] has implemented FCM with spatial constrains to segment the lung, and Rastgarpour, et al. [16] has also integrated a local region-based level set method with a variation of fuzzy clustering in their work in order to segment a few modalities and body parts including lung. A few works on other applications using FCM in CXR has also been found in the literature. Parveen et al. in [30] implemented the algorithm for detection of pneumonia, [31] used for segmentation of heart information (size, contour and shape) and lastly the application is for clustering feature vectors data for atypicality detection by [32]. Lack of work on lung segmentation for CXR using FCM is mainly due to the inhomogeneities of the X-Ray imaging [16]. Furthermore, the strong edges at the rib cage and clavicle region as well as intensity variation around the lung area make it challenging to use FCM as segmentation tool.

A relatively new scheme which have been extensively studies and used in medical image segmentation is the deformable model-based methods. This shape-flexibility model, namely Active Shape Model (ASM) and Active Appearance Model (AAM), have been successfully applied to lung region segmentation [17,33-35]. However, they both have several limitations and shortcomings including requires supervision to adjust certain parameters which produces highly variable solutions, requires shape learning to train the model, as well as manual initialization. The invention of hybrid scheme is to produce better segmentation results by fusing the previous said schemes. It is very interesting to note that most of the hybrid methods found in the literature is combining rule and shape based schemes to their algorithms [11,36,37]. Still, the methods fused with ASM suffer the drawbacks and the shape scheme on the other hand needs to undergo the optimization process, learning, training and usually are computationally complex.

Computer aided evaluation of CXR needs complex image processing algorithms where the images should be pre-processed prior to the detection of abnormalities. The first step for the development of an automatic system for digital chest radiographs is the segmentation of the CXR to extract the area of the lungs before suppressing the thoracic cage (the bones). By doing this, there is a chance to eliminate shadows of these parts, cleaning the area of the lung field from the anatomical noise and making it possible to look behind the bones. Thus, this paper will focus on the lung field segmentation.

Proposed segmentation algorithm

The proposed image segmentation method is a rule-based approach that consists of several algorithms applied sequentially. Images collected from mobile and stationary X-Ray machines produce different kind of radiographs. Thus, a robust algorithm has been proposed to overcome this issue that consists of two stages: the pre-processing stage and the segmentation stage. A schematic of the image processing flow is shown in Figure 1.

Figure 1
figure 1

Image processing flow for the proposed lung segmentation method. The diagram is divided into two main sections: the pre-process (with contrast adjustment and cropping block) and segmentation (with Gaussian Derivatives, global thresholding and Fuzzy C-Means algorithms).


The radiographs produced by both stationary and portable machines have diverse purposes, settings and configurations. Their varieties in position views and properties are among the main challenges to develop a robust algorithm to extract the lung. Figure 2 shows few examples of various CXR images obtained from three different machines and their respective histograms. It is obviously shown that histograms of different CXR images have different intensity distribution from each other. Figure 2(a) is an example of normal PA radiograph from a stationary machine, which is the output of common CXR machines. In this work, this type of CXR image is set as the standard image where no pre-processing step is needed.

Figure 2
figure 2

Example of different projection and positioning in chest radiographies with their respective histograms. (a) PA erect from standard machine; (b) AP sitting; and (c) AP Supine from portable machines.

In addition, Figure 2(b) and Figure 2(c) are examples of CXR images taken from two different mobile machines, where the positions are usually in sitting or lying, as well as standing if a patient is able to do so. Images from the first mobile machine (i.e. Figure 2(b)) are identified ‘with unnecessary background’, thus the chest area has to be cropped out from the images. The second mobile machine generates another type of images, such as Figure 2(c) in which is considered as ‘inverted image with unnecessary background’. Therefore, its image histogram has to be inverted before cropping the chest area. The contrast of the inverted image is then corrected by stretching the histogram and eliminated 2% of the outliers. Figure 3 illustrates examples of original radiographs and their corresponding inverted images from two different datasets.

Figure 3
figure 3

The outputs of the contrast adjustment block. The two images are from different portable machines (a) to (c) and (d) to (f). (a) and (d) are the original images, (b) and (e) are after inverting the image and (c) and (f) are the results after correcting the contrast.

The radiographs produced by the portable machines have extra backgrounds such as in Figure 3 due to the nature of the mobile x-ray detector. Thus, cropping block is important to remove the unwanted backgrounds or regions. The radiographs are firstly converted to binary images in which their threshold value are obtained using Otsu’s thresholding method and followed by morphological dilation to preserve as much coverage as possible. Then, any wordings or unwanted regions outside the chest area are removed before cropping out the remaining background. Figure 4 shows some output images obtained from these step-by-step procedures.

Figure 4
figure 4

The outputs of the cropping block. (a)(f): original image, thresholded image, after dilation, outside wordings removal, mapped to original image, final output (cropped).

Figure 1 clearly illustrates these pre-processing steps during the first stage of the proposed lung segmentation method.


The proposed lung segmentation consists of a scheme that based on Gaussian derivatives (GD) filter, global thresholding and fuzzy C-means (FCM) clustering method, as clearly presented after the pre-processing stage in Figure 1. This fully automated method has adapted the oriented Gaussian filter to obtain responses in several directions so that a rough lung outline can be identified. The lung outline is then filled using global thresholding, and the final output is refined using a few different clusters of FCM. In addition, a new algorithm to get an automatic threshold value for all Gaussian filters responses has also been proposed.

Estimated lung outline using oriented derivatives of Gaussian filters

In this experimental work, an estimated outline of the lung borders is obtained by combining thresholded pixels from the output responses of oriented GD order 1 in seven directions that are θ=0°, 30°, 60°, 90°, 120°, 150° and 180°, at a scale of σ=3. Based on distributions of the gradient values, different threshold values are generated for each output responses. With a correct threshold value, the output responses of each direction may successfully depict different details of the lung outlines. For instances, at θ=0° and θ=30° , details of the outer right lung and inner left lung are highlighted, and the opposite directions (θ=150° and θ=180°) represent the details of the outer left lung and inner right lung. In addition, the response at θ=60° highlights the hemidiaphragm of the right lung and the inner-lower details of the left lung; while the other side of the lung can be highlighted by the response at θ=120°. For θ=90°, most of the normal PA radiographs have both right and left hemidiaphragms highlighted, whilst some of the radiographs (especially with fluid or infection) lost this feature due to the high intensity of the consolidations around the diaphragm area. Some examples of the thresholded responses are shown in Figure 5.

Figure 5
figure 5

Output of the GD responses after thresholding. (a)(g) thresholded responses for θ=0°,30°,60°,90°,120°,150° and 180°, and (h) output of the combined responses after the ‘cleaning’ processes with rule-based algorithms.

Novel algorithm to get automatic threshold value for each Gaussian responses

A new method is proposed to automatically compute a threshold value for each different response by analysing its histogram obtained from the Gaussian filter.

The algorithm has been designed to obtain a threshold value that is located at the end of the histogram peaks. This is to ensure that only important gradient intensity is highlighted after the thresholding process, with as much noise reduction as possible. Equation 1 mathematically represents the histogram number of occurrences for each pixel value, called histogram numbers, H N . The input of this algorithm is the Gaussian response, R σ , with floating point pixel values where its range is varying from negative of thousands to positive thousands. The first step is to round these values to the closest integers, and the minimum and maximum values are denoted as mn and mx. The number of occurrences, N, for each pixel value is recorded, where each single value in the histogram is considered without discretizing it into any number of bins, and the result is called histogram numbers, H N .

$$ {H}_N(i)={\displaystyle \sum_{i=mn}^{mx}N\left({R}_{\sigma }(i)\right)} $$

The peaks of the H N are calculated based on the local maxima with the minimum peak height (mph) is set to the mean of H N . For each peak found, P HN (x), its location inside the vector H N is denoted as L P-HN (x), where x=1,2,..m; and m is the total number of peak found.

$$ {P}_{HN(x)}={H}_{N(i)}, $$

if H N(i − 1) < H N(i) > H N(i + 1) and \( {H}_{N(i)}>\frac{H_N}{mx-mn} \)

The P HN (x) are then analysed to get the chosen peak values, P HN (c), which fulfil these criterion:

  • L P-HN (x) has to be located after the maximum H N

  • P HN (x) has to be at least 3 times of mph and at most 8 times of mph. This is to ensure that the values are to be ‘true peaks’ and above average, but not too high to exclude the ‘oddly high peaks’.

The locations of the chosen peak, L P-HN (c) are mapped to the original pixel values, and a list of possible threshold values, L TH , is created. Lastly, the maximum value of L TH that is located at the end of the histogram peaks is chosen as the output of this algorithm.

Rule-based algorithms

The rule-based algorithms are important steps before the lung area is segmented from its radiograph. They involve border cleaning, noise removal, clavicles elimination, and removal of body and sides’ artefacts for each thresholded response. The unwanted details that are located along the image margins are contributed by noise from the acquisition system. Some radiographs contain clavicles or body artefacts. These unnecessary details are eliminated by removing the pixels connected to the borders. The connected pixel areas which are less 0.5% of the image size are also eliminated. The three proposed rules are presented below to get the most optimum lung outlines, and clear output responses.

To eliminate clavicle

The clavicles are located at the top-side of the lungs; top-right for right lung and top-left for left lung, and often located close enough to the image top and sides margins. To eliminate the clavicle for the right side, a rule to filter the regions is proposed where the area with the connected pixels located between 0% and 35% of the image height, r 0 , are removed. The location of minimum row has to be at most 20% of the r 0 ; and the pixels that are located between 0% and 50% of the image width, c 0 , are removed, where the location of minimum column has to be at most of 25% of the c 0 . The clavicle normally has a broad width; hence the width of the area has to be at least 15% of the image width, c 0 . Same rules are applied to the left side, except the pixels has to be located between 50% and c 0 , where the location of maximum column has to be at least 75% of c 0 .

To eliminate sides’ artefacts

These noises are normally caused by shadows inside the radiographs and they are located at the right or left sides of the image. The rule is carefully defined in such a way that only the most minimal side regions are removed. For the right side, the region has to be at most only 15% of c 0 , with the location of minimum column at 5% of c 0 or lesser. Same portion of limit is applied to the left side, with the location of maximum column at least 85% of c 0 .

To eliminate body artefacts

This rule is proposed mainly to tackle the remaining body artefacts that are not removed during the image margin cleanings. These noises are not connected to the border, but they are located very close to the bottom image’s margins. Based on these characteristics, a rule such that, the minimum row has to be located at 25% of the r 0 or more, and location of maximum row has to be at least 90% of the r 0 is defined. Area of the connected pixels is set to be at least 2.5% of the image size to preserve important lung outline such as the hemidiaphragm which is normally located at the bottom of the image and very close to the margin .The limit for minimum column for the right side is set to be at most 5% of the c 0 and the limit for maximum column for the left side is set to be at least 95% of the c 0 .

After the noise elimination steps, the output of each response is then combined to form a rough lung outline. The last rule is to eliminate small region so that only clean lung outline information is stored. The area of each connected region found in the image is calculated, and the value of largest area, A max , is stored. Any region that is smaller than 15% of the A max and maximum column located less than 20% of c 0 (right side) or minimum column located more than 80% of the c 0 (left side), are discarded. The summary of this proposed rule-based algorithms are summarized in Table 2. At the end of this process, the estimated lung outline, L outline , as in Figure 5 (h) is obtained, and another simple algorithm based on thresholding and convex hull is developed to fill in the lung outline.

Table 2 Summary of the rule-based algorithms for noise removal

Fill the lung outline based on global thresholding and convex hull

Figure 6 (a) and Figure 6 (b) show images obtained from previous processing steps denoted as L outline and normalized image using high frequency emphasis filtering (HFEF), I HFEF , respectively. The I HFEF is smoothed using Gaussian blurring with filter size of 32 by 32 and standard deviation, σ = 10. From our observation the chosen filter size and σ value are able to successfully smooth out the obvious edge details in I HFEF , and to preserve the important lung region information. A global Otsu thresholding is then applied to the smoothed I HFEF and the outputs are I th , Figure 6 (c). A convex hull of L outline is obtained and denoted as L CH (Figure 6 (d)), and I th is combined with L CH to get the ROI of I th within L CH (Figure 6 (e)), hence to produce I th-roi (Figure 6 (f)). The final estimated lung mask, L mask (Figure 6 (g-h)), is obtained by combining L outline and I th-roi , followed by basic morphological operations (dilation, filling, erosion and removing small regions).

Figure 6
figure 6

Filling the lung outline based on global thresholding and convex hull. (a) Input image L outline (b) smoothed I HFEF , (c) thresholded I HFEF (I th ), (d) convex hull of L outline (L CH ), (e) ROI of I th within L CH (f) I th-roi , (g) I th-roi  + L outline , and (h) final estimated lung mask, L mask .

Refine the lung region using FCM clustering

This work has proposed a rule-based algorithm using FCM clustering to further refine the lung mask. The FCM method that was improved by [38-40] is used for this purpose because of its ability to automatically cluster the pixels into the defined number of clusters. FCM has been used previously in segmenting lung in chest X-Ray [15,16], chest CT [7,23-28], chest MRI [18] as well as segmenting brain matter in MRI images [16,19-22,25,29].

In this algorithm, input images for FCM are the estimated lung mask, L mask that is illustrated in Figure 6 (h) obtained from the previous algorithm. L mask is then mapped to the original CXR to produce its I mask (Figure 7 (b). FCM with several numbers of clusters, n = 3 to 8, are tested (as shown in Figure 7) to get closest segmented lung areas as their ground truth lung regions which is overlapped with L mask and highlighted as orange regions in Figure 7 (a). Figure 7 (c) to Figure 7 (h) shows the experimental results of FCM thresholding with n = 3 to 8 obtained for a normal patient respectively. From our observation for all cases, the output image using n = 8 gives the best segmentation result with the most lung information preserved.

Figure 7
figure 7

Output of different number of clusters for FCM. (a) highlighted ground truth region (orange) overlapped with L mask , (b) I mask , (c) n = 3, (d) n = 4, (e) n = 5, (f) n = 6, (g) n = 7 and (h) n = 8.

Figure 8 (a) to Figure 8 (h) show cluster images that are to be processed denoted as I cn where n represents the cluster from 1 to 8. From the figures, it can be seen that each cluster image has different information in which some of them can be later combined and processed together. The first cluster image, I c1 only contains the background information of the lung mask, thus, it will be discarded. I c2 , I c3 , and I c4 have the ‘innermost’ lung information, but in some of the imperfect output of L outline , these cluster images also give unwanted details such as the center bones (sternum) and connected clavicle. Nevertheless, this problem can be overcome by applying a few steps of morphological operations to the fifth cluster image, I c5 , so that the obtained minimum lung region is then mapped to I c2 , I c3 , and I c4 . Only pixels within the region of processed I c5 (Figure 8 (i)) are considered. The results from I c2 , I c3 and I c4 are combined and denoted as I c234 (Figure 8 (k)). The next step is to process I c6 , I c7 , and I c8 , where these cluster images have the outer lung details, as well as the excess of inner and lower lung noises. The connected pixels in I c6 is firstly eroded (Figure 8 (j)), then followed by preserving the outer lung details for I c6 , I c7 , and I c8 . Any pixel falls between 40% and 60% of image width are discarded. The results of I c6 , I c7 and I c8 are then added to form I c678 (Figure 8 (l)). Lastly, the refined lung region is obtained by combining I c234 , processed I c5 and I c678 to produce the final segmented lung mask, L final Figure 8 (m).

Figure 8
figure 8

Process of refining the lung region using FCM cluster images for n = 8. (a)(h) cluster image I c1 , I c2 , I c3 , I c4 , I c5 , I c6 , I c7 , I c8 , (i) processed I c5 , (j) processed I c6 , (k) I c234 , (l) I c678 , (m) final output, L final and (n) highlighted ground truth region (orange) overlapped with L final.

Experiments and results

This section describes the performance evaluation of the proposed segmentation method for CXR images in our datasets. Segmentation performance has been assessed by comparing the output of proposed automated segmentation methods with the ground truth images prepared by the experts. Pixel-by-pixel analyses are performed to measure a similarity between the set of non-zero pixels of the two segmentation masks.

Image data

For this experimental work, images from both public (JSRT) and private (SH) image datasets have been collected. Images in the former database are the standard PA chest radiographs, 247 in total and collected from 13 institutions in Japan and one in the United States. The images are a collection of normal images (93) and with exactly one nodule (154). The images were scanned from films to a size of exactly 2048 by 2048 pixels [9]. The latter database is our own private database collected from Hospital Serdang (SH), Malaysia. It contains both PA and anterior-posterior (AP) radiographs produced by three different machines: one is stationary machine to produce PA radiographs and two mobile (portable) machines specifically for ill patient which can produce both PA and AP radiographs. The database collection consists of 86 normal images and 42 images with various types of consolidations such as but not limited to fluids, infections and cavitation. The image resolutions vary and they are in DICOM file format with 12-bit grey levels.

The image projection and patient positioning in SH datasets consists of three positioning: PA erect, AP sitting and Supine. The commonly used projection in CXR are from posterior to anterior (PA), with the X-ray source situated posterior (behind) to the patient and the X-ray plate positioned immediately anterior (frontal) to the patient’s chest. If the patient is ill and unable to stand or suffers with general immobility, the CXR may be taken anterior to posterior (AP) in sitting or supine (lying) position. Only mobile machine is able to take CXR images in sitting and lying position.

Performance measure/evaluation

The performance of the proposed segmentation algorithm is measured using a ‘goodness’ index. For two class segmentation problems such as lung and background in this work, one can distinguish true positive (TP) area (correctly classified as lung), false positive (FP) area (background incorrectly classified as lung), false negative (FN) area (lung incorrectly classified as background) and true negative (TN) area (correctly classified as background). Measures such as sensitivity, specificity, accuracy and overlap score can be computed using these values. In this work, the analyses have been performed to both right and left lungs using the following formulas:

$$ Accuracy=\frac{TP+TN}{TP+TN+FP+FN} $$
$$ OverlapScore=\frac{AreaOfInter \sec tion,TP}{AreaOfTheUnion,TP+FP+FN} $$
$$ Sensitivity/\mathrm{R}\mathrm{e} call,R=\frac{TP}{TP+FN} $$
$$ Specificity=\frac{TN}{TN+FP} $$
$$ \Pr ecision,P=\frac{TP}{TP+FP} $$
$$ F- score,F=\frac{2\times P\times R}{P+R} $$

Accuracy defines the amount of true results (both true negatives and true positives) [14]. Overlap score is defined as the agreement between the ground truth and the estimated segmentation mask over all pixels in the image [37]. This measure is well accepted and has been used widely in the lung field segmentation of chest radiographs [17]. Sensitivity or recall is corresponds to the proportion of true positives relative to the lung field that should be segmented. Sensitivity tends to 1 (or 0) if there is little (or many) false negatives [14]. Specificity is the proportion of true negatives relative to the lung field that should be segmented. Specificity tends to 1 (or 0) if there is little (or many) false positives [14]. Precision is corresponds to the proportion of true positives relative to the segmented lung field (true positives and false positives). F-Score is defined as a weighted average of both precision and recall. The best value is 1 and vice versa. Standard deviation (for all measures) is defined as the amount of disparity of the measure from its average value. The lower the standard deviation value means that the measured values are very close to their expected value. Whilst a high standard deviation value means that the measured values are varied over a large range of values. Minimum value (for all measures) defines the lowest value of the measure. A good measure shall produce a high minimum value. Maximum value (for all measures) defines the highest value of the measure. A good measure shall produce a high maximum value.

Execution time of the proposed methods

Table 3 presents the obtained computational speed of each level in the proposed segmentation method. Different stage of level may use different image sizes, thus their respective sizes are also portrayed in the table for comparison. All algorithms are developed using Matlab 7.10 as the software tool on a desktop personal computer with a 3.10-Ghz Intel i5 CPU and 8 GB memory as a testing platform. The total execution time per dataset is slightly different; where it depends on the pre-processing steps (level number 1, 2 and 3) before the segmentation stage (refer Figure 1). Comparing the three segmentation stages (level number 4), GD stage takes the longest time, with more than 70% of the time is taken to estimate the lung outline and to generate the threshold value for each Gaussian orientation (total of 7 orientations). However, the main segmentation processes are relied on the GD method, thus, the relatively high execution time is still tolerable because the main crucial issue is to achieve high segmentation accuracy. Furthermore, the retrieval system for medical image application consists of two stages: the offline feature extraction stage and the online retrieval stage. During the offline stage, features are computed for all database images; while during the online stage, only the FV of the query image is computed. It is important to take note that the unsupervised method is mandatory for a robust retrieval system.

Table 3 Average execution time for each proposed level with the respected image size

Experiments, results and discussion

Performance of our unsupervised method will be separately evaluated for each public and private datasets in term of average (mean), standard deviation (std), minimum (min) and maximum (max) values for recall, precision and F-score performance measures. All performance measures range from 0 to 1.

Experiment on public image dataset (JSRT)

The JSRT dataset consists of standard PA chest radiographs from stationary machine. The radiographs are inverted images (refer Figure 3(d)), thus they have to undergo contrast adjustment process during the pre-processing stage. Table 4 presents the performance measures for this dataset. It can be seen that most performance measures are above 0.90, except the rounded overlap measure is 0.87, which is still above satisfactory. The standard deviations for all measures are also very low, which indicates the low variation of the performance measures from the mean values. The lowest value is corresponding to the specificity (0.0147) and the highest is only 0.0628 of the sensitivity. The minimum value is however quite low for certain measures, due to a few images that are difficult to segment.

Table 4 Lung field segmentation for standard PA chest radiographs using the public image database (JSRT)

The quantitative results for this standard PA dataset are tabulated in a scattered graph as in Figure 9. The accuracy and F-score of almost all images (98% and 92% of all cases respectively) are higher than 0.90. 24% of the images achieve above 0.90 overlap score, 78% are above 0.85 and 95% are above 0.80. From the experimental work, four cases obtained about 0.60 and one case of 0.32, where the method failed to get suitable automatic threshold value when thresholding the GD responses. For these cases, the outputs led to the loss of lung outline information, thus affecting the rest of the segmentation process. This problem is due to the difference in the responses intensity, where their fit threshold values are located slightly to the centre of the histogram peaks.

Figure 9
figure 9

Performance measures of the proposed method for each image using the public JSRT dataset (247 images).

Figure 10 shows the qualitative segmentation results that are the lung contours generated by the proposed method superimposed on the original images ((a) to (c) and (g) to (i)), together with the confusion matrix ((d) to (f) and (j) to (l)), corresponding to the best and worst three segmentation outputs.

Figure 10
figure 10

Segmentation outputs (contours and confusion matrix) using the public JSRT dataset. Results are shown for the best ((a) to (f)) and worst ((g) to (l)) 3 of 247 images. TN pixels are dark grey, TP are light grey, FP are white and FN are black.

Performance comparison on JSRT dataset with existing methods

Several studies have reported their lung segmentation results on various chest radiographs as comprehensively presented in the literature. In this work, we had compared the performance measures between the proposed method and previous studies as summarized in Table 5. We only chose the quantitative results that were achieved using all 247 images of JSRT dataset. By comparing the overlap score with the supervised hybrid-based methods in [17,36,37], our method performs reasonably well with the overlap difference of 0.07 to 0.084 and 6 to 8.5 times faster execution time. In addition, our proposed method is an unsupervised and fully automated where no training or learning stage is necessary. The proposed method also performs favourably with the supervised model-based method in [34] with the sensitivity and specificity difference of 0.028 and 0.013, respectively. Comparing with the rule-based method presented in [14], where the segmentation was done based on the lung structures and extensive knowledge was needed to label each structure, our method performs much better with the accuracy difference of 0.142. The proposed approach is unsupervised, low complexity and computationally tolerable, yet provides satisfactory results.

Table 5 Segmentation methods for comparison (for 247 images in JSRT database)

Experiment on private datasets (SH)

To test the robustness of our unsupervised segmentation method, we have tested the algorithm using a private chest radiographs database collected from Hospital Serdang, Malaysia. Images in the private SH database contains both PA and AP chest radiographs, obtained from three different machines: one standard stationary machine (Siemens FD-X) and the other two are the mobile machines (ADC5146 and CR0975). The images from Siemens FD-X machine are the standard radiograph and do not need any pre-processing prior to the segmentation. Whilst the images from the two mobile machines have very different properties: CR0975 are with unnecessary background, thus need to be pre-processed by the cropping block; and ADC5146 are inverted image with unnecessary background, and need to be pre-processed by both contrast adjustment and cropping block.

The performance measures for standard PA chest radiographs from the private dataset (Siemens FD-X) are shown in Table 6. The segmentation results using the JSRT dataset outperforms the private dataset by 0.06 of the overlap measure. This is due to the homogenous intensity appearance of JSRT dataset, especially after pre-processed by the contrast adjustment block, whilst Siemens FD-X dataset performs above average despites not being pre-processed.

Table 6 Lung field segmentation for standard PA chest radiographs using the private image database (SH: Siemens FD-X)

The quantitative results for the private PA datasets are shown in Figure 11. Performance measures for this dataset can be loosely compared with those obtained from the JSRT dataset. Strict comparison is not possible since they were applied on different sets of data. It can be seen that the accuracy for 85% of the images are higher than 0.90, and the F-score gives 58% of measure above 0.90 and 92% are above 0.80. The overlap score achieves above 0.80 for 71% of the whole image, thirteen images having scores between 0.70 and 0.79, nine images with 0.60 to 0.69 and one with the lowest score of 0.59. The same cause as JSRT dataset can be deduced as the culprit of the low overlap measures. Besides, the overall performance of the private dataset is affected by the heterogeneous intensity of the images, while the public dataset contains images of good technical quality. The segmentation results are visually presented in Figure 12, with the lung contours generated by the proposed method superimposed on the original images, together with the confusion matrix, corresponding to the best and worst three segmentation outputs.

Figure 11
figure 11

Performance measures of the proposed method for each image using the private SH: Siemens FD-X dataset (79 images).

Figure 12
figure 12

Segmentation outputs (contours and confusion matrix) using the private Siemens FD-X dataset. Results are shown for the best ((a) to (f)) and worst ((g) to (l)) 3 of 79 images. TN pixels are dark grey, TP are light grey, FP are white and FN are black.

Table 7 presents the performance measures for mobile images obtained from two portable machines which contain both PA and AP radiographs from the private image database (CR0975 and ADC5146). The overall performances of both datasets are below average, due to most abnormalities present in the radiograph. The former dataset contains 14 abnormal cases (out of 34 images), and 9 from 12 images in the latter dataset are abnormal. However, the segmentation outputs show that almost all images from both datasets have their bottom lung border (at least one side of the lung) around the costophrenic angle are detected. A normal chest has almost symmetry shape (except the heart area in the left lung) with same level of costophrenic angle, thus, this information can be used to detect the consolidations.

Table 7 Lung field segmentation for mobile PA and AP chest radiographs using the private image database (SH: CR0975 and ADC5146)

Figure 13 illustrates the quantitative results of the segmentation performance using the private database. The three best and worst segmentation outputs are qualitatively presented in Figure 14. The lung contours are superimposed on the pre-processed image instead of original image. From the results, we can see that 16 images achieve overlap score above 0.80, 28 images are above 0.70, and the worst 6 are below 0.50, generated from AP radiographs. It is interesting to note that the top 13 scores are mostly from mobile PA radiographs, and the last 15 scores are all AP images. This shows that the proposed method is more suitable to segment out the lung field in PA radiographs, either acquired by mobile or standard X-Ray machine.

Figure 13
figure 13

Performance measures for each image of both private mobile datasets (CR0975 and ADC5146) with 46 images in total.

Figure 14
figure 14

Segmentation outputs (contours and confusion matrix) on combined private mobile dataset (CR0975 and ADC5146). Results are shown for the best ((a) to (f)) and worst ((g) to (l)) 3 of 46 images. TN pixels are dark grey, TP are light grey, FP are white and FN are black.

Performance comparison on all datasets with other unsupervised methods

In this section, we compare the proposed unsupervised method with other commonly used unsupervised segmentation methods: the Fuzzy C- Means (FCM) clustering and Otsu thresholding. Clustering using FCM is widely used for lung segmentation in CT thorax because of the distinct bone and cell tissue. For lung segmentation in CXR, we use four clusters FCM with combinations of several morphological operations. This work has applied Otsu’s thresholding with slope information based on the pixels distributions. In addition, it is also combined with few sequential morphological operations to clear the image from the remaining noises and refine the lung edges. The results are compared with the proposed method using both datasets (public and private) to see the effectiveness of all unsupervised methods. The results are presented in Table 8.

Table 8 Lung field segmentation using other unsupervised methods (FCM and thresholding)

From the overall results of both FCM and thresholding, we can see that FCM performs better for all datasets. The differences of the overlap measures between these two methods are 0.060 for JSRT, 0.078 for Siemens FD-X, 0.091 for CR0975 and 0.044 for ADC5146 datasets. The accuracy and specificity of all datasets are above 0.90 when using FCM, except the second mobile CXR machine (ADC5146), which is considerably high at above 0.86. Other performance measures are more than 0.80 for all datasets except the same ADC5146. This is due to the poor image quality in the dataset and most of the images contain severe diseases that cause lung shape deformation. The results from thresholding method give similar pattern, where poorer results are obtained for ADC5146 dataset.

By comparing the overlap measures for FCM and the proposed method, most of the datasets perform better with the proposed method, except on mobile machine CR0975 where FCM is higher by 0.038. For other datasets, our method is higher by 0.08 for JSRT, 0.007 for Siemens FD-X, and significantly higher on ADC5146 which is by 0.204. The accuracy and specificity of the method are above 0.90 for all datasets, and other performance measures are above 0.80, including the rounded F-score measure for CR0975 dataset. The proposed method also recorded low standard deviation measure, and high minimum and maximum measures on most datasets. This portrays that our unsupervised algorithm is more robust and perform reasonably better with any CXR dataset, either the standard PA or mobile PA and AP radiographs.


This paper has realized a novel lung segmentation algorithm for chest radiographs including the image pre-processing stages with contrast adjustment and cropping blocks to standardize the images especially for the radiograph acquired by the mobile machines. The main contribution of this paper lies in the use of fully automated proposed segmentation method to isolate the lung field from PA and mobile AP chest radiographs for the application of CBMIRS. The technique is based on Gaussian oriented derivatives filter with integration of FCM and thresholding to refine the lung outline. Another novel algorithm to generate an automatic threshold value for each orientation responses was also proposed. Our proposed method is fully automated, unsupervised and no training or learning stage is necessary.

We also compared the proposed method with the existing methods from the literature on the public JSRT dataset, and applied other unsupervised methods based on FCM and Otsu thresholding to compare the results with both public and private datasets. Our method gives better performance measures on standard PA radiographs, with overlap score and accuracy of 0.870 and 0.958 respectively for JSRT dataset, and 0.808 and 0.938 for Siemens FD-X dataset. The measures from JSRT compares satisfactorily with the existing methods from the literature. For mobile PA and AP radiographs, both datasets performs below average with any of the unsupervised methods, due to the most abnormalities present. For CR0975 dataset, highest overlap score and accuracy are obtained using FCM based approach, where the measures are 0.728 and 0.915 respectively. Whilst for ADC5146 dataset, the performance measures are significantly higher using our proposed method; 0.698 and 0.920 for both overlap and accuracy. Even though the algorithm fails to accurately segment the lung field in mobile radiographs, information on general lung outline can still be used to detect the consolidations in the lung field, which will be studied in our next work. In addition, the ultimate goal of this work is to incorporate the proposed method in the Content-based Medical Image Retrieval System (CBMIRS) for Chest X-Ray. It is important to take note that the unsupervised method is mandatory for a robust retrieval system.


  1. Murray CJ, Lopez AD. Mortality by cause for eight regions of the world: global burden of disease study. Lancet. 1997;349(9061):1269–76.

    Article  Google Scholar 

  2. Goldstone K, Yates SJ. Radiation issues governing radiation protection and patient doses in diagnostic imaging. In: Adam A, Dixon AK, editors. Grainger & Allison’s diagnostic radiology. New York: Churchill Livingstone; 2008.

    Google Scholar 

  3. Firmino M, Morais A, Mendoça R, Dantas M, Hekis H, Valentim R. Computer-aided detection system for lung cancer in computed tomography scans: Review and future prospects. BioMedical Engineering OnLine. 2014;13(1):1–16.

    Article  Google Scholar 

  4. Qi S, van Triest HJ, Yue Y, Xu M, Kang Y. Automatic pulmonary fissure detection and lobe segmentation in CT chest images. BioMedical Engineering OnLine. 2014;13(1):59.

    Article  Google Scholar 

  5. Lassen B, van Rikxoort EM, Schmidt M, Kerkstra S, van Ginneken B, Kuhnigk JM. Automatic Segmentation of the Pulmonary Lobes From Chest CT Scans Based on Fissures, Vessels, and Bronchi. Medical Imaging, IEEE Transactions on. 2013;32(2):210–22.

    Article  Google Scholar 

  6. Lo P, van Rikxoort EM, Abtin F, Ahmad S, Ordookhani A, Goldin J, et al. Automated segmentation of pulmonary lobes in chest CT scans using evolving surfaces. 2013.

    Google Scholar 

  7. Zhou S, Cheng Y, Tamura S. Automated lung segmentation and smoothing techniques for inclusion of juxtapleural nodules and pulmonary vessels on chest CT images. Biomed Signal Process Control. 2014;13:62–70.

    Article  Google Scholar 

  8. Chen B, Kitasaka T, Honma H, Takabatake H, Mori M, Natori H, et al. Automatic segmentation of pulmonary blood vessels and nodules based on local intensity structure analysis and surface propagation in 3D chest CT images. International Journal of Computer Assisted Radiology and Surgery. 2012;7(3):465–82.

    Article  Google Scholar 

  9. Shiraishi J, Katsuragawa S, Ikezoe J, Matsumoto T, Kobayashi T, Komatsu K, et al. Development of a digital image database for chest radiographs with and without a lung nodule: receiver operating characteristic analysis of radiologists' detection of pulmonary nodules. AJR Am J Roentgenol. 2000;174(1):71–4.

    Article  Google Scholar 

  10. Iakovidis DK, Papamichalis G. Automatic segmentation of the lung fields in portable chest radiographs based on Bézier interpolation of salient control points. In: Imaging systems and techniques, 2008. IST 2008. IEEE International Workshop on. 2008.

    Google Scholar 

  11. Iakovidis DK, Savelonas M. Active shape model aided by selective thresholding for lung field segmentation in chest radiographs. In: Information technology and applications in biomedicine, 2009. ITAB 2009. 9th International Conference on. 2009.

    Google Scholar 

  12. van Ginneken B, ter Haar Romeny BM, Viergever MA. Computer-aided diagnosis in chest radiography: a survey. Med Imaging IEEE Trans. 2001;20(12):1228–41.

    Article  Google Scholar 

  13. Annangi P, Thiruvenkadam S, Raja A, Xu H, XiWen S, Ling M. A region based active contour method for x-ray lung segmentation using prior shape and low level features. in Biomedical Imaging: From Nano to Macro, 2010 IEEE International Symposium on. 2010.

    Google Scholar 

  14. Ben Hassen D, Taleb H, Ben Yaakoub I, Mnif N. A Fuzzy Approach to Chest Radiography Segmentation involving Spatial Relations. In: IJCA Special Issue on Novel Aspects of Digital Imaging Applications (DIA). 2011. p. 40–7.

    Google Scholar 

  15. Shi Z, Zhou P, He L, Nakamura T, Yao Q, Itoh H. Lung Segmentation in Chest Radiographs by Means of Gaussian Kernel-Based FCM with Spatial Constraints. 2009. p. 428–32.

    Google Scholar 

  16. Rastgarpour M, Shanbehzadeh J, Soltanian-Zadeh H. A hybrid method based on fuzzy clustering and local region-based level set for segmentation of inhomogeneous medical images. J Med Syst. 2014;38(8):1–15.

    Article  Google Scholar 

  17. van Ginneken B, Stegmann MB, Loog M. Segmentation of anatomical structures in chest radiographs using supervised methods: a comparative study on a public database. Med Image Anal. 2006;10(1):19–40.

    Article  Google Scholar 

  18. Osareh A, Shadgar B. A segmentation method of lung cavities using region aided geometric snakes. J Med Syst. 2010;34(4):419–33.

    Article  Google Scholar 

  19. Verma NK, Roy A, Vasikarla S. Medical image segmentation using improved mountain clustering technique version-2. 2010. p. 156–61.

    Google Scholar 

  20. Long C, Chen CLP, Mingzhu L. A multiple-kernel fuzzy C-means algorithm for image segmentation. IEEE Trans Syst Man Cybern B Cybern. 2011;41(5):1263–74.

    Article  Google Scholar 

  21. Zhao Z, Cheng L, Cheng G. Neighbourhood weighted fuzzy c-means clustering algorithm for image segmentation. Image Process IET. 2014;8(3):150–61.

    Article  Google Scholar 

  22. Chen Y, Zhang J, Wang S, Zheng Y. Brain magnetic resonance image segmentation based on an adapted non-local fuzzy c-means method. IET Computer Vision. 2012;6(6):610–25.

    Article  MathSciNet  Google Scholar 

  23. Gomathi M, Thangaraj. A new approach to lung image segmentation using fuzzy possibilistic c-means algorithm. CoRR. 2010. abs/1004.1768.

  24. Antonelli M, Frosini G, Lazzerini B, Marcelloni F. A CAD System for Lung Nodule Detection based on an Anatomical Model and a Fuzzy Neural Network. in Fuzzy Information Processing Society, 2006. NAFIPS 2006. Annual meeting of the North American. 2006.

    Google Scholar 

  25. El-Sonbaty Y, Youssef S, Fathalla K. Enhanced fuzzy-based models for ROI extraction in medical images. In: Kim T-H et al., editors. Signal processing, image processing and pattern recognition. Berlin Heidelberg: Springer; 2011. p. 26–35.

    Chapter  Google Scholar 

  26. Jaffar MA, Hussain A, Mirza A. Fuzzy entropy based optimization of clusters for the segmentation of lungs in CT scanned images. Knowl Inf Syst. 2010;24(1):91–111.

    Article  Google Scholar 

  27. Karthikeyan CRB, Baskar S. Segmentation algorithm for CT images using morphological operation and artificial neural network. Int J Signal Process Image Process Pattern Recognit. 2012;5(2):115–22.

    Google Scholar 

  28. Moon WK, Lo CM, Goo JM, Bae MS, Chang JM, Huang CS, et al. Quantitative analysis for breast density estimation in low dose chest CT scans. J Med Syst. 2014;38(3):21.

    Article  Google Scholar 

  29. Pham DL, Prince JL. Adaptive fuzzy segmentation of magnetic resonance images. IEEE Trans Med Imaging. 1999;18(9):737–52.

    Article  Google Scholar 

  30. Parveen NR, Sathik MM. Detection of pneumonia in chest X-ray images. J Xray Sci Technol. 2011;19(4):423–8.

    Google Scholar 

  31. Mehta IC, Khan ZJ, Khotpal RR, et al. Volumetric measurement of heart using PA and lateral view of chest radiograph. In: Manandhar S, editor. Applied computing. Berlin Heidelberg: Springer; 2004. p. 34–40.

    Chapter  Google Scholar 

  32. Alzubaidi M, Balasubramanian VN, Patel A, Panchanathan S, Black JA. Efficient atypicality detection in chest radiographs. in Information Science, Signal Processing and their Applications (ISSPA), 2012 11th International Conference on. 2012.

    Google Scholar 

  33. van Ginneken B, Frangi AF, Staal JJ, ter Haar Romeny BM, Viergever MA. Active shape model segmentation with optimal features. IEEE Trans Med Imaging. 2002;21(8):924–33.

    Article  Google Scholar 

  34. Juhász S, Horváth A, Nikházy L, Horváth G, Horváth A. Segmentation of Anatomical Structures on Chest Radiographs. In: Bamidis P, Pallikarakis N, editors. XII Mediterranean Conference on Medical and Biological Engineering and Computing 2010. Berlin Heidelberg: Springer; 2010. p. 359–62.

    Chapter  Google Scholar 

  35. Xu T, Mandal M, Long R, Cheng I, Basu A. An edge-region force guided active shape approach for automatic lung field detection in chest radiographs. Comput Med Imaging Graph. 2012;36(6):452–63.

    Article  Google Scholar 

  36. Dawoud A. Fusing shape information in lung segmentation in chest radiographs. 2010.

    Google Scholar 

  37. Candemir S, Jaeger S, Palaniappan K, Musco JP, Singh RK, Zhiyun X, et al. Lung Segmentation in Chest Radiograps Using Anatomical Atlases with Non-rigid Registration. IEEE Trans Med Imaging. 2014;33(2):577–90.

    Article  Google Scholar 

  38. Bezdek JC, Dunn JC. Optimal fuzzy partitions: a heuristic for estimating the parameters in a mixture of normal distributions. Comput IEEE Trans. 1975;C-24(8):835–8.

    Article  Google Scholar 

  39. Bezdek JC. A convergence theorem for the fuzzy ISODATA clustering algorithms. IEEE Trans Pattern Anal Mach Intell. 1980;2(1):1–8.

    Article  MATH  Google Scholar 

  40. Bezdek JC, Pal SK. Fuzzy models for pattern recognition. 267th ed. New York: IEEE press; 1992.

    Google Scholar 

Download references


The authors would like to thank Dr. Fadzilah Hashim, Radiologists in Diagnostic Imaging Department, Serdang Hospital, Malaysia, for providing the chest radiographs dataset and medical advice. This research is supported in part by GGPM-2013-012 and FRGS/1/2012/TK06/UKM/03/2.

Author information

Authors and Affiliations


Corresponding author

Correspondence to W Mimi Diyana W Zaki.

Additional information

Competing interests

The authors declare that they have no competing interests.

Authors’ contributions

WSHMWA carried out the experiments and draft out the manuscript. The experiments were supervised by both supervisors, MFAF and WMDWZ. Eleven drafts of the manuscript were checked thoroughly by MFAF and WMDWZ and revised by WSHMWA until the final version was approved by all authors.

Wan Siti Halimatul Munirah Wan Ahmad, W Mimi Diyana W Zaki and Mohammad Faizal Ahmad Fauzi contributed equally to this work.

Rights and permissions

Open Access  This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made.

The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.

To view a copy of this licence, visit

The Creative Commons Public Domain Dedication waiver ( applies to the data made available in this article, unless otherwise stated in a credit line to the data.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Wan Ahmad, W.S.H.M., W Zaki, W.M.D. & Ahmad Fauzi, M.F. Lung segmentation on standard and mobile chest radiographs using oriented Gaussian derivatives filter. BioMed Eng OnLine 14, 20 (2015).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: