Skip to content

Commit

Permalink
add function to get path to root length
Browse files Browse the repository at this point in the history
  • Loading branch information
jingpengw committed Nov 2, 2017
1 parent 8af50c0 commit 903fedf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/BranchNets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,22 @@ function get_edge_list( self::BranchNet )
edgeList
end

function get_path_to_root_length(self::BranchNet, branchIndex::Integer)
path2RootLength = 0.0
branchPathLengthList = get_branch_path_length_list( self )
while true
path2RootLength += branchPathLengthList[ branchIndex ]
parentBranchIndex = get_parent_branch_index(self, branchIndex )
if parentBranchIndex < 1
# root branch do not have parent
break
else
branchIndex = parentBranchIndex
end
end
path2RootLength
end

"""
get_branch_path_length_list(self::BranchNet)
get euclidean path length of each branch
Expand Down
5 changes: 4 additions & 1 deletion test/BranchNets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ end

println("remove subtree in soma...")
@time newBranchNet = BranchNets.remove_subtree_in_soma(branchNet)


println("get path to root length ...")
@time path2RootLength = BranchNets.get_path_to_root_length( branchNet, 5 )

println("sholl analysis ...")
@time shollNumList = BranchNets.get_sholl_number_list(branchNet, 10000 )

Expand Down

0 comments on commit 903fedf

Please sign in to comment.