% % Brain Tumor Detection and Segmentation from MRI
%% For getting the function anisodiff, click on this link anisodiff
% % Brain Tumor is a fatal disease which cannot be confidently detected without MRI.
% In the project, it is tried to detect whether patient’s brain has tumor or not from MRI
% image using MATLAB simulation.
% To pave the way for morphological operation on MRI image, the image was first
% filtered using Anisotropic Diffusion Filter to reduce contrast between consecutive
% pixels. After that the image was resized and utilizing a threshold value image was
% converted to a black and white image manually. This primary filter the plausible
% locations for tumor presence.
% On this semi processed image morphological operations have been applied and
% information on solidity and areas of the plausible locations was obtained. A
% minimum value of both of this characters has been determined from statistical
% average of different MRI images containing tumor. Then it was used to deliver final
% Though this simulation routine can give correct result most of the time, it fails to
% perform when tumor’s size is too small or tumor is hollow.
% The larger goal of the project is to build a data base of 2D image data of tumor from
% the MRI images taken from different angle of a particular human and by analyzing
% them to point out the exact 3D location of the tumor . To fulfill this, 2D tumor
% detection and segmentation have been developed to better accuracy so that 3D
% detection can be more reliable. This is the primary target of the project. %%%
disp('Preprocessing image please wait . . .');
Preprocessing image please wait . . .
inp = anisodiff(s,num_iter,delta_t,kappa,option);
Removing noise
Filtering Completed !!
inp=imresize(inp,[256,256]);
title('Filtered image','FontSize',20);
stats=regionprops(logical(sout),'Solidity','Area','BoundingBox');
density=[stats.Solidity];
high_dense_area=density>0.6;
max_area=max(area(high_dense_area));
tumor_label=find(area==max_area);
tumor=ismember(label,tumor_label);
title('tumor alone','FontSize',20);
h = msgbox('No Tumor!!','status');
box = stats(tumor_label);
wantedBox = box.BoundingBox;
title('Bounding Box','FontSize',20);
rectangle('Position',wantedBox,'EdgeColor','y');
rad = floor(dilationAmount);
filledImage = imfill(tumor, 'holes');
erodedImage(i,j) = min(min(filledImage(x1:x2,y1:y2)));
title('eroded image','FontSize',20);
tumorOutlineInserted(:,:,1) = red;
tumorOutlineInserted(:,:,2) = green;
tumorOutlineInserted(:,:,3) = blue;
imshow(tumorOutlineInserted);
title('Detected Tumer','FontSize',20);
subplot(231);imshow(s);title('Input image','FontSize',20);
subplot(232);imshow(inp);title('Filtered image','FontSize',20);
subplot(233);imshow(inp);title('Bounding Box','FontSize',20);
hold on;rectangle('Position',wantedBox,'EdgeColor','y');hold off;
subplot(234);imshow(tumor);title('tumor alone','FontSize',20);
subplot(235);imshow(tumorOutline);title('Tumor Outline','FontSize',20);
subplot(236);imshow(tumorOutlineInserted);title('Detected Tumor','FontSize',20);