- navis.find_main_branchpoint(x, method='betweenness', threshold=0.95, reroot_soma=False)¶
Find main branch point of unipolar (e.g. insect) neurons.
Note that this might produce garbage if the neuron is fragmented.
method ("longest_neurite" | "centrality") –
- The method to use:
”longest_neurite” assumes that the main branch point is where the two largest branches converge
”betweenness” uses centrality to determine the point which most shortest paths traverse
threshold (float [0-1]) – Sets the cutoff for method “betweenness”. Decrease threshold to be more inclusive (useful if the cell body fiber has little bristles), increase to be more stringent (i.e. when the skeleton is very clean).
reroot_soma (bool, optional) – If True, neuron will be rerooted to soma.
parallel (bool) – If True and input is NeuronList, use parallel processing. Requires pathos.
n_cores (int, optional) – Numbers of cores to use if
parallel=True. Defaults to half the available cores.
progress (bool) – Whether to show a progress bar. Overruled by
omit_failures (bool) – If True will omit failures instead of raising an exception. Ignored if input is single neuron.
branch_point – Node ID or list of node IDs of the main branch point(s).
- Return type:
int | list of int
>>> import navis >>> n = navis.example_neurons(1) >>> navis.find_main_branchpoint(n, reroot_soma=True) 110 >>> # Cut neuron into axon, dendrites and primary neurite tract: >>> # for this we need to cut twice - once at the main branch point >>> # and once at one of its childs >>> child = n.nodes[n.nodes.parent_id == 2066].node_id.values >>> split = navis.cut_skeleton(n, [2066, child]) >>> split <class 'navis.core.neuronlist.NeuronList'> of 3 neurons type n_nodes n_connectors n_branches n_leafs cable_length soma 0 TreeNeuron 2572 0 170 176 475078.177926 None 1 TreeNeuron 139 0 1 3 89983.511392  2 TreeNeuron 3656 0 63 66 648285.745750 None