navis.drop_fluff¶
- navis.drop_fluff(x, keep_size=None, inplace=False)[source]¶
Remove small disconnected pieces of “fluff”.
By default, this function will remove all but the largest connected component from the neuron (see also keep_size) parameter. Connectors will be remapped to the closest surviving vertex/node.
- Parameters:
x (TreeNeuron | MeshNeuron | NeuronList) – The neuron to remove fluff from.
keep_size (float, optional) – Use this to set a size (in number of nodes/vertices) for small bits to keep. If keep_size < 1 it will be intepreted as fraction of total nodes/vertices.
inplace (bool, optional) – If False, pruning is performed on copy of original neuron which is then returned.
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:
Neuron(s) without fluff.
- Return type:
Neuron/List
Examples
>>> import navis >>> m = navis.example_neurons(1, kind='mesh') >>> clean = navis.drop_fluff(m, keep_size=30) >>> m.n_vertices, clean.n_vertices (6309, 6037)