-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetBranchProperties.m
More file actions
72 lines (38 loc) · 2.65 KB
/
getBranchProperties.m
File metadata and controls
72 lines (38 loc) · 2.65 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
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
function [branchProperties, branchIndexes] = getBranchProperties (properties, parameters, segmentsFromUnbranchedSubTrees)
id = properties.('data').('local').('id');
isBranchPoint = properties.('data').('local').('isBranchPoint');
isTermination = properties.('data').('local').('isTermination');
stemParent = properties.('data').('local').('stemParent');
% Eliminating segments from unbranched trees and NaN values
% (considering only morphological props to eliminate, for now)
localPropNames = parameters.('featureNames').('local').('morphological');
segmentsWithNaNorInf = zeros(length(id), 1);
for j = 1:length(localPropNames)
name = char(localPropNames(j));
if strcmp(name, 'id') || strcmp(name, 'parent') || strcmp(name, 'type') ||...
strcmp(name, 'radius') || strcmp(name, 'proximal_position_x') || strcmp(name, 'proximal_position_y') || strcmp(name, 'proximal_position_z') ||...
strcmp(name, 'segment_length') || strcmp(name, 'area') || strcmp(name, 'isBranchPoint') || strcmp(name, 'isTermination')
continue;
end
prop = properties.('data').('local').(name);
% segmentsWithNaNorInf = or(segmentsWithNaNorInf, isnan(prop));
segmentsWithNaNorInf = or(segmentsWithNaNorInf, isinf(prop));
end
localIndexesOfBranches = and ( or(isBranchPoint, isTermination) , not(segmentsFromUnbranchedSubTrees));
localIndexesOfBranches = and ( localIndexesOfBranches , not(segmentsWithNaNorInf));
branchIndexes = id(localIndexesOfBranches);
branchProperties.('isBranchPoint') = isBranchPoint(branchIndexes);
branchProperties.('isTermination') = isTermination(branchIndexes);
branchProperties.('stemParent') = stemParent(branchIndexes);
localPropNames = parameters.('featureNames').('local').('mixed');
for j = 1:length(localPropNames)
name = char(localPropNames(j));
if strcmp(name, 'id') || strcmp(name, 'parent') || strcmp(name, 'type')||...
strcmp(name, 'radius') || strcmp(name, 'proximal_position_x') || strcmp(name, 'proximal_position_y') || strcmp(name, 'proximal_position_z') ||...
strcmp(name, 'segment_length') || strcmp(name, 'area') || strcmp(name, 'isBranchPoint') || strcmp(name, 'isTermination')
continue;
end
prop = properties.('data').('local').(name);
branchProperties.(name) = prop(branchIndexes,:);
end
end