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

    navis.break_fragments¶

    navis.break_fragments(x, labels_only=False, min_size=None)[source]¶

    Break neuron into its connected components.

    Neurons can consists of several disconnected fragments. This function turns these fragments into separate neurons.

    Parameters:
    • x (TreeNeuron | MeshNeuron) – Fragmented neuron.

    • labels_only (bool) – If True, will only label each node/vertex by which fragment it belongs to. For TreeNeurons, this adds a “fragment” column and for MeshNeurons, it adds a .fragments property.

    • min_size (int, optional) – Fragments smaller than this (# of nodes/vertices) will be dropped. Ignored if labels_only=True.

    Return type:

    NeuronList

    See also

    navis.heal_skeleton()

    Use to heal fragmentation instead of breaking it up.

    Examples

    >>> import navis
    >>> n = navis.example_neurons(1)
    >>> # Artifically disconnect parts of the neuron
    >>> n.nodes.loc[100, 'parent_id'] = -1
    >>> # Break into fragments
    >>> frags = navis.break_fragments(n)
    >>> len(frags)
    2
    

    Back to top

    Source

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