-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSnakeWithTips.m
39 lines (25 loc) · 929 Bytes
/
SnakeWithTips.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function [CL] = SnakeWithTips(tip1, tip2, P, I)
%Define parameters
nPoints = 100; % Numbers of points in the contour
gamma =18; %Iteration time step
ConCrit = 2; %Convergence criteria
kappa = 100; % Weight of the image force as a whole
sigma = 14; %Smoothing for the derivative calculations in the image
alpha = 50; % Bending modulus
beta = 20;
nu = 10; %tip force
mu1 =10; %repel force
cd = 16; %cutoff distance for repel force
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Forces
%External energy from the image
Fline = external_energy(I, sigma);
%%Internal Energy
B = internal_energy(alpha, beta, gamma, nPoints);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Pold = P;
K = relax2tip_gui(Pold, tip1, tip2, kappa, Fline, gamma, B, nPoints, ConCrit, cd, mu1,I);
P = K;
CL = P;
end