0% found this document useful (0 votes)
538 views

Brain Tumor Detection From MRI Images Using MATLAB Code

This document summarizes a research paper on detecting brain tumors from MRI images using MATLAB. The paper proposes using MATLAB's graphical user interface to apply various image segmentation, filtering, and processing algorithms to MRI images in order to best detect brain tumors. The methodology uses basic digital image processing concepts like pre-processing, thresholding, filtering and feature extraction on MRI images from a brain web database to extract and detect tumors. MATLAB is used to implement the proposed algorithm for automatic brain tumor detection and analysis, providing an improvement over manual detection methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
538 views

Brain Tumor Detection From MRI Images Using MATLAB Code

This document summarizes a research paper on detecting brain tumors from MRI images using MATLAB. The paper proposes using MATLAB's graphical user interface to apply various image segmentation, filtering, and processing algorithms to MRI images in order to best detect brain tumors. The methodology uses basic digital image processing concepts like pre-processing, thresholding, filtering and feature extraction on MRI images from a brain web database to extract and detect tumors. MATLAB is used to implement the proposed algorithm for automatic brain tumor detection and analysis, providing an improvement over manual detection methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

International Journal of Scientific Research in Engineering and Management (IJSREM)

Volume: 06 Issue: 11 | November - 2022 Impact Factor: 7.185 ISSN: 2582-3930

Brain Tumor Detection from MRI Images Using MATLAB Code

Divya Gavadi, Mahammadjaveed N, S Hemapriya


Department of Electronics & Communication Engineering
TONTADARYA COLLEGE OF ENGINEERING Mundaragi Road gadag
Corresponding Author: Ravi Gadad

