Search This Blog

Brain Tumor from MRI using MATLAB

Algorithm:-
1)
close all;
clear all;


clc;

These lines are self-explanatory.
2)Import the image→ 
img=imread('pn.jpg');

3) Convert image to binary image, based on threshold→
BW = im2bw(I,level) converts the grayscale image I to binary image BW, by replacing all pixels in the input image with luminance greater than level with the value 1 (white) and replacing all other pixels with the value 0 (black).


img=imread('pn.jpg');



4) bwlabel function study link→

https://in.mathworks.com/help/images/ref/bwlabel.html

5) regionprops function study link→

https://in.mathworks.com/help/images/ref/regionprops.html

6)The fundamental idea is detecting max intensity area identification from a binary image →

**Note**
Find command is used to find the max intensity area.

7) ismember study matrial→

https://in.mathworks.com/help/matlab/ref/ismember.html

(It will return a matrix containing logical 1 (true) where the max intensity part is found in original
iamge. Elsewhere, the array contains logical 0 (false).

8) Dilation adds pixels to the boundaries of objects in an image. For that imdilate is
used.

9)Rest is simple plotting. Hope you will get the idea & hope




%Code:-
close all;
clear all;
clc;
img=imread('pn.jpg');


bw=im2bw(img,0.7);
label=bwlabel(bw);
stats=regionprops(label,'Solidity','Area');
density=[stats.Solidity];
area=[stats.Area];
high_dense_area=density>0.5;
max_area=max(area(high_dense_area));
tumor_label=find(area==max_area);
tumor=ismember(label,tumor_label);


se=strel('square',5);
tumor=imdilate(tumor,se);
figure(2);
subplot(1,3,1);
imshow(img,[]);
title('Brain');
subplot(1,3,2);
imshow(tumor,[]);


title('Tumor Alone');
[B,L]=bwboundaries(tumor,'noholes');
subplot(1,3,3);
imshow(img,[]);
hold on
for i=1:length(B)
plot(B{i}(:,2),B{i}(:,1), 'y' ,'linewidth',1.45);
end
title('Detected Tumor');
hold off;








For more details about the project, check this link→

https://in.mathworks.com/matlabcentral/fileexchange/63792-brain-tumor-detection-from-mri-
images-using-anisotropic-filter-and-segmentation-image-processing

https://in.mathworks.com/help/images/segment-3d-brain-tumor-using-deep-learning.html

https://www.matlabcoding.com/2019/09/3d-image-segmentation-of-brain-tumors.html

5 comments:

  1. can you explain the for loop line and also the boundaries with no holes?

    ReplyDelete
  2. leader capacities help us in getting assignments, creating and having an arrangement to do responsibilities, starting and finishing the arrangement, and amending the arrangement if important. thinking skills

    ReplyDelete
  3. It has become common sense that nourishing food admission is crucial for battling cancer. https://www.drpriyatiwari.com/

    ReplyDelete
  4. There are a great deal of such organizations and all them pursue making successful website for different enterprises.
    onohosting

    ReplyDelete

MATLAB