-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVesselExtract.m
executable file
·59 lines (54 loc) · 1.02 KB
/
VesselExtract.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
47
48
49
50
51
52
53
54
55
56
57
58
59
function bloodVessels = VesselExtract(inImg, threshold)
[r c]=size(inImg);
bloodVessels=zeros(r,c);
%Kirsch's Templates
h1=[5 -3 -3;
5 0 -3;
5 -3 -3]/15;
h2=[-3 -3 5;
-3 0 5;
-3 -3 5]/15;
h3=[-3 -3 -3;
5 0 -3;
5 5 -3]/15;
h4=[-3 5 5;
-3 0 5;
-3 -3 -3]/15;
h5=[-3 -3 -3;
-3 0 -3;
5 5 5]/15;
h6=[ 5 5 5;
-3 0 -3;
-3 -3 -3]/15;
h7=[-3 -3 -3;
-3 0 5;
-3 5 5]/15;
h8=[ 5 5 -3;
5 0 -3;
-3 -3 -3]/15;
%Spatial Filtering by Kirsch's Templates
t1=filter2(h1,inImg);
t2=filter2(h2,inImg);
t3=filter2(h3,inImg);
t4=filter2(h4,inImg);
t5=filter2(h5,inImg);
t6=filter2(h6,inImg);
t7=filter2(h7,inImg);
t8=filter2(h8,inImg);
%s=size(inImg);
%temp=zeros(1,8);
%
bV = max(t1,t2);
bV = max(bV,t3);
bV = max(bV,t4);
bV = max(bV,t5);
bV = max(bV,t6);
bV = max(bV,t7);
bV = max(bV,t8);
for i=1:r
for j=1:c
if(bV(i,j)>threshold)
bloodVessels(i,j)=bV(i,j);
end
end
end