forked from Kleen-Lab/OPSCEA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getEdges.m
67 lines (52 loc) · 1.19 KB
/
getEdges.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
60
61
62
63
64
65
66
67
function [xedge, yedge, zedge] = getEdges(alphamap, XX, YY, ZZ)
%find the first row that has a nonzero
%
% Omni-planar and surface casting of epileptiform activity (OPSCEA)
%
% Dr. Jon Kleen, 2017
i=1;
allblack = 1;
while allblack==1
if size(find(alphamap(i,:)==1))>0
firstrow = i;
allblack = 0;
end
i = i+1;
end
%find the first column that has a nonzero
j=1;
allblack=1;
while allblack==1
if size(find(alphamap(:,j)==1))>0
firstcol = j;
allblack = 0;
end
j = j+1;
end
%same thing coming from the bottom
i = size(alphamap,1);
allblack = 1;
while allblack==1
if size(find(alphamap(i,:)==1))>0
lastrow = i;
allblack = 0;
end
i = i-1;
end
j=size(alphamap,2);
allblack=1;
while allblack==1
if size(find(alphamap(:,j)==1))>0
lastcol = j;
allblack = 0;
end
j = j-1;
end
% corner1 = [firstrow, firstcol];
% corner2 = [firstrow, lastcol];
% corner3 = [lastrow, firstcol];
% corner4 = [lastrow, lastcol];
xedge = ([XX(firstrow, firstcol) XX(firstrow, lastcol)]);
yedge = ([YY(firstrow, firstcol) YY(firstrow, lastcol)]);
zedge = ([ZZ(lastrow, firstcol) ZZ(firstrow, firstcol)]);
end