- navis.stitch_skeletons(*x, method='ALL', master='SOMA', max_dist=None)¶
Stitch multiple skeletons together.
Uses minimum spanning tree to determine a way to connect all fragments while minimizing length (Euclidian distance) of the new edges. Nodes that have been stitched will get a “stitched” tag.
If duplicate node IDs are found across the fragments to stitch they will be remapped to new unique values!
x (NeuronList | list of TreeNeuron/List) – Neurons to stitch (see examples).
method ('LEAFS' | 'ALL' | 'NONE' | list of node IDs) –
- Set stitching method:
’LEAFS’: Only leaf (including root) nodes will be allowed to make new edges.
’ALL’: All nodes are considered.
’NONE’: Node and connector tables will simply be combined without generating any new edges. The resulting neuron will have multiple roots.
List of node IDs that are allowed to be used. Note that if these nodes are insufficient the resulting neuron will not be fully connected.
master ('SOMA' | 'LARGEST' | 'FIRST', optional) –
- Sets the master neuron:
’SOMA’: The largest fragment with a soma becomes the master neuron. If no neuron with soma, will pick the largest (option 2).
’LARGEST’: The largest (by number of nodes) fragment becomes the master neuron.
’FIRST’: The first fragment provided becomes the master neuron.
max_dist (float, optional) – Max distance at which to stitch nodes. This can result in a neuron with multiple roots.
- Return type:
Combines multiple neurons of the same type into one without stitching. Works on TreeNeurons, MeshNeurons and Dotprops.
Stitching neuronlist by simply combining data tables:
>>> import navis >>> nl = navis.example_neurons(2) >>> stitched = navis.stitch_skeletons(nl, method='NONE')
Stitching fragmented neurons:
>>> a = navis.example_neurons(1) >>> fragments = navis.cut_skeleton(a, 100) >>> stitched = navis.stitch_skeletons(fragments, method='LEAFS')