-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindParentBranchPoint.m
More file actions
28 lines (22 loc) · 1.79 KB
/
findParentBranchPoint.m
File metadata and controls
28 lines (22 loc) · 1.79 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
function [parentBranchPoint, totalPathLength, totalPathArea, pathLengths, euclidianLengths] = findParentBranchPoint(index, parent, isBranchPoint, compartmentLength, compartmentArea,...
pathLength, branchArea, pathLengthsInsideBranch, euclidianLengthsInsideBranch, branchIdx, ...
x, y, z)
% Must initialize pathLength and branchArea with 0
% arrays pathLengthsInsideBranch and euclidianLengthsInsideBranch are
% initialized as [].
if isBranchPoint(parent(index)) || parent(index) == 1
parentBranchPoint = parent(index);
totalPathLength = pathLength + compartmentLength(index);
totalPathArea = branchArea + compartmentArea(index);
pathLengths = [pathLengthsInsideBranch; pathLength + compartmentLength(index)];
distance = getEuclidianDistance (branchIdx, parent(index), x, y, z);
euclidianLengths = [euclidianLengthsInsideBranch; distance];
else
pathLengths = [pathLengthsInsideBranch; pathLength + compartmentLength(index)];
distance = getEuclidianDistance (branchIdx, parent(index), x, y, z);
euclidianLengths = [euclidianLengthsInsideBranch; distance];
[parentBranchPoint, totalPathLength, totalPathArea, pathLengths, euclidianLengths] = findParentBranchPoint(parent(index), parent, isBranchPoint, compartmentLength, compartmentArea,...
pathLength + compartmentLength(index), branchArea + compartmentArea(index), pathLengths, euclidianLengths, branchIdx, ...
x, y, z);
end
end