-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotSomatofugalPropColorByBranch.m
More file actions
64 lines (49 loc) · 2.2 KB
/
plotSomatofugalPropColorByBranch.m
File metadata and controls
64 lines (49 loc) · 2.2 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
function [group_array, cmapBranches, mapBranchToColor] = plotSomatofugalPropColorByBranch (mnProperties, parameters, metric, propName, sym, siz, showOnlyTree)
numOfSegments = mnProperties.('numOfSegments');
isBranchPoint = mnProperties.('data').('local').('isBranchPoint');
isTermination = mnProperties.('data').('local').('isTermination');
zeroOrderSegments = mnProperties.('data').('zeroOrderSegments');
stemParent = mnProperties.('data').('local').('stemParent');
branchesInTree = [];
if showOnlyTree
for i = 1:numOfSegments
if zeroOrderSegments(showOnlyTree) == stemParent(i)
if isBranchPoint(i) || isTermination(i)
branchesInTree = [branchesInTree; i];
end
end
end
end
somatofugalProp = [];
group_array = {};
x = [];
for i = 1:length(branchesInTree)
somatof = getSomatofugalProperties2 (mnProperties, parameters, metric, propName, 0, branchesInTree(i));
b = somatof.(propName);
aux = 0;
for j = 1:length(b)
aux = aux + parameters.somatofugalParams.step;
for k = 1:length(b{j})
somatofugalProp = [somatofugalProp; b{j}];
x = [x; aux]
group_array = [group_array; num2str(aux)];
end
end
end
groupCollection_array_reduced = eliminateRepetitiveStringsFromCellarray(group_array);
aux = str2num(char(groupCollection_array_reduced));
[~, sortIdx] = sort(aux);
unsorted = 1:length(aux);
newInd(sortIdx) = unsorted;
cmapBranches = jet(length(groupCollection_array_reduced));
cmapBranches = cmapBranches(newInd,:);
mapBranchToColor = zeros(length(branchesInTree), 3);
for i = 1:length(groupCollection_array_reduced)
indexes = ismember(group_array, groupCollection_array_reduced(i));
aux = find(indexes);
for j = 1:length(aux)
mapBranchToColor(aux(j),:) = cmapBranches(i,:);
end
end
plot2DScatter( x, somatofugalProp, group_array, sym, siz, cmapBranches);
end