Morphological Operations to Segment a Tumor from a Magnetic Resonance Image
 Author: Thapaliya Kiran, Kwon GooRak
 Organization: Thapaliya Kiran; Kwon GooRak
 Publish: Journal of information and communication convergence engineering Volume 12, Issue1, p60~65, 31 March 2014

ABSTRACT
This paper describes an efficient framework for the extraction of a brain tumor from magnetic resonance (MR) images. Before the segmentation process, a median filter is used to filter the image. Then, the morphological gradient is computed and added to the filtered image for intensity enhancement. After the enhancement process, the thresholding value is calculated using the mean and the standard deviation of the image. This thresholding value is used to binarize the image followed by the morphological operations. Moreover, the combination of these morphological operations allows to compute the local thresholding image supported by a floodfill algorithm and a pixel replacement process to extract the tumor from the brain. Thus, this framework provides a new source of evidence in the field of segmentation that the specialist can aggregate with the segmentation results in order to soften his/her own decision.

KEYWORD
Floodfill algorithm , Gradient , Morphological operations , Thresholding

I. INTRODUCTION
Segmentation of a brain tumor of magnetic resonance (MR) images is a difficult task that involves various disciplines, including pathology and magnetic resonance imaging (MRI) physics, a radiologist’s perception, and an image analysis based on intensity, shape, and size. There are several issues and challenges in the appropriate segmentation of a brain tumor. According to the data of the World Health Organization, more than 4,00,000 persons undergo the treatment for brain tumors every year. Tumors differ according to their shape, size, and location, and may appear at different places with different intensities. Therefore, it is very difficult to find the exact location of a tumor in the brain. The precise segmentation of brain tumors is of great interest. We can classify brain tumors as primary tumors called benign tumors, which do not spread elsewhere, and secondary, or malignant tumors, which spread from another location of the body to the brain. In order to detect a tumor in the brain, the patients in the hospital undergo diagnoses, such as computed tomography (CT) scans and MRI. Even though a radiologist performs these diagnoses, it is very difficult to distinguish a tumor in the brain due to the involvement of several kinds of abnormalities, noises, and intensities. Manual segmentation of brain tumors has been always time consuming and difficult, and may lead to the death of the patients in the case of improper identification. It is thus dangerous to perform manual segmentation in patients as its success depends on the examiner’s experience and skill. Thus, computer aid or an automatic method that makes it easier for the physician to examine a tumor in the brain needs to be developed.
Different methods and approaches have been proposed for the extraction of a brain tumor. Some of them are based on edge detection, clustering, basic watershed segmentation, region growth, and fuzzy logic. The edge detection technique works well for images that have a high intensity, but fails for lowcontrast images due to a poor gradient magnitude as in [1]. Similarly, a clusteringbased method such as kmeans clustering is fast even in the case of a large dataset, but it does not provide the same result in each run due to the fact that it is dependent on the initial random assignments [2, 3]. Although watershed segmentation is used vastly in the field of image segmentation, the main drawback is that it produces oversegmentation. In the regiongrowing approach, the initial value of the seed should be identified; therefore, there might be an error in choosing the seed value and the method suffers from a high time complexity. Hierarchical selforganizing mapbased multiscale image segmentation proposed in [4] and the threedimensional (3D) variational segmentationbased method proposed in [5] was also used for the image segmentation. In [6, 7], the researchers used artificial intelligence techniques for automated tumor segmentation. Statistical pattern recognitionbased methods [812] fall short, partly because large deformations occur in the intracranial tissues due to the growth of the tumor and edema. The methods proposed in [812] detect abnormal regions by using a registered brain atlas as a modality for healthy brains. However, these techniques need to significantly modify the brain atlas to accommodate the tumors, which leads to poor outcomes. Most researchers today are using Markov random fields [1216], which involve the estimation of the parameters of a parametric model that has one set of parameters to express the probability that each specific vessel is a tumor, and another set to extract the distribution over the labels of a pair of adjacent corners.
Therefore, a method that can efficiently determine a tumor in the brain from MR images needs to be developed. In this paper, we propose an efficient method of extracting a brain tumor by using the morphological gradient and morphological operations [1721]. The rest of this paper is organized as follows: Section II explains the proposed method and shows the stepwise techniques for the detection and extraction of a brain tumor. Experimental results are presented in Section III with the test images and their analysis followed by a conclusion in Section IV.
II. PROPOSED ALGORITHM
With respect to practical implementation, it is very difficult to obtain only the tumor part of a different MR image. Therefore, we need a new method to extract the tumor part easily. The proposed method can extract the tumor part of an MR image easily and efficiently. The flow chart of the proposed method is shown in Fig. 1. The detailed procedure is described below.
> A. Image Preprocessing
Medical images may contain a considerable amount of noise, dirt, and debris, which affects the process of segmentation. Therefore, it is very important to remove the noise from images that a doctor uses to appropriately examine a tumor. Therefore, the first step of image segmentation is the removal of the noises present in an image. A median filter is used here because it preserves the sharp edges of the image.
> B. Morphological Gradient and Image Enhancement
Morphological operations, such as dilation and erosion for grayscale images, are defined in terms of the minima and the maxima of pixel neighborhoods and are used for the computation of the slope of the filtered image. The grayscale equation for the dilation of 𝑓 by structuring element
b , denoted by (𝑓 ⊕b ), is defined as follows:where
D_{b} denotes the domain ofb and 𝑓(𝑥,𝑦) .𝑓 represents the filtered image. (𝑥 − 𝑥') and 𝑦 − 𝑦' have to be in the domain of𝑓, and 𝑥' and 𝑦' in the domain ofb . Flat grayscale dilation is denoted a local maximum operator whose maximum is computed over a set of pixel neighbors determined by the shapes ofD_{b} .Analogously, the grayscale equation for the erosion of 𝑓 by the structuring element
b , denoted by ( 𝑓 ⊕b ) is defined as follows :Flat grayscale erosion is denoted by a local minimum operator whose minimum is computed over a set of pixel neighbors determined by the shapes of
D_{b} .Now, the morphological gradient of the image can be calculated as follows:
The image enhancement in the proposed method is done with the addition of
Morph_gra and the filtered imageFilt_img. where
I _{1} denotes the eventuate image after the addition of theMorph _gra gradient image and theFilt_img medianfiltered image.> C. Image Binarization
The image is binarized using the threshold value. In the proposed algorithm, the threshold value is computed using the mean and the standard deviation of image
I _{1}. The mean and the standard deviation of imageI _{1} is calculated by using the following equation:where
μ andσ are the mean and the standard deviation of imageI _{1} andFilt _ img (x,y ). In Eq. (5), we calculate the mean value of each column in imageI _{1} and choose the maximum mean value.Again, the mean value is calculated using the morphological gradient image
Morph_gra as follows:where
μ _{1} denotes the mean value of the gradient imageMor_gra. After the mean and the standard deviation of the image are calculated, the thresholding value is determined using the following equation:where
μ andσ denote the mean and the standard deviation of imageI _{1} andFilt _img (x, y ) ;μ _{1} represents the mean value of the gradient imageMor_gra. T denotes the thresholding value used to binarize the image as an initial step of the proposed algorithm. Now, we can obtain the binarized image by using the thresholding valueT as follows:> where
T denotes the thresholding value andI _{2}(x, y ) represents the binarized image obtained using Eq. (9).> D. Calculation of Local Thresholding Value
In the proposed method, closing and opening operations are used to calculate the thresholding value. Closing and opening operations are the two important parts of morphological operations. A closing operation is used to smooth the contour sections. It generally fuses narrow breaks and long, thin gulfs, eliminates small holes, and fills gaps in the contour.
The closing of set
I _{2} by structuring elementB , denoted asI _{2} •B , is defined as follows:The closing of
I _{2} byB is simply the dilation ofI _{2} byB , followed by the erosion of the result byB . Denote the result of the closing operation asI_{close} .Opening operations smooth the contour of an object, break narrow isthmuses, and eliminate thin protrusions. Similarly, the opening of set
I _{close} by the structuring elementB , denoted asI_{close}. B , is defined as follows:Thus, opening
I_{close} byB is the erosion ofI_{close} byB , followed by a dilation of the result byB . Denote the result of the above opening result asI_{open} .Now, by using the closing and opening operations, we can calculate the local thresholding value as follows:
where
I_{close} andI_{open} denote the closed and the opened image, respectively.I_{lthresh} represents the local thresholding image.Once the local thresholding image
I_{lthresh} is calculated, we can segment imageI _{2} that is closed and opened to remove the unnecessary objects present in the image. This process is performed by comparing imagesI _{4} andI _{7}.where
I _{3} (x , y ) denotes the binarized image obtained after comparing imageI _{2} and the local thresholding imageI_{lthresh} .> E. FloodFill Algorithm and Pixel Replacement
Flood fill, also called seed fill, is an algorithm that determines the area connected to a given node in a multidimensional array. This algorithm takes three initial values: a start node, a target color, and a replacement color.
In the first step, this algorithm looks for nodes in the array that are connected to the start node via the path of the target color and changes them to the replacement color. There are several ways in which a floodfill algorithm can be structured, but they all make use of a queue or a stack data structure, explicitly or implicitly.
The queuelinear floodfill algorithm is adopted in our application [12]. We apply the queuelinear floodfill algorithm to the binarized image
I _{3} (x ,y ) . Suppose that the image that we obtained after applying the queuelinear floodfill algorithm isI _{4} (x, y ) . Finally, pixel replacement is done to get the desired output tumorsegmented image. The pixel replacement is performed as follows:where 𝑓(
x , y ) is the original image andI _{4} (x , y ) is the extracted tumor image.III. EXPERIMENTAL RESULTS
The proposed method was tested with different MR images. Images used for the experiment are of brain tumors of different shapes, sizes, and intensities. The new method was tested in comparison with the method proposed by Singh and Dubey [20] for the extraction of a brain tumor. The experimental results proved that the proposed method performs better than the method developed by [20] for the extraction of a brain tumor from the MR images. The proposed algorithm was tested using MATLAB 2010. Fig. 2 shows the different images obtained at different steps of the proposed method. Fig. 3(a)(h) shows the experimental results obtained in the cases of different images containing a tumor.
Table 1 presents the values of different parameters. The values of these parameters for different images are used for the extraction of the brain tumor by using the proposed algorithm. Table 2 lists the time consumed to run both the algorithms. It is clear from Table 2 that the proposed method takes less time in comparison to the method proposed by [20] to efficiently extract the tumor. In the entire experimental process, the structuring element used in the morphological operation has a disk shape and a value of 3.
IV. CONCLUSIONS
In this paper, an algorithm for the efficient extraction of a brain tumor from an MR image has been introduced. This algorithm is based on mathematical morphology and thresholding. Opening and closing operations helped to reduce some artifacts from the MR image. The thresholding process was used to convert the image into a binary form. The results are presented as images with a brain tumor and images showing the extraction of the affected region of the brain. The proposed method is invariant in terms of the size, shape, intensity, and location of the brain tumor. This method is simple and easy to understand. Experimental results indicated that the proposed method performed well in enhancing and retaining the shape of the original brain tumor and in segmenting the brain tumor from the MR image.
The proposed method can efficiently extract a tumor from the MR images of the brain and paves the way for an expert to decide whether the extracted tumor is benign or malignant on the basis of certain pathological features. This will be the subject of further research.

3. DewalleVignion A. S., Betrouni N., Makni N., Huglo D., Rousseau J., Vermandel M. 2007 “A new method based on both fuzzy set and possibility theories for tumor volume segmentation on PET images,” [in Proceedings of the 30th Annual International Conference of IEEE Engineering in Medicine and Biology Society] P.31223125

[Fig. 1.] Detailed process of the proposed method

[Fig. 2.] Images at different stages of the proposed method: (a) original image, (b) filtered image, (c) morphological gradient image, (d) enhanced Image, (e) binarized image of I1 obtained using Eq. (9), (f) output image obtained using Eq. (14), (g) image obtained after the execution of the floodfill algorithm, (h) tumor extracted using the proposed method, and (i) tumor extracted using the method proposed by [20].

[Fig. 3.] Original image and finally segmented tumor image. (a), (d), and (g) show the original images; (b), (e), and (h) show the tumor image finally extracted using the proposed method; and (c), (f), and (i) show the images extracted using method proposed by [20].

[Table 1.] Values of different parameters used in brain tumor segmentation

[Table 2.] The time complexity of the proposed method and the method proposed by [20]