How to do the segmentation of CT Brain image using watershed to identify ischemic stroke?
5 views (last 30 days)
Show older comments
I am trying to segment the folowing Ct image using Watershed methode. I need advice how to enhance the segmentation. I added the dicom image and the code. I tried to solve the oversegmentation by using the imhmin. Can you help please?
clear all;
close all;
url = dicomread('C:\Users\Mohammed Ajam\Desktop\CT Images for Matlab\CT01163NO.dcm');
URL=im2double(url);
IG=mat2gray(URL);
figure,imshow(IG,[]);
IH=imhist(IG);
figure,plot(IH);title('Hisotogram');
HistEquImg=histeq(IG);
figure,imshow(HistEquImg,[]);title('Image HistoEqualized');
IH=imhist(HistEquImg);
figure,plot(IH);title('Hisotogram of Image HistoEqualized');
level1=graythresh(HistEquImg);
bw1=im2bw(HistEquImg,level1);
%bw1 = HistEquImg>graythresh(HistEquImg);
figure,imshow(bw1,[]);title('HistEquImg Thresholded Image');
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(double(HistEquImg), hy, 'replicate');
Ix = imfilter(double(HistEquImg), hx, 'replicate');
gradmag = sqrt(Ix.^2 + Iy.^2);
figure, imshow(gradmag,[]), title('Gradient magnitude (gradmag)')
figure,plot(imhist(gradmag));
L = watershed(gradmag);
figure, imshow(L,[]), title('Watershed transform of gradient magnitude');
%%%%Opening by reconstruction %%%%%%%%
Se=strel('disk',3);
imgEroded=imerode(HistEquImg,Se);
figure,imshow(imgEroded);title('Image Eroded');
imgRecon=imreconstruct(imgEroded,HistEquImg);
% imgReconComp=imcomplement(imgRecon);
figure,imshow(imgRecon);title('Image Eroded Reconstructed');
Iobr=imgRecon;
Iobrd = imdilate(Iobr,Se);
Iobrcbr = imreconstruct(imcomplement(Iobrd), imcomplement(Iobr));
Iobrcbr = imcomplement(Iobrcbr);
figure, imshow(Iobrcbr,[]), title('Opening-closing by reconstruction (Iobrcbr)');
t=imhist(Iobrcbr);
figure,plot(t);
title('Histogram of Iobrcbr');
fgm=imregionalmax(Iobrcbr);
figure, imshow(fgm), title('Regional maxima of opening-closing by reconstruction (fgm)')
I2 =HistEquImg;
I2(fgm) = 1;
figure, imshow(I2,[]), title('Regional maxima superimposed on original image (I2)');
bw= Iobrcbr>0.368;
figure,imshow(bw,[]);title('Iobrcbr Thresholded Image');
D=bwdist(bw);
DL=watershed(D);
figure,imshow(DL,[]);title('Watershed of Distance DL');
%Background Marker
bgm=DL==0;
bw(bgm)=0;
figure,imshow(bgm,[]);title('Watershed ridge lines (bgm) superimposed on bw');
mask0=imhmin(gradmag,0.32);
Ld0 = watershed(mask0);
figure,imshow(Ld0,[]);title('Watershed of Imhmin');
HistEquImg(~Ld0)=1;
figure,imshow(HistEquImg,[]);title('Watershed superimposed on IG');
0 Comments
Answers (0)
See Also
Categories
Find more on Biomedical Imaging in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!