-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTest2.m
97 lines (71 loc) · 2.66 KB
/
Test2.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
%Test2 expects two variables to be present, Verts and Links
function Test2(Verts, Links)
nmPerPixel = StructureObj.nmPerPixel;
nmPerSection = StructureObj.nmPerSection;
iID = 1;
iParentID = 2;
iX = 3;
iY = 4;
iZ = 5;
iRadius = 6;
iType = 7;
iSectionX = 8; %These are the coords in section space, used to map color
iSectionY = 9;
numPts = 6;
T = ones(numPts,3);
for(i = 1:numPts-1)
T(i,:) = [1 i+1 i+2];
end
T(numPts,:) = [1 numPts+1 2];
%Put verts in a form that the structure object can understand
%[ID ParentID X Y Z Radius TypeID SectionX SectionY]
Radius = 1;
numVerts = size(Verts,1);
Locs = zeros(numVerts, 9);
for iVert = 1:numVerts
Locs(iVert,:) = [iVert 1 Verts(iVert,:) Radius 1 0 0];
end
Locs(1,iRadius) = 3;
%Verts = [B;C;D;E;];
structObj = StructureObj(Locs,[1 0 0], 'StructObj', 1);
numLinks = size(Links, 1);
for iLink = 1:numLinks
structObj = structObj.AddLink(Links(iLink,1), Links(iLink,2), true, true);
end
structObj = structObj.EndAddLinks();
structObj = structObj.CullOverlappingLocations();
structObj = structObj.UpdateMesh();
structObj = structObj.UpdateNormals();
hFig = figure('Units', 'Pixels', ...
'OuterPosition', [0 0 1024 768], ...
'Renderer', 'OpenGL', ...
'Color', [0 0 0]);
hAxes = axes('color', [0 0 0], ...
'FontWeight', 'bold', ...
'XColor', [.5 .5 .5], ...
'YColor', [.5 .5 .5], ...
'ZColor', [.5 .5 .5], ...
'Position', [0 0 1 1]);
lightangle(0,90);
structObj.Draw(true);
set(get(hAxes,'XLabel'), 'Color', [0.5 0.5 0.5], ...
'String', 'X (nm)');
set(get(hAxes,'YLabel'), 'Color', [0.5 0.5 0.5], ...
'String', 'Y (nm)');
set(get(hAxes,'ZLabel'), 'Color', [0.5 0.5 0.5], ...
'String', 'IPL Depth (nm)');
%Set the size of the axes display
minX = min(Locs(:,iX)) * nmPerPixel;
maxX = max(Locs(:,iX)) * nmPerPixel;
minY = min(Locs(:,iY)) * nmPerPixel;
maxY = max(Locs(:,iY)) * nmPerPixel;
minZ = min(Locs(:,iZ)) * nmPerSection;
maxZ = max(Locs(:,iZ)) * nmPerSection;
maxRadius = max(Locs(:,iRadius)) * nmPerPixel * 3;
set(hAxes, 'XLim', [minX-maxRadius maxX+maxRadius]);
set(hAxes, 'YLim', [minY-maxRadius maxY+maxRadius]);
zlim = [minZ maxZ];
set(hAxes, 'ZLim', [min(zliM)-maxRadius max(zlim)+maxRadius]);
set(hAxes, 'DataAspectRatio', [1 1 1]);
end
%disp(get(p, 'VertexNormals'));