-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvertSkelToGraph.m
More file actions
38 lines (27 loc) · 1.13 KB
/
convertSkelToGraph.m
File metadata and controls
38 lines (27 loc) · 1.13 KB
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
function [nodeF,linkF] = convertSkelToGraph(skel, THR)
%THR is a link length threshold
%addpath('C:\Users\Avik Mondal\Documents\Carlson Lab\Bone Project MATLAB code\phi-max-skel2graph3d-matlab-8939088');
addpath('phi-max-skel2graph3d-matlab-8939088');
w = size(skel,1);
l = size(skel,2);
h = size(skel,3);
% initial step: condense, convert to voxels and back, detect cells
[~,node,link] = Skel2Graph3D(skel, THR);
% total length of network
wl = sum(cellfun('length',{node.links}));
skel2 = Graph2Skel3D(node,link,w,l,h);
[~,node2,link2] = Skel2Graph3D(skel2,THR);
% calculate new total length of network
wl_new = sum(cellfun('length',{node2.links}));
% iterate the same steps until network length changed by less than 0.5%
while(wl_new~=wl)
wl = wl_new;
skel2 = Graph2Skel3D(node2,link2,w,l,h);
[~,node2,link2] = Skel2Graph3D(skel2,THR);
wl_new = sum(cellfun('length',{node2.links}));
end
nodeF = node2;
linkF = link2;
%uses skel as parameter because it just needs the skeleton's dimensions
%linkF = findBranchLength(link2,skel);
%branch length is most probably unnecessary (7_6_17)