navis 1.4.0
  • Install
  • Quickstart
  • Tutorials
  • API
  • Changelog
  • Github
  • Ecosystem
  • Site
    • Page
        • navis.prune_by_strahler
          • prune_by_strahler()

    navis.prune_by_strahler¶

    navis.prune_by_strahler(x, to_prune, inplace=False, reroot_soma=True, force_strahler_update=False, relocate_connectors=False)[source]¶

    Prune neuron based on Strahler order.

    Parameters:
    • x (TreeNeuron | MeshNeuron | NeuronList) – Neuron(s) to prune.

    • to_prune (int | list | range | slice) –

      Strahler indices (SI) to prune. For example:
      1. to_prune=1 removes all leaf branches

      2. to_prune=[1, 2] removes SI 1 and 2

      3. to_prune=range(1, 4) removes SI 1, 2 and 3

      4. to_prune=slice(0, -1) removes everything but the highest SI

      5. to_prune=slice(-1, None) removes only the highest SI

    • reroot_soma (bool, optional) – If True, neuron will be rerooted to its soma.

    • inplace (bool, optional) – If False, pruning is performed on copy of original neuron which is then returned.

    • force_strahler_update (bool, optional) – If True, will force update of Strahler order even if already exists in node table.

    • relocate_connectors (bool, optional) – If True, connectors on removed nodes will be reconnected to the closest still existing node. Works only in child->parent direction.

    • 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 navis.set_pbars.

    • omit_failures (bool) – If True will omit failures instead of raising an exception. Ignored if input is single neuron.

    Returns:

    Pruned neuron(s).

    Return type:

    TreeNeuron/List

    Examples

    >>> import navis
    >>> n = navis.example_neurons(1)
    >>> n_pr = navis.prune_by_strahler(n, to_prune=1, inplace=False)
    >>> n.n_nodes > n_pr.n_nodes
    True
    

    Back to top

    Source

    © Copyright 2018, Philipp Schlegel.
    Created using Sphinx 5.3.0.