# Introduction n human body there a lot of diseases. Brain diseases are common in human body. It comes in different forms. Infections, trauma, stroke, seizures, and tumors are some of the major categories of brain diseases. Brain tumor, a notorious disease has affected and devastated many lives. This disease has been the centre of attention of thousands of researchers for many decades, around the world [1]. Brain Tumour : There are mainly two types of brain tumor. Those that start in the brain (primary) and those that spread from cancer somewhere else in the body (metastasis). Primary brain tumors, such as a glioma, happen less often, and when they do, they are mostly malignant (cancerous). A malignant tumor is a mass or clump of cancer cells that keeps growing; it doesn't do anything except feed off the body so it can grow [2] . Figure 1: Brain tumour MRI: Magnetic resonance imaging (MRI) of the brain is a safe and painless test that uses a magnetic field and radio waves to produce detailed images of the brain and the brain stem. An MRI scanner consists of a large doughnut-shaped magnet that often has a tunnel in the center. Patients are placed on a table that slides into the tunnel. During the exam, radio waves manipulate the magnetic position of the atoms of the body, which are picked up by a powerful antenna and sent to a computer. The computer performs millions of calculations, resulting in clear, cross-sectional black and white images of the body. These images can be converted into three-dimensional (3-D) pictures of the scanned area. This helps pinpoint problems in the brain and the brain stem when the scan focuses on those areas [3]. In this paper a fully automatic method to detect brain tumor is proposed. Proposed system will consider MR Image as an input. Then it will be processed using image processing tool of MATLAB. If any type of tumor is available then it will be automatically detected and finally the percentage of tumour affected area will also be calculated. Again if any types of tumour aren't available system will tell the users that "there is no tumour". # II. # Methodology The algorithm has three stages, first is pre processing of given MRI image second is perform morphological operations third is showing the performance parameter and finally calculating the tumor affected area . Steps of algorithm are as following [4]. # a) Taking an MRI image as an input To read an image for processing we have used the 'imread' command. The example reads one of the sample images 't.bmp' and stores it in an array named I. I = imread ('t.bmp'); If the file (sample image) is not in the current folder, then the full path with the filename will have to specify. The text string 'bmp' specifies the format of the file by its standard file extension. For example, 'gif' is specified for Graphics Interchange Format files. , The 'informate' function can be used to see a list of supported formats, with their file extensions. If imread cannot find a file named 'filename', it looks for a file named 'filename.fmt'. # Convert it to gray scale image and obtain the maximum intensity Using 'rgb 2 gray' command in MATLAB MR Images are converted into gray scale image. J = rgb2gray (I) 'rgb ' means Red, Green and Blue. The brightness level for this color is represented in decimal from 0 to 255 or binary from 00000000 to 11111111. In grayscale image black color is represented by R=G=B=00000000 and white color is represented by R=G=B=11111111. This image processing technique is called 8-bit gray scaling. # c) Adjusting the MRI image using the max intensity level in order to avoid excess data In order to adjust (eliminate excess data) the gray scaled image we have used the built-in function imadjust: K1 = imadjust(J,[0.55 0.8],[]); Which actually adjust the intensity values in grayscale image J to new values in k1 such that 1% of data is saturated at low and high intensities of J. This increases the contrast of the output image k1. Converting MR Image to binary image in order to detect the boundary K2 = imadjust(J,[0.1 0.5],[]); BW_K2=im2bw (K2, level); Converting the adjusted grayscale image K2 to a binary image the output image BW_K2 replaces all pixels in the input image with luminance greater than level with the value 1 (white) and replaces all other pixels with the value 0 (black). Specifying level in the range [0, 1], regardless of the class of the input image. The function 'graythresh' can be used to compute the 'level' argument automatically. Specifying level=. 5 for the function im2bw. Using 'imfill' command for filtering image K2. 'imfill' command displays the binary image BW on the screen and lets us define the region to fill by selecting points interactively by using the mouse. To use this interactive syntax, BW_K2 must be a 2-D image. # e) Calculating the area of the head cross section Using 'regionprops' command in MATLAB that measures a set of properties for each connected component (object) in the binary image, BW_k2. stats= regionprops(BWfill,'Area'); The image BW_k2 is a logical array; it can have any dimension. For-loop in MATLAB will calculate the total volume of head. Using 'bwperim' command that returns a binary image containing only the perimeter pixels of objects in the input image. A pixel is part of the perimeter if it is nonzero and it is connected to at least one zero-valued pixel. For loop will calculate the total head area cross-section. It will show the boundary of the brain. head_area =0; for i = 1:kk head_area=head_area+ stats (i).Area; end f) Detecting the boundary of head cross section BW_K1 = im2bw (K1, level); Again leveling the [.55 .8] adjusted image K1 to binary image BW_K1. Using 'ceil' command in MATLAB it rounds the elements of new adjusted binary image to the nearest integers greater than or equal to 'Bw_k1.' For complex 'Bw_k1', the imaginary and real parts are rounded independently. For morphologically opening binary image we use 'bwareaopen' command. BW2 = bwareaopen(BW_K1, tuning+5); It removes from a binary image all connected components (objects) that have fewer than tuning+5 pixels, producing another binary image, BW2. # g) Boundary elimination and tumour detection: Subtracting two processed image sub1 = BW2 -BWsdil; First one is when boundary area is open. Second one is when image is processed by imdilate command . BWsdil = imdilate(BWoutline, SE); It dilates the grayscale, binary, or packed binary image 'BW outline', returning the dilated image, 'BWsdil'. The argument 'SE' is a structuring element object, or array of structuring element objects, returned by the 'strel' function. If 'BW outline' is logical and the structuring element is flat, 'imdilate' performs binary dilation; otherwise, it performs grayscale dilation. If SE is an array of structuring element objects, 'imdilate' performs multiple dilations of the input image, using each structuring element in SE in succession. # i) Calculating tumor affected area Using 'max' command in MATLAB largest elements along different dimensions of an array of a tumor is calculated. A loop is used for calculating the area of tumor cross-section. for i = 1: kk tumor_area=tumor_area+stats(i).Area ; end 'for' command executes block of code specified number of times and 'end' command terminate block of code, or indicate last array index. # III. # Result and Discussion ![Taking an MRI image as an input ? Convert it to gray scale image and obtain the maximum intensity. ? Adjusting the MRI image using the max intensity level in order to avoid excess data. ? Detecting the boundary of head cross section by converting MRI image to binary image. ? Calculating the area of the head cross section ? Detecting the boundary of head cross section after converting the adjusted image to binary image. ? Eliminating the boundary and detecting the tumor affected region ? Showing the performance parameter of tumor affected image and normal image ? Calculating the area of tumor.](image-2.png "?") ![Tumor Detection using Mr Images Through Pixel based Methodology BWoutline = bwperim(sub2); By using 'bwperim' perimeter binary image are detected. By using 'strel'function of objects in b) d) images are converted to morphological structural element it creates a structuring element, SE, of the type specified by shape. h) Showing the performance parameter of tumor affected image and normal image For image processing technique image histogram and image profile both performance parameter are used. Image histogram of every processed image is shown by 'imhist' command of MATLAB. It is a chart that shows the distribution of intensities in an indexed or grayscale image. 'Imhist' function creates a histogram plot by making a number of equally spaced bins, each representing a range of data values. It then calculates the number of pixels within each range. Again 'improfile' computes the intensity values along a line or a multiline path in an image. It selects equally spaced points along the path is specified, and then uses interpolation to find the intensity value for each point. It also works with grayscale images and RGB images.](image-3.png "Brain") 2![Figure 2 : MRI image of tumor affected and normal brain](image-4.png "Figure 2 :") 4![Figure 4: Adjusted the MRI image using the max intensity level](image-5.png "Figure 4 :") 4![Figure 4: Conversion to binary Image](image-6.png "Figure 4 :") 58![Figure 5 : Boundary detection](image-7.png "Figure 5 :Figure 8 :") 9![Figure 7 :](image-8.png "Figure 9 :") © 2015 Global Journals Inc. (US) 1 © 2015 Global Journals Inc. (US) ## Conclusions In this paper brain tumor detection technique using MRI has been investigated. Using MATLAB programme system was designed to detect tumor and two performance parameter like image histogram and image profile were used to identify tumor. On top of that tumor affected area of brain was also calculated and proposed algorithm is more efficient than previously suggested technique [4] [5]. In future filtering method will be improved that has been currently used. Effective filtering will ensure the detection of tumor in efficient and accurate way. Future extension will able to detect the types of tumors (i.e. Benign tumor, Milligan tumor, Glioma). Again new extension will also be able to tell in which region (i.e. Fore brain, Mid brain, Hind brain) of the brain is affected by tumor. * Brain Tumour Extraction from MRI Images Using MATLAB CRajesh DrA SPatil Bhalchandra Communication & Soft Computing Science and Engineering 2277-9477 2 1 International Journal of Electronics * Tehseen Fatima An Efficient Brain Tumor Detection Algorithm Using Watershed & Thresholding Based Segmentation AnamMustaqeem AliJaved I.J. Image, Graphics and Signal Processing 10 2012 * Iv