Professional Documents
Culture Documents
segmentationusingMatlab
Ihaveasegmentedliver.Ineedto
segmentthetumorinit.Iusedthe
FCMmethod.Itisa3levelFCM
thresholding.WhenIapplyit
AskedbyGomathiCon2Mar2012
totheimages,Ineedthe
LatestactivityCommentedonbyYASSERon6Mar2014
tumorregion(theregionthatis
darkerthantheremaining
113views(last30days)
parts)alonetogetsegmented.
Butamgettingthereverse.Alltheregionsurroundingthetumorgetssegmented.Kindlyhelpmeout.The
programhastwofiles.testfcmthresh.mandafunctionfcmthresh.m
Itriedcomplementingtheimageobtainedbyusingimcomplement()ButIgottheentirebackgroundalsoaswhite,
sincethebackgroundwasoriginallydark.Kindlyhelpmeout.
function [bw,level]=fcmthresh(IM,sw)
%FCMTHRESH Thresholding by 3-class fuzzy c-means clustering
% [bw,level]=fcmthresh(IM,sw) outputs the binary image bw and threshold level of
% image IM using a 3-class fuzzy c-means clustering. It often works better
% than Otsu's methold which outputs larger or smaller threshold on
% fluorescence images.
% sw is 0 or 1, a switch of cut-off position.
% sw=0, cut between the small and middle class
% sw=1, cut between the middle and large class
%
% Contributed by Guanglei Xiong (xgl99@mails.tsinghua.edu.cn)
% at Tsinghua University, Beijing, China.
%testfcmthresh.m
clear;clc;
im=imread('mliver3.jpg');
fim=mat2gray(im);
level=graythresh(fim);
bwfim=im2bw(fim,0.1);
[bwfim0,level0]=fcmthresh(fim,0);
[bwfim1,level1]=fcmthresh(fim,1);
subplot(2,2,1);
imshow(fim);title('Original');
subplot(2,2,2);
imshow(bwfim);title(sprintf('Otsu,level=%f',level));
subplot(2,2,3);
imshow(bwfim0);title(sprintf('FCM0,level=%f',level0));
subplot(2,2,4);
imshow(bwfim1);title(sprintf('FCM1,level=%f',level1));
% imwrite(bwfim1,'fliver6.jpg');