International Journal of Biomedical Engineering and Clinical Science
Volume 1, Issue 2, November 2015, Pages: 29-42

Lung Detection and Segmentation Using Marker Watershed and Laplacian Filtering

Mariam Saii1, Ali Mia2

1Computer Scinces, Teshreen University, Lattakia, Syria

2Mechanical and Electrical Engineering, Tishreen University, Lattakia, Syria

Email address:

(M. Saii)
(A. Mia)

To cite this article:

Mariam Saii, Ali Mia. Lung Detection and Segmentation Using Marker Watershed and Laplacian Filtering.International Journal of Biomedical Engineering and Clinical Science.Vol.1, No. 2, 2015, pp. 29-42. doi: 10.11648/j.ijbecs.20150102.12

Abstract: This paper proposes a new speed approach for the segmentation of the lung images in order to detect and extract the tumor region. The approach consists of two main stages, which are the preprocessing stage, marker watershed stage and the tumor detection stage. The preprocessing consists of laplacian filtering to enhance edges and make the next stages more efficient. The marker watershed step applies the Sobel gradient function on the foreground and background markers to get the possible tumor region. The post processing stage consists of tumor detection and segmentation in which the area of the tumor is calculated. The results are done on a medical lung database obtained from Tishreen hospital (in Lattakia, Syria) which consists of 59 images from 10 persons. The result shows robustness of the system in detecting and segmenting tumor region in different depths. The designed GUI supplies user with tumor region and area, and time of each stage.

Keywords: Image Processing, Medical Image Processing, Lung Images, Segmentation, Tumor Detection

1. Introduction

Automatic cancer detection and segmentation are very important steps in medical image processing systems that facilitate the medical operations and play as second opinion beside the doctor decision.

Lung cancer is one of the most deadly diseases in the world. So, automatic lung cancer detection is an important topic in this field which has been taken very care at the last ten years.

Techniques used in this field are (local) thresholding, region growing, edge detection, ridge detection, morphological operations, fitting of geometrical models or functions and dynamic programming. On the other hand, there is another approach used in lung regions extraction process based on pixel classifications.

In 1993 Chiou et al. [1] designed an artificial neural network based hybrid lung cancer detection system, which was used to improve the accuracy of diagnosis.

Hayashibe et al. [2] proposed an automatic method based on the subtraction between two serial mass chest radiographs, which was used in the detection of new lung nodules.

Mori et al. [3] proposed a procedure to extract bronchus area from 3-D chest X-ray CT images.

Zhou et al. [4] designed an automatic pathological diagnosis procedure named Neural Ensemble based Detection (NED) is proposed and realized in an early stage Lung Cancer Diagnosis System (LCDS).

In 2011 Sharma et al. [5] applied computer Aided Diagnosing (CAD) system for detection of lung cancer. This system generally first segments the area of interest (lung) and then analyzes the separately obtained area for nodule detection in order to diagnosis the disease, as result 90% sensitivity with 0.05 false positives per image.

Tarawneh [6] introduces a lung detection algorithm depends on gabor filter and watershed algorithm. The system achieved 85.165 rate on 5 persons.

Ayari [7] combined computed tomography (CT) medical images, image processing and Finite Element (FE) technique to grasp the patient lung tissue response under gradual stages of lung cancer. Finite Element models based on lung CT images of different patients are used to detect the difference between mechanical parameters in both normal and pathologic cases.

Vivanti [8] proposed a fully automatic algorithm for lung tumor segmentation in follow-up CT studies that takes the advantages of the baseline delineation. They applied their system on 80 pairs of CT scan from 40 patients with ground-truth segmentations by a radiologist yield an average DICE overlap error of 14.5 %, a significant improvement from the 30%.

Hussain et al. [9] designed a lung detection system using artificial neural networks and fuzzy classification to detect cancer in CT scan images.

2. System Description

The suggested system consists of the following operations:

Figure 1. Block diagram of Lung Tumor Detection system.

2.1. Preprocessing

This stage includes two sub-stages which are transformation and sharpening.

- first we read image and transform it to the gray level as figure illustrates:

Figure 2. Gray level input image.

- second, sharpening filter is applied to enhance image and illustrates the edges. We suggests using two different filters which are Gabor and Lapalacian and we compare them at the result section. The gabor filter is band pass filter used to detect edges and defined as follows [10,11]:


where, s(x,y) is the complex sine function and is called carrier and given like this [10]:


u0,v0 are spatial frequencies. P the pahse of sine function.

while wr(x,y) is the Gaussian function and called the envelope and given like this [10]:

x0,y0 are the tops of function, a and b are scaling parameters, and r is the rotation parameter.

Figure 3-A illustrates gabor filtering on the input image.

Modified Laplacian function is another edge enhancement function at the spatial domain, its function is defined as follows [11,12]:

Figure 3-A shows Labplacian filtering on the input image.

