1
Brain Tumor Detection Using MR Image
Processing
Submitted in partial fulfillment of the requirements for the degree of
Bachelor of Technology
in
Electrical and Electronics Engineering
by
Ujjwal Karanwal
15BEE0260
Pranav Sethi
15BEE0081
U nder the guidance of
Prof. Sankardoss V
SELECT
VIT, Vellore.
April, 2019
2
DECLARATION
I hereby declare that the thesis entitled Brain Tumor Detection
using MR Image Pr ocessing “” submitted by us , for the award of the degree of Bachelor
of Technology in Electrical and Electronics Engineering to VIT is a record of
bonafide work carried out by us under the supervision of Prof.
Sankardoss V .
I further declare that the work re ported in this thesis has not been submitted
and will not be submitted, either in part or in full, for the award of any other degree or
diploma in this institute or any other institute or university.
Place: Vellore
Date: 5 th April, 2019
Signature of the Candidate
3
CERTIFICATE
This is to certify that the thesis entitled Brain Tumor Detection using MR
Image Processing submitted by Ujjwal Karanwal 15BEE0260 and Pranav Se thi
15BEE0081 , SELECT , VIT University, for the award of the degree of Bachelor of
Technology in Electrical and Electronics Engineering , is a record of bonafide work
carried out by him under my supervision during the period, 01.
12. 2018 to
30.04.2019, as p er the VIT code of academic and research ethics.
The contents of this report have not been submitted and will not be submitted
either in part or in full, for the award of any other degree or diploma in this institute or
any other institute or university. The thesis fulfills the requirements and regulations of
the University and in my opinion meets the necessary standards for submission.
Place : Vellore
Date : 5th April, 2019 Signature of the Guide
In tern al E xami n er E xtern al E xami n er
HOD: Prof. Meikandasivam S
Electrical and Electronics Engineering
4
ACKNOWLEDGEMENTS
We have taken sincere efforts in this project. However, it would not have been
possible without the kind support and help of many individuals and organizations. We
wo uld like to extend our sincere thanks to all of them.
We are highly indebted to Prof. Sankardoss V for their guidance and constant
supervision as well as for providing necessary information regarding the project & also for
their support in completing the p roject. We would like to express our gratitude towards
member s of VIT University for their kind co -operation and encouragement which help ed us
in completion of this project. Our thanks and appreciations also go to the peo ple who have
willingly helped us ou t with their abilities.
Ujjwal Karanwal
Pranav Sethi
5
Executive Summary
The given project consists of diagnosing and detection of Brain tumor using Image
Processing techniques in MATLAB. Initially, image is processed for no ise removal using
various filters . Different types of segmentation methods are used in the project to give a
comparative study of various types of segmentation methods. Various different
segmentation methods which are used in the project are as follows:
? K Means
? Fuzzy C means
? Watershed Segmentation
? Histogram Thresh holding
The segmented image then undergoes morphological operations. Finally, output image is
superimposed on the input image for better representation. The tumor is marked with pink
color in the image.
6
CONTENTS Page
No.
Acknowledgement 4
Executive Summary 5
Table of Contents 6
List of Figures 8
List of Tables 9
Abbreviations 10
Symbols and Notations 11
1 INTRODUCTION 12
1.1 Objective 12
1.2 Motivation 13
1.3 Background 14
2 PROJECT DESCRIPTION AND GOALS 15
3
TECHNICAL SPECIFICATION
16
4
DESIGN APPROACH AND DETAILS (as applicable)
17
4.1 Design Approach / Ma terials & Methods
4.2 Codes and Standards
17
20
4.3 Constraints 27
5 SCHEDULE, TASKS AND MILESTONES 28
6
PROJECT DEMONSTRATION
29
7
RESULT & DISCUSSIO N (as applicable)
38
7
8 SUMMARY 40
9
REFERENCES
41
APPENDIX A
.
8
List of Figures
Figure No. Title Page No.
4.1 Methodology 17
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6.9
6.10
6.11
6.12
Input Images
Image Pre -Pro cessing
Image 1 Segmentation
Image 1 Final Stage
Input Image 2
Image 2 Pre -processing
Image 2 Segmentation
Image 2 Final Stage
Input Image 3
Image 3 Pre -processing
Image 3 Segmentation
Image 3 Final Stage
29
29
30
31
32
32
33
34
35
35
36
37
9
List of Tables
Table No. Title Page No.
7.1 Tabular Comparison of Segmentation Techniques 39
10
List of Abbreviations
MRI Magnetic Resonance Imaging
CT Computed Tomography
PET Positron Emission Tomography
K Number of clusters
FCM Fuzzy C Means
FPR FPR
FNR FNR
11
Symbols and Notations
? Sigma( Summation Symbol)
? Belongs to
Ci Number of clusters
12
1. INTRODUCTION
1.1. OBJECTIVE
The g iven undertaking comprises of diagnosing and discovery of Brain tumor utilizing
Image Processing strategies in MATLAB. At first, picture is handled for commotion
evacuation utilizing different channels. Distinctive sorts of division techniques are utilized
in the venture to give a relative investigation of different kinds of division strategies.
Different diverse division strategies which are utilized in the venture are as per the
following:
? K means
? Fuzzy C means
? Watershed Segmentation
? Histogram Thresh holdi ng
The sectioned picture at that point experiences morphological tasks. At last, yield picture is
superimposed on the information picture for better portrayal. The tumor is set apart with
pink shading in the picture.
13
1.2. MOTIVATION
Imaging tumors with more accuracy play s pivotal role in the diagnosis of tumors. It
involves high resolution techniques like MRI, CT, and PET etc. MRI is an important mean
for studying the bodys visceral structures. MRI is widely used because it gives better
quality images of the brain and ca ncerous tissues compared to the other medical imaging
techniques such as X -Ray or Computed Tomography (CT). MRI imaging is a non -invasive
technique, all the more reason to use it for imaging. The basic principle behind MRI is to
generate images from MRI sc an using strong magnetic field and radio waves of the body
which helps in investigating the anatomy of the body.
Since people are inclined to mistake, mechanizing the procedure will diminish the odds
of false location. Since the patients of tumor are expand ing and numerous individuals in
rustic regions don’t have adequate assets for discovery and treatment of the ailment, so
growing such programmed framework will be exceptionally useful. Since the accessibility
of specialists in remote zones are exceptionall y restricted, just a machine is required which
can naturally recognize the tumor and give the outcomes.
14
1.3. BACKGROUND
Cerebrum tumor creates in view of irregular cell development inside the mind. Mind
Tumor by and large grouped into two sorts Benign and Malignant tumors. Dangerous
Tumors are quickly developing destructive tissues. Kindhearted are moderate developing,
dormant malignant tumor. The vast majority of the tumors are perilous. Essential mind
tumors begin in the cerebrum. In optional kind of cerebrum tumor, the t umor ventures into
the mind from different pieces of the body.
Imaging tumors with more precision assumes crucial job in the conclusion of tumors. It
includes high goal s procedures like MRI, CT, and PET and so forth. X -ray is a vital mean
for considering the body’s instinctive structures. X -ray is generally utilized on the grounds
that it gives better quality pictures of the cerebrum and harmful tissues contrasted with t he
other therapeutic imaging strategies, for example, X -Ray or Computed Tomography (CT).
X-ray imaging is a non -intrusive strategy, even more motivation to utilize it for imaging.
The essential standard behind MRI is to produce pictures from MRI check util izing solid
attractive field and radio rushes of the body which helps in examining the life systems of the
body.
15
2. PROJECT DESCRIPTION AND GOALS
This project is bein g carried out to detect brain tumor using medical imaging
techniques. The main part of the whole process is Image Segmentation which has a very
high impact of the whole process, so four different types of Image segmentation
methods are used which are, K -me ans clustering, Fuzzy C Means, Watershed
segmentation and Histogram Thresh holding. All the four different techniques are
applied of the MR image and results are observed and verified.
A given MR Image is processed using various Image processing Technique s to bring
out or spot the tumor in the image. Different types of segmentation methods are used in
the project to give a comparative study of various types of segmentation methods.
16
3. TECHNICAL SPECIFICATIONS
The whole process is impleme nted in MATLAB. Many images were used to verify the
proper functioning of the MATLAB code. The evaluation matrices used will be as follows:
? Jaccard matrix
? Dice matrix
? FPR
? FNR
The more the value of Jaccard matrix is, the more the similarity in between the
images. The less the FPR and FNR the better the algorithm.
17
4. DESIGN, APPROACH AND DETAILS
4.1 DESIGN APPROACH / MATERIALS OR METHODS
The MR Images to be examined are col lected as data. These images are served as
input to the code which is to be implemented in MATLAB. The images are made to go
through various filters and segmentation techniques and later through morphological
operations.
Figure 4.1: Methodology
18
METHODOL OGIES AND ALGORITHMS:
The whole process is divided into two stages: First is Pre -processing of MR image and
second is a Segmentation and Morphological operation.
1. Image Pre -processing : It includes conversion of image into gray scale,
enhancement of image and noise removal. Steps in their order of execution are
discussed as follows:
? Gray Scale Conversion – Convert the image to gray scale image. Then convert
it into binary image and fill the holes using the MATLAB commands.
? Image enhancement – In this step, i mage is sharpened and contrast is adjusted
to enhance the image. Sharpening returns an enhanced version of the
grayscale image where the image features, such as edges, have been
sharpened. Increase the contrast (separation between the dark and white
colors ) of the image and saturate the high and low intensities.
? Noise Removal – In this step, three different type of filters are applied on the
image to remove the high and low intensity noise. The three filters are:
Gaussian Low pass filters, Gaussian High pass filter and Median Filter.
2. Segmentation and Morphological Operations : Four different types of
segmentation methods are performed on the images. These are as follows:
3.
? K-means Clustering – The algorithm for K -means clustering is as follows:
1. First we will choose the quantity of centroids arbitrarily for example relies
upon number of bunches
2. Presently, segment the articles inside each group.
3. It discovers segments to such an extent that pixels inside each bunch zones
close to one another as would be prudent, and as far from the items in different
groups as could be allowed.
4. The articles are in the group or not will be determined by esti mating the
separation between the bunch pixels. At the point when the determined
Euclidean separation has littlest esteem then the pixels will be bunched with the
comparing group.
5. Do the above procedure for residual bunches too. At that point, we will get
three bunches with their comparable pixels.
6. Presently, ascertain the mean of each bunch and supplant the mean qualities
with the centroid.
19
7. Rehash a similar procedure with these new centroids by giving the
quantity of emphasess until except i f the union event i.e., the mean
estimation of bunches = group centroid esteem.
? Fuzzy C Means – The algorithm for Fuzzy C Means is as follows:
Step 1: Choose the number of clusters – K
Step 2: Set initial centers of clusters c1, c2 ck.
Step 3: Classify each vector x [x , x ,….x ] T into the closest centre ci by
Euclidean distance measure ||xi -ci ||=min || xi -ci||.
Step 4: Recomputed the estimates for the cluster centers ci Let ci = [ ci1, ci2
,….cin
] T cim be computed by, cim = ?xli ? Cluster (Ixlim) /Ni Where, Ni is the
number of vectors in the i -th cluster.
Step 5: If none of the cluster centers (ci =1, 2, , k) changes in step 4 stop;
Otherwise go to step 3.
? Watershed Segmentation – It is a standout amongst the best strategies to
assemble pixels of a picture based on their powers. Pixels falling under
comparative powers are assembled together. It is a decen t division strategy
for partitioning a picture to isolate a tumor from the picture Watershed is a
scientific morphological working apparatus. Watershed is ordinarily utilized
for checking yield as opposed to utilizing as an info division procedure since
it as a rule experiences over division and under division.
? Histogram Thresh holding – Limit division is one of the most straightforward
division techniques. The information dark scale picture is changed over into
a paired organization. The strategy depends on a limit esteem which will
change over dark scale picture into a paired picture position. The primary
rationale is the determination of a limit esteem. Some regular strategies
utilized under this division incorporate most extreme entropy technique and
k-implies grouping strategy for division.
Morphological tasks utilized are Image Erosion and Dilation. Subsequent to
changing over the picture in the parallel arrangement, some morphological tasks are
connected on the changed over twofold picture. The reason for the morphological
adminis trators is to isolate the tumor part of the picture. Presently just the tumor
segment of the picture is noticeable, appeared white shading. This bit has the most
elevated force than different districts of the picture.
20
4.2. CODES AND STANDARDS
MATLAB Code:
clc
clear all;
close all
im=imread( ‘brain5.jpg’ );
figure (1)
subplot(2,4,1);
imshow(im);
title( ‘Original Image’ );
%convert original image to gre y scale image
I2=rgb2gray(im);
[rows, columns, numberOfColorBands] = size(I2);
hold on;
subplot(2,4,2);
imshow(I2);
title( ‘Grayscale Image’ );
I3 = I2 > 40;
I3 = imfill(I3, ‘holes’ );
mask = bwconvhull(I3); %produces convex hull image
I4 = I2;
I4(~mask) = 0;
%Sharpening Image
I5 = imsharpen(I4, ‘Radius’ ,2, ‘Amount’ ,1);
hold on;
subplot(2,4,3);
imshow(I5);
title( ‘Sharpened Image’ );
%Enhancement
I6=imadjust(I5);
hold on;
subplot(2,4,4);
imshow(I6,[]);
title( ‘Enhanced Image’ );
21
PQ = paddedsize(size( I6));
% Gaussian Low -pass
d0=0.05*PQ(1);
H = lpfilter( ‘gaussian’ , PQ(1), PQ(2), d0);
F=fft2(double(I6),size(H,1),size(H,2));
lpfImage=real(ifft2(H.*F));
lpfImage=lpfImage(1:size(I6,1), 1:size(I6,2));
hold on;
subplot(2,4,5)
imshow(lpfImage,[]);
title( ‘Low -pass filter’ );
% Gaussian High -pass
d1=0.02*PQ(1);
H = hpfilter( ‘gaussian’ , PQ(1), PQ(2), d1);
F=fft2(double(I6),size(H,1),size(H,2));
hpfImage=real(ifft2(H.*F));
hpfImage=hpfImage(1:size(I6,1), 1:size(I6,2));
hold on;
subplot(2,4,6)
imsho w(hpfImage,[]);
title( ‘High -pass filter’ );
h = hpfImage;
% Median filter
I7 = medfilt2(I6, [floor(PQ(1)/100) floor(PQ(1)/100)]);
hold on;
subplot(2,4,7)
imshow(I7,[]);
title( ‘Median filter’ );
tic
%K MEANS ALGORITHM
out2=I2;
max_val=max(max(out2));
out3=out2.*(255/max_val);
im1=uint8(out3);
k=4;
22
img_hist = zeros(256,1);
hist_value = zeros(256,1);
for i=1:256
img_hist(i)=sum(sum(im1==(i -1)));
end
for i=1:256
hist_value(i)=i -1;
end
cluster = zeros(k,1);
cluster_count = zeros(k,1);
for i=1:k
cluster(i)=uint8(rand*205); % to select random centroids initially
end ;
old = zeros(k,1);
while (sum(sum(abs(old -cluster))) >k)
old = cluster;
closest_cluster = zeros(256,1);
min_distance = abs(hist_value -cluster(1));
for i=2 :k
min_distance =min(min_distance, abs(hist_value -cluster(i)));
end
for i=1:k
closest_cluster(min_distance==(abs(hist_value -cluster(i)))) = i;
end
for i=1:k
cluster_count(i) = sum(img_hist .*(closest_cluster==i));
end
for i=1:k
if (cluster_count(i) == 0)
cluster(i) = uint8(rand*255);
else
cluster(i) = uint8(sum(img_hist(closest_cluster==i).*hist_value(closest_cluster==i))/cluster_count(i));
end
end
end
23
imresult=uint8(zeros(size(im1)));
for i=1:256
imresult(im1==(i -1))=cluster(closest_cluster(i));
end ;
figure(2)
imshow(imresult,[]);
title( ‘k means output’ );
toc
tic
%Fuzzy c MEANS ALGORITHM
out2=I7;
max_val=max(max(out2));
out3=out2.*(205/max_val);
im=uint8(out3);
im=double(im);
[maxX,maxY]=size(im);