Skip to content

Commit

Permalink
add metric of typical radius
Browse files Browse the repository at this point in the history
  • Loading branch information
jingpengw committed Nov 2, 2017
1 parent f99fb16 commit 87f488a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/BranchNets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,20 @@ function get_mass_center( self::BranchNet )
(x,y,z)
end

"""
get_typical_radius( self::BranchNet )
Typical radius is the root-mean-square distance of dendritic arbor points to the center of mass (in nm)
"""
function get_typical_radius( self::BranchNet )
massCenter = get_mass_center( self )
nodeList = get_node_list( self )
typicalRadius = 0.0
for node in nodeList
typicalRadius += norm([massCenter...] .- [node[1:3]...]) / length(nodeList)
end
typicalRadius
end

"""
get_asymmetry( self::BranchNet )
asymmetry was measured by the euclidean distance between root node and mass center
Expand Down Expand Up @@ -773,6 +787,25 @@ function remove_hair( self::BranchNet )
return remove_branches(self, removeBranchIndexList)
end

"""
remove_terminal_blobs( self::BranchNet )
some terminal segmentation was fragmented. a lot of blobs was attatched to dendrite.
The blob terminal branch path length is normally smaller than the distance to parent dendrite.
"""
function remove_terminal_blobs( self::BranchNet )
terminalBranchIndexList = get_terminal_branch_index_list( self )
blobTerminalBranchIndexList = Vector{Int}()
for index in terminalBranchIndexList
branch = self[index]
parentBranch = self[ get_parent_branch_index(self, index) ]
branchInnerPathLength = Branches.get_path_length( branch )
distance2Parent = Branches.get_nodes_distance( branch[1], parentBranch[end] )
if distance2Parent > branchInnerPathLength
push!(blobTerminalBranchIndexList, index)
end
end
return remove_branches( self, blobTerminalBranchIndexList )
end
########################## type convertion ####################
"""
NodeNets.NodeNet( self::BranchNet )
Expand Down
3 changes: 3 additions & 0 deletions test/BranchNets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ end
println("remove subtree in soma...")
@time newBranchNet = BranchNets.remove_subtree_in_soma(branchNet)

println("get typical radius ...")
@show BranchNets.get_typical_radius( branchNet )

println("get asymmetry ...")
@show BranchNets.get_asymmetry( branchNet )

Expand Down

0 comments on commit 87f488a

Please sign in to comment.