Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code for liver segmentation in matlab
#1

code for liver segmentation in matlab

%testadaptivethresh.m
clear;close all;
im1=imread('nfliver2.jpg');
bwim1=adaptivethreshold(im1,11,0.03,0);
figure,imshow(im1);
figure,imshow(bwim1);
imwrite(bwim1,'at2.jpg');
function bw=adaptivethreshold(IM,ws,C,tm)
%ADAPTIVETHRESHOLD An adaptive thresholding algorithm that seperates the
%foreground from the background with nonuniform illumination.
% bw=adaptivethreshold(IM,ws,C) outputs a binary image bw with the local
% threshold mean-C or median-C to the image IM.
% ws is the local window size.
% tm is 0 or 1, a switch between mean and median. tm=0 mean(default); tm=1 median.
%
% Contributed by Guanglei Xiong ([email protected])
% at Tsinghua University, Beijing, China.
%
% For more information, please see
% http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm

if (nargin<3)
error('You must provide the image IM, the window size ws, and C.');
elseif (nargin==3)
tm=0;
elseif (tm =0 && tm =1)
error('tm must be 0 or 1.');
end

IM=mat2gray(IM);

if tm==0
mIM=imfilter(IM,fspecial('average',ws),'replicate');
else
mIM=medfilt2(IM,[ws ws]);
end
sIM=mIM-IM-C;
bw=im2bw(sIM,0);
bw=imcomplement(bw);
Original Image After Segmentation

My modified code for testadaptivethresh.m

clear;
im=imread('nfliver7.gif');
figure,imshow(im)
bwim1=adaptivethreshold(im,300,-0.15,0);
bw=bwareaopen(bwim1,3000);
se=strel('diamond',4);
er=imerode(bw,se);
bw1=bwareaopen(er,3000);
er1=imerode(bw1,se);
bw2=bwareaopen(er1,1000);
fi=imfill(bw2,'holes');
figure,imshow(fi)

op=uint8(fi);
seg=im.*op;
figure,imshow(seg)
imwrite(seg,'sliver7.jpg');
Reply

#2
To get full information or details of code for liver segmentation in matlab please have a look on the pages

http://seminarsprojects.net/Thread-code-...#pid168559

if you again feel trouble on code for liver segmentation in matlab please reply in that page and ask specific fields in code for liver segmentation in matlab
Reply

#3
yes i want to get the matlab code. I am a phd student at Beijing institute of technology.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.