-
Notifications
You must be signed in to change notification settings - Fork 0
/
updateE1.m
executable file
·46 lines (46 loc) · 1.75 KB
/
updateE1.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
40
41
42
43
44
45
46
function E1 = updateE1(version, infinite, dF, dB, dTF, dTB)
%function E1 = updateE1(dF, dB, infinite)
global numSegments fSeg bSeg segments;
E1 = zeros(2, numSegments);
testE1 = zeros(2, numSegments);
if(strcmp(version, 'ver0')==1 || strcmp(version, 'ver2')==1 || strcmp(version, 'ver4') ==1)
for i = 1:numSegments
if ( bSeg(i) >= 1 )%background
E1(1, i) = 0;
E1(2, i) = infinite;
elseif ( fSeg(i) == 1)%foreground
E1(1, i) = infinite;
E1(2, i) = 0;
else
E1(1, i) = dB(i) / (dF(i) + dB(i));
E1(2, i) = dF(i) / (dF(i) + dB(i));
end
end
elseif(strcmp(version, 'ver1')==1 || strcmp(version, 'ver3')==1)
for i = 1:numSegments
if ( bSeg(i) == 1 )%background
E1(1, i) = 0;
E1(2, i) = infinite;
elseif ( fSeg(i) == 1)%foreground
E1(1, i) = infinite;
E1(2, i) = 0;
else
E1(1, i) = dB(i) / (dF(i) + dB(i)) + dTB(i) / (dTF(i) + dTB(i));
E1(2, i) = dF(i) / (dF(i) + dB(i)) + dTF(i) / (dTF(i) + dTB(i));
end
end
elseif(strcmp(version, 'ver5')==1)
for i = 1:numSegments
if ( bSeg(i) == 1 )%background
E1(1, i) = 0;
E1(2, i) = infinite;
elseif ( fSeg(i) == 1)%foreground
E1(1, i) = infinite;
E1(2, i) = 0;
else
E1(1, i) = dB(i) / (dF(i) + dB(i)) + dTB(i) / (dTF(i) + dTB(i));
E1(2, i) = dF(i) / (dF(i) + dB(i)) + dTF(i) / (dTF(i) + dTB(i));
end
end
end
end