Figure 3. Sharpening Filtering (A) gabor (b) Laplacian.

The base difference between gabor and laplacian is that the first works on the entire gray levels while the second works only on the edges.

2.2. Tumor Detection

The enhanced image is then supplied to the next stage which is the tumor detection stage.

2.2.1. Segmentation Function

The first operation in detecting tumor is defining the segmentation function, which (in our algorithm) is the gradient magnitude and it has been done by Sobel filter.

Sobel filter is applied on vectors and rows, then the square root of results is calculated to get edges. Filtered images (Gx,Gy) of sobel and the resulted edges (G) are given as follows [12]:

The following images illustrates the sobel edges of enhanced image.

Figure 4. Sobel Gradient Image.

2.2.2. Foreground Marking

The foreground pixels are group of connected pixels defined by means of morphological operations as follows:

1- Applying opening operation by 20 pixel_size mask of type disk on the enhanced image. The mask and result image is illustrated in figure (5-A).

2- Two reconstruction steps are done:

2-1 The first is closing operation on the previous opened image to remove the darkened areas of image (A). the figure (5-C) includes the closed image.

2-2 The second depends on two open and close operation as follows:

2-2-1 Applying erosion then reconstruction operations on enhanced image. The reconstruction step needs two images which are the marker image (eroded image) and mask image (enhanced image).Result is illustrated in figure(5-B).

2-2-2 Applying dilation operation on the reconstructed image. The complement of dilated image is then fed as marker of second reconstruction operation, while the mask image is the complement of the first reconstruction image.

The result image is illustrated in figure (5-D). The comparison between figure C and D shows that reconstruction method (fig D) is better than the other (Fig C), so we go on with the reconstruction method.

3- The maximum values in reconstructed image (5-D) is then calculated to get the foreground pixels as figure (5-E) shows. The pixels are then plotted on the enhanced image (fig 5-F).

4- In some cases the result foreground pixels are outlier pixels and must be filtered. To obtain that, the result connected components whose area is less than threshold () is removed (Fig 5-G).







Figure 5. Foreground pixels detection (A):closing of enhanced image (B)Reconstructed closed image (C) Opening and closing of enhanced image (D) Reconstructed open-close-image (E) Maximum Areas of reconstructed image (F) Enhanced image with foreground pixels.

Figure 6. Background Markers (A): Binary reconstructed image, (C): Background Markers.

2.2.3. Background Detection

The reconstructed open-close image is transformed into binary form (figure (6-A)). The black pixels is the background but these points shouldn’t touch the region of interest. So, we skeletonize the background area as figure (6-B) shows.

2.2.4. Watershed Segmentaion

The watershed algorithm consists of two main steps which are:

-Fusion of the foreground and background markers images. So that the Sobel (segmentation Function) will give high values in these points and low values in the rest.

-Get the labeled matrix of the fusion image by means of applying the segmentation function (Sobel Filter) on that image.

The labeled image is colored to give each area a separate color. Figure 7 illustrates the response of watershed algorithm on an infected lung image.

Figure 7. Watershed Segmentation (A) enhanced image overlaid by Labeled Image (B) Colored Watershed Image.

It can be noticed that the infected lung image result in multi-color watershed image, while if the lung has no tumor, then the watershed result in unicolor. So, a threshold of 1 of image’s regions is taken to determine if the lung is infected or not. figure (8) includes example of algorithm response in non-infected lung image which includes only one region as shown.

Figure 8. Watershed Segmentation of unharmed lung image (A) enhanced image (B) Colored Watershed Image.

2.3. Post Processing

The post processing consists of extraction the tumor region and calculation of tumor size.

2.3.1. Extraction of Tumor

To detect the tumor region, we take the labeled watershed image as input. First, we removed the very small regions which are noise, and can’t be the tumor. The threshold value for this stage is 400.

Second, the area of each region is calculated, and the area with small region is selected which should be the tumor.

Figure 9 illustrates the extraction of tumor region in a lung image.

Figure 9. Result of tumor extraction of infected lung (A) enhanced image (B) labeled watershed image (C) The tumor region (D) enhanced image overlaid by tumor.

2.3.2. Tumor Area Calculation

The tumor size is calculated by summing the number of white pixel in each region of the tumor region.

The results section will include calculation of some tumor areas.

3. Results and Discussion

The results are done on a database from Tishreen-Hospital (Lattakia-Syria). It consists of 10 patients, with 50 CT scan images. The images are from different depth.

Figure 10 illustrates the segmentation of some database samples.

Figure 10. The segmentation of some database samples (A): filtered image (B) The segmented image.

3.1. Tumor Detection Evaluation

The algorithm spends 0.372 seconds approximately to apply preprocessing and 1.77 seconds for marker watershed algorithm, while it takes 0.49 seconds.

The following table includes the result of detection of lung tumor and elapsed time for each phase.

Table 1. Result of detection of lung tumor and elapsed time.

Enhanced image Detected tumor Pr (s) Sg (s) Dt (s)

0.42 1.69 0.56

0.382 1.96 0.56

0.35 1.55 0.47

0.38 1.82 0.55

0.37 1.98 0.4

0.33 1.63 0.41

Note: Pr: preprocessing, Sg: segmentation, Dt: detection.

3.2. Case of Different Depth Images

The database contains images of the same lung region but with different depth. So, we evaluate the designed algorithm on these different depths.

It shows robustness against these criteria.

Figure 11 includes samples of detection results of different depths.

Figure 11. Detection Evaluation in sense of different depths (A): filtered image (B) Watershed segmentation (C) Detected Tumor.

From above we can conclude that detection algorithm works well in different depths.

Table 2 Detection rate of watershed algorithm by using gabor and laplacian filters.

Patient No. No. Images Right detection (Laplacian) Right detection (Gabor)
1 5 5 5
2 5 5 5
3 9 9 7
4 6 6 4
5 6 6 4
6 6 6 5
7 6 6 6
8 7 7 6
9 5 5 4
10 4 4 4

3.3. Laplacian & Gabor Comparative

The results applied on 59 images from 50 images, the laplacian filter approach were better than gabor in detection and segmentation rates.

Table 2 illustrates the detection rate of watershed algorithm by using gabor and laplacian filters.

The gabor filter gives 86.44% detection rate while the laplacian filter gives 100% detection rate.

3.4. Graphical User Interface

We designed a GUI in Matlab to facilitate dealing with Lung detection and segmentation system. GUI is supplied by functions to define tumor’s area and algorithm’s time. The figure 12 illustrates some examples of designed GUI after testing some samples.









Figure 12. Tumor Detection and segmentation results (A, C, E,G): watershed stage (B,D,F,H): Detection, Segmentation and Area calculation.


  1. Chiou YSP, Lure YMF, Ligomenides PA. Neural network image analysis and classification in hybrid lung nodule detection (HLND) system. In:Proceedings of the IEEE-SP Workshop on Neural Networks for Signal Processing, 1993. p.517-526.
  2. Hayashibe R, Asano N, Hirohata H, Okumura K, Kondo S, Handa S, Takizawa M, Sone S, Oshita S. An automatic lung cancer detection from X-ray images obtained through yearly serial mass survey. In:Proceedings of the International Conference on Image Processing, 1996. vol.1, p.343-346.
  3. Mori K, Hasegawa J, Toriwaki J, Anno H, Katada K. Recognition of bronchus in three-dimensional X-ray CT images with applications to virtualized bronchoscopy system. In:Proceedings of the 13th International onference on Pattern Recognition, 1996. vol.3, p.528-532.
  4. Zhou ZH, Chen SF, Chen ZQ.FANNC: A fast adaptive neural network classifier.Knowledge and Information Systems2000; 2(1): 115-129.
  5. Disha Sharma, Gagandeep Jindal, "Identifying Lung Cancer Using Image Processing Techniques",International Conference on Computational Techniques and Artificial Intelligence, 2011, pp:115-120.
  6. Mokhled S. AL-TARAWNEH, "Lung Cancer Detection Using Image Processing Techniques", Leonardo Electronic Journal of Practices andTechnologies, Issue 20, January-June 2012, p. 147-158.
  7. Fatma Ayari1, Mekki Ksouri, Ali Alouani, "A computer based model for lung cancer analysis", International Journal of Computer Science Issues, Vol. 9, Issue 5, No 1, September 2012, pp:438-447.
  8. Vivanti R1, Joskowicz L, Karaaslan OA, Sosna J., "Automatic lung tumor segmentation with leaks removal in follow-up CT studies",Int J Comput Assist Radiol Surg. 2015 Jan 22,
  9. Masaood Hussain, Tabassum Ansari, Prarthana S.Gawas, Nabanita Nath Chowdhury, "Lung Cancer Detection Using Artificial Neural Network & Fuzzy Clustering, international journal of advanced research in computer and communication Engineering Vol 4, Issue 3, March 2015, pp.360-363.
  10. I. Ibraheem, Validation Study of Supervised and Unsupervised Calcification-Algorithms Used to Detection of Melanoma,  International Journal of Biomedical Engineering and Clinical Science, Vol. 1, Issue 2, November 2015, s(1-9)
  11. Vishukumar S. Patel K. Shrivastava P. 2012 Implementation of Medical Image Enhancement Technique using Gabor Filter, International Journal of Current Engineering and Technology, V.2, 2.
  12. R.C. GONZALEZ and R. E. WOODS, "Digital Image Processing", 2nd Edition, Prentice Hall, January 2002.

Article Tools
Follow on us
Science Publishing Group
NEW YORK, NY 10018
Tel: (001)347-688-8931