navis.split_into_fragments¶
- navis.split_into_fragments(x, n=2, min_size=None, reroot_soma=False)[source]¶
Split neuron into fragments.
Cuts are based on longest neurites: the first cut is made where the second largest neurite merges onto the largest neurite, the second cut is made where the third largest neurite merges into either of the first fragments and so on.
- Parameters:
x (TreeNeuron | MeshNeuron | NeuronList) – Must be a single neuron.
n (int, optional) – Number of fragments to split into. Must be >1.
min_size (int | str, optional) – Minimum size of fragment to be cut off. If too small, will stop cutting. This takes only the longest path in each fragment into account! If the neuron(s), has its .units set, you can also pass this as a string such as “10 microns”.
reroot_soma (bool, optional) – If True, neuron will be rerooted to soma.
- Return type:
Examples
>>> import navis >>> x = navis.example_neurons(1) >>> # Cut into two fragments >>> cut1 = navis.split_into_fragments(x, n=2) >>> # Cut into fragments of >10 um size >>> cut2 = navis.split_into_fragments(x, n=float('inf'), min_size=10e3)