Skip to content

Commit

Permalink
fix node type assignment in reroot_neuron
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Aug 1, 2019
1 parent 204caf5 commit a93b104
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pymaid/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,15 @@ def reroot_neuron(x, new_root, inplace=False):
# Propagate changes in graph back to treenode table
x.nodes.set_index('treenode_id', inplace=True)
x.nodes.loc[path[1:], 'parent_id'] = path[:-1]
# Give the old root a new node type
if old_root_deg == 1:
x.nodes.loc[path[-1], 'type'] = 'slab'
elif old_root_deg > 1:
x.nodes.loc[path[-1], 'type'] = 'branch'
else:
x.nodes.loc[path[-1], 'type'] = 'end'
# Give the new root node type "root"
x.nodes.loc[path[0], 'type'] = 'root'
x.nodes.reset_index(drop=False, inplace=True)

# Set new root's parent to None
Expand Down

0 comments on commit a93b104

Please sign in to comment.