navis.reroot_skeleton¶
- navis.reroot_skeleton(x, new_root, inplace=False)[source]¶
Reroot neuron to new root.
- Parameters:
x (TreeNeuron | NeuronList) – List must contain only a SINGLE neuron.
new_root (int | iterable) – Node ID(s) of node(s) to reroot to. If multiple new roots are provided, they will be rerooted in sequence.
inplace (bool, optional) – If True the input neuron will be rerooted in place. If False will reroot and return a copy of the original.
- Returns:
Rerooted neuron.
- Return type:
See also
reroot()
Quick access to reroot directly from TreeNeuron/List objects.
Examples
>>> import navis >>> n = navis.example_neurons(1, kind='skeleton') >>> # Reroot neuron to its soma >>> n2 = navis.reroot_skeleton(n, n.soma)