---------------------------------------------------------------------***---------------------------------------------------------------------
Abstract -Engineering have been actively developing finite number of elements, each of which has a
tools to detect tumors and to process medical images. particular location and value.
Medical image segmentation is a powerful tool that is Tumor is defined as the abnormal growth of the
often used to detect tumors.This project is about detecting tissues. Brain tumors are generally classed into two
brain tumors from MRI images using an interface of types benign and malignant tumors. MRI imaging plays
GUI in MATLAB. Using the GUI,this program can use
an important role in brain tumor for analysis, diagnosis
and treatment planning. It is helpful to doctor for
various combinations of segmentation ,filters,and other
determining the previous Steps Of brain tumor (ll. The
images processing algorithm to achieve the best detection of brain tumor using MRI images are a
results.Brain tumor segmentation from MR images of challenging task because of the complex structure of the
patients taken from ‘Brain web’. Hybrid methodology is brain. MRI images provide better results than CT scan,
used to extract and detect tumor MR images using basic Ultrasound and X-ray because it is an advanced medical
imaging technique and it powerful magnets to produce
concept of digital image processing. MATLAB is used for
high resonance images of all parts of the body, These
this purpose in this paper for applying the proposed
MRI image can be processed and one can detect the
algorithm brain tumor using image processing technique by
forming automatic detection process using various
Key Words: Matlab, MRI algorithms because the manual detection of tumor from
MRI images give human error. In this project our focus
will be mainly to improve the existing approaches of
1. INTRODUCTION ( Size 11, Times New roman) image processing or design a better approach for the
detection of the tumor
In these days, the interest in digital biomedical image
processing methods takes a most important position in 2. Requirement Analysis
two principal and important areas[1]. The most
Operating System : Window 10
important one is an improvement of pictorial
information for human studies and processing of Programming Language : C
biomedical image data for storage. A biomedical image
sometimes is defined as a two dimensional function, programming Software : Matlab
F(x,y), where x and y are the value or Gray level of a
biomedical image at a specific point. F are all finite,
discrete quantities. We should know that to say an
image is a digital image is when it is composed of a

© 2022, IJSREM | www.ijsrem.com DOI: 10.55041/IJSREM16765 | Page 1


International Journal of Scientific Research in Engineering and Management (IJSREM)
Volume: 06 Issue: 11 | November - 2022 Impact Factor: 7.185 ISSN: 2582-3930

3. Block Diagram ✓ Noise Removal

✓ Contrast Enhancement

3. Conversion to Gray scale

A grayscale image only consists of Gray scale values, but


MRI images consist of primary color (RGB) content.When
MRI images are viewed, they look like black and white but
they contain some primary color (RGB). So, for further
processing of MRI brain image, it must be converted to
perfect Gray scale image

6. Filtering

4. Input Image

Filtering is a technique for modifying or enhancing an image.


Image processing operations implemented with filtering
include smoothening, sharpening and edge enhancement.
Filtering is a neighborhoods operation, in which the value of
any given pixel in the output image is determined by applying
some algorithms to the values of the pixels in the
neighborhood of the corresponding input pixel.

7. Image Enhancement
The first stage i.e. the image acquisition stage which starts
with taking a collection of images forming the database.
Images are stored in MATLAB will be displayed as a Gray
scale image. As our MRI DICOM data set was in mat file,
we have extracted the images using MATLAB code.

5. Image pre-processing

This is the second step of image processing where the Image enhancement the details that are obscured and
images are used to enhance the chances of detecting the highlights certain features in an image. The fundamental
suspicious region.images are enhanced and noises are enhancement needed in the MRI images is the contrast
removed from the images The goal of pre-processing is to enhancement. Here we have Image enhancement provides the
remove the noise and to provide Contrast Enhancement to details that are obscured and highlight certain features in an
improve the image quality.pre-processing process is image.

✓ Gray scale conversation

© 2022, IJSREM | www.ijsrem.com DOI: 10.55041/IJSREM16765 | Page 2


International Journal of Scientific Research in Engineering and Management (IJSREM)
Volume: 06 Issue: 11 | November - 2022 Impact Factor: 7.185 ISSN: 2582-3930

8. Image Segmentation 11.Source code


The next stage is image segmentation. Image segmentation is %Input
the process of partitioning a digital image into multiple % [I, path]=uigetfile('*.jpg','select ainput image');
segments. Image segmentation will be typically used to locate % str=strcat(path,I);
s=imread('C:\Users\HP\Documents\MATLAB\br ain.JPEG');
objects and boundaries in images and it helps to make the
figure;
analysis easier. Here we have implemented Threshold method imshow(s);
for image segmentation. For intensity based segmentation it is title('Input image','FontSize',20);
better to use threshold rather than colour based segmentation %Filter num_iter =
technique. In threshold based segmentation each an every 10; delta_t = 1/7;
pixel is compared with the threshold value. kappa = 15;
option = 2;
disp('Preprocessing image pleasewait . . .');
9. Feature Extraction %Preprocessing image please wait . . .inp =
anisodiff(s,num_iter,delta_t,kappa,option)
;
Removing noise Filtering Completed !! inp =
uint8(inp); inp=imresize(inp,[256,256]);
if size(inp,3)>1
inp=rgb2gray(inp);end
figure;
imshow(inp);
title('Filtered image','FontSize',20);
%thresholding sout=imresize(inp,[256,256]);
t0=60;
th=t0+((max(inp(:))+min(inp(:)))./2); for
The next stage is the feature extraction. The 1m age Feature i=1:1:size(inp,1)
Extraction stage is very important in our work where we will for j=1:1:size(inp,2) if
use algorithm and techniques to detect and isolate various inp(i,j)>th
sout(i,j)=1;
desired portions or shapes of an image. After the
else
segmentation is performed the feature; can be obtained from
it and the diagnosis rule can be designed of exactly detect the
tumor. Feature extraction is the transformation of input data
into a set of features; it is a key stage of performing the task,
which identifies set of features that
sout(i,j)=0;
describe the visual texture of an image
end
end
10.Algorithm used for Detection of Tumor end
%Morphological Operation label=bwlabel(sout);
Step 1: Input the image stats=regionprops(logical(sout),'Solidity
','Area','BoundingBox'); density=[stats.Solidity];
Step 2: Convert the RGB image to gray area=[stats.Area]; high_dense_area=density>0.6;
max_area=max(area(high_dense_area));
Step 3: Use the filters for removing noise and perform tumor_label=find(area==max_area);
subtraction operation and form histogram equivalent for tumor=ismember(label,tumor_label);
Contrast enhancement. if max_area>100 figure;
imshow(tumor)
Step 4: Apply Watershed Segmentation for detection title('tumor alone','FontSize',20);
Step 5: Perform morphological operations for calculating
Area, Third moment, Entropy, Mean, Standard Deviation.
Step 6: Tabulate and Compare the parameters calculated for else
normal and abnormal images. h = msgbox('No Tumor!!','status');
%disp('no tumor');return;

end

© 2022, IJSREM | www.ijsrem.com DOI: 10.55041/IJSREM16765 | Page 3


International Journal of Scientific Research in Engineering and Management (IJSREM)
Volume: 06 Issue: 11 | November - 2022 Impact Factor: 7.185 ISSN: 2582-3930

%Bounding box imshow(tumorOutlineInserted); title('Detected


box = stats(tumor_label); wantedBox = Tumer','FontSize',20);
box.BoundingBox;figure
imshow(inp); %Display Togetherfigure
title('Bounding Box','FontSize',20);hold on; subplot(231);imshow(s);title('Input image','FontSize',20);
rectangle('Position',wantedBox,'EdgeColor ','y'); subplot(232);imshow(inp);title('Filtered image','FontSize',20);
hold off; subplot(233);imshow(inp);title('Bounding Box','FontSize',20);
%Getting Tumor Outline - image filling,eroding, subtracting hold on;rectangle('Position',wantedBox,'EdgeCo lor','y');hold off;
erosion the walls by a few pixelsdilationAmount subplot(234);imshow(tumor);title('tumor alone','FontSize',20);
= 5; subplot(235);imshow(tumorOutline);title(' Tumor
rad = floor(dilationAmount); [r,c] = Outline','FontSize',20);
size(tumor); subplot(236);imshow(tumorOutlineInserted); title('Detected
filledImage = imfill(tumor, 'holes');for i=1:r Tumor','FontSize',20);
for j=1:c
x1=i-rad; %Filter defining
x2=i+rad; function diff_im = anisodiff(im, num_iter, delta_t, kappa,
y1=j-rad; option)
y2=j+rad; if fprintf('Removing noise\n'); fprintf('Filtering
x1<1 x1=1; Completed !!');
end
if x2>r % Convert input image to double. im =
x2=r; end double(im);
if y1<1
y1=1; % PDE (partial differential equation)initial condition.
end diff_im = im;
if y2>c
y2=c; % Center pixel distances.dx = 1;
end dd = sqrt(2);
eroded Image(i,j) = % 2D convolution masks - finitedifferences.
min(min(filledImage(x1:x2,y1:y2))); end hN = [0 1 0; 0 -1 0; 0 0 0];
end figure hS = [0 0 0; 0 -1 0; 0 1 0];
imshow(erodedlmage); hE = [0 0 0; 0 -1 1; 0 0 0];
title('eroded image','FontSize',20); hW = [0 0 0; 1 -1 0; 0 0 0];
hNE = [0 0 1; 0 -1 0; 0 0 0];
%subtracting eroded image from originalBW image hSE = [0 0 0; 0 -1 0; 0 0 1];
tumorOutline=tumor; hSW = [0 0 0; 0 -1 0; 1 0 0];
tumorOutline(erodedImage)=0; figure; hNW = [1 0 0; 0 -1 0; 0 0 0];
imshow(tumorOutline);
title('Tumor Outline','FontSize',20); % Anisotropic diffusion. for t =
1:num_iter
%Inserting the outline in filtered imagein green color
rgb = inp(:,:,[1 1 1]); % Finite differences. [imfilter(.,.,'conv') can be replaced by
red = rgb(:,:,1); conv2(.,.,'same')]
red(tumorOutline)=255; green = nablaN = imfilter(diff_im,hN,'conv'); nablaS =
rgb(:,:,2); green(tumorOutline)=0; imfilter(diff_im,hS,'conv'); nablaW =
blue = rgb(:,:,3); imfilter(diff_im,hW,'conv'); nablaE =
blue(tumorOutline)=0; imfilter(diff_im,hE,'conv'); nablaNE =
tumorOutlineInserted(:,:,1) = red; imfilter(diff_im,hNE,'conv'); nablaSE =
tumorOutlineInserted(:,:,2) = green; imfilter(diff_im,hSE,'conv'); nablaSW =
tumorOutlineInserted(:,:,3) = blue; figure imfilter(diff_im,hSW,'conv'); nablaNW =
imfilter(diff_im,hNW,'conv');

% Diffusion function.

© 2022, IJSREM | www.ijsrem.com DOI: 10.55041/IJSREM16765 | Page 4


International Journal of Scientific Research in Engineering and Management (IJSREM)
Volume: 06 Issue: 11 | November - 2022 Impact Factor: 7.185 ISSN: 2582-3930

if option == 1 • Instead of rectangular boxes, can work with general


cN = exp(-(nablaN/kappa).^2); cS = exp(- boundaries: level set based framework.
(nablaS/kappa).^2); cW = exp(-
(nablaW/kappa).^2); cE = exp(- • By creating 3d anatomical models from individual patients,
(nablaE/kappa).^2); cNE = exp(- training, planning and computer guidance during surgery is
(nablaNE/kappa).^2); cSE = exp(- improved
(nablaSE/kappa).^2); cSW = exp(-
(nablaSW/kappa).^2); cNW = exp(-
(nablaNW/kappa).^2);elseif option == 2 REFERENCES
cN = 1./(1 + (nablaN/kappa).^2); cS = 1./(1 +
(nablaS/kappa).^2); 1. Text Book : Study on brain tumor detection using
cW = 1./(1 + (nablaW/kappa).^2); cE = 1./(1 +
MRimages – written by Abdullah Al Mahmud
(nablaE/kappa).^2); cNE = 1./(1 +
(nablaNE/kappa).^2); cSE = 1./(1 + 2. Digital Image Processing by Kenneth R.Castleman
(nablaSE/kappa).^2); cSW = 1./(1 +
(nablaSW/kappa).^2); cNW = 1./(1 + 3. Digital Image Processing Using Matlab by
(nablaNW/kappa).^2);end Rafael C.Gonzalez,Ricard E.Woods,Steven
% Discrete PDE solution. diff_im = L.Eddins
diff_im + ...
delta_t*(...
(1/(dy^2))*cN.*nablaN +
(1/(dy^2))*cS.*nablaS + ...
(1/(dx^2))*cW.*nablaW +
(1/(dx^2))*cE.*nablaE + ...
(1/(dd^2))*cNE.*nablaNE +
(1/(dd^2))*cSE.*nablaSE + ...
(1/(dd^2))*cSW.*nablaSW +
(1/(dd^2))*cNW.*nablaNW );

end

CONCLUSIONS

MRI images are best suitable for brain tumor detection.


In this study Digital Image Processing Techniques are
important for brain tumor detection MRI images. The
pre-processing techniques include different methods
like Filtering, Contrast enhancement, Edge detection is
used for image smoothing. The pre-processed images
are used for post processing operation like threshold and
Chen features are extracted using GLCM and
classification is done by Artificial Neural Network
where we have obtained 76.5% of accuracy when run on
a dataset of 300 images in classifying tumor and non
tumor images. This work help in detection of tumor
which in turn save the precious time of doctor and
pathologist to diagnose the tumor automatically in short
span of time.

Future Scope
• In future, this technique can be developed to classify the
tumors based on feature extractions.

• This technique can be applied for ovarian, breast, lungs,


skin, tumors.

© 2022, IJSREM | www.ijsrem.com DOI: 10.55041/IJSREM16765 | Page 5

You might also like