Switch to unified view

a b/Thoracic Organs Segmentation code/TwoPhaseLevel Sets/MainFunctionlevelSet.m
1
function [phi1,phi2]=TwoPhasesLevelSet(Img,phi1,phi2);
2
3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4
Img=double(Img);
5
Img = (double(Img/max(max(Img))*255));
6
sigma=0.9;                              % scale parameter in Gaussian kernel for smoothing.
7
G=fspecial('gaussian',5,sigma);
8
Img_smooth=conv2(double(Img),G,'same');  % smooth image by Gaussiin convolution
9
[Ix,Iy]=gradient(Img_smooth);
10
f=Ix.^2+Iy.^2; 
11
g=1./(1+abs(f).^1);                      % edge indicator function.
12
dt= 10;
13
mu=0.19/dt;  
14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
%Define where is the background and where is the volume
16
VolumeMask=fillingProc(2,2,Img);
17
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
18
tic 
19
[phi1,phi2]= EvolutionProcess(medfilt2(Img,[3,3]),phi1,phi2,VolumeMask,dt,16,.1,.1,6,mu,-3.5,1000,g);
20
toc
21