image thumbnail

Brain Tumour

version 1.0.0 (30.1 KB) by Harshil Patel
Brain Tumor Segmentation

30 Downloads

Updated 26 Feb 2022

View License

inputim = imread('C:\Users\Admin\Desktop\IMAGES\Tomorrow\0013.jpeg');
input = imresize(inputim,[256,256]);
imshow(input,[]);
[row,col,cha] = size(input);
if cha ==3
input = rgb2gray(input);
end
preim = medfilt2(input);
imshow(preim,[]);
numofclusters = 5;
[clusteredimg,pixval,loc] = KIFCM( double(preim) , numofclusters );
imshow(clusteredimg{loc});
image = zeros(row,col);
for i = 1:256
for j = 1:256
if preim(i,j) > 50
image(i,j) = preim(i,j);
end
end
end
img1 = bwareaopen(image,200);
se = strel('disk',8);
img2 = imopen(img1,se);
img3 = bwareaopen(img2,200);
se = strel('disk',2);
img1 = imclose(img3,se);
areaval = regionprops(img2,'Area');
for ij = 1:length(areaval)
areavalue(ij) = areaval(ij).Area;
end
maxvalue = max(areavalue);
resimg = bwareaopen(img1,maxvalue);
skullremimage = zeros(row,col);
for i = 1:row
for j = 1:col
if resimg(i,j) == 1
skullremimage(i,j) = preim(i,j);
end
end
end
Thresval = max( skullremimage(:) )-30;
Threshimg = skullremimage>= Thresval;
imshow(skullremimage,[]);

Cite As

Harshil Patel (2022). Brain Tumour (https://www.mathworks.com/matlabcentral/fileexchange/107320-brain-tumour), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!