pymaid.CatmaidNeuron.prune_by_strahler

CatmaidNeuron.prune_by_strahler(to_prune: int | List[int] | slice, inplace: bool = False) TreeNeuron | None

Prune neuron based on Strahler order.

Will reroot neuron to soma if possible.

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

    Strahler indices 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(1, -1) removes everything but the highest SI

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

  • inplace (bool, optional) – If True, operation will be performed on itself. If False, operation is performed on copy which is then returned.

See also

prune_by_strahler()

This is the base function. See for details and examples.