neuror.zero_diameter_fixer

Fix zero diameters.

Note

This module is a re-implementation of: https://bbpgitlab.epfl.ch/nse/morphologyrepair/MUK/-/blob/main/apps/Fix_Zero_Diameter.cpp with sections recursion instead of point recursion

Module Attributes

Point

The class used to store a point as a section and point ID in this section.

Functions

_connect_average

Apply a ramp diameter between the two points.

_connect_average_legacy

Apply a ramp diameter between the two points.

_fix_downstream

Ensure that diameters are decreasing in downstream direction.

_fix_in_between

Fix diameters between two points with valid diameters by applying a ramp.

_fix_upstream

Reset the diameter to upstream_good_diameter if the current value and all child values are below threshold.

_get_point_diameter

_next_point_upstream

Yield upstream points until reaching the root.

_set_point_diameter

Set a given diameter.

fix_neurite

Apply all fixes to a neurite.

fix_zero_diameters

Fix zero diameters.

Classes

Point

The class used to store a point as a section and point ID in this section.

class neuror.zero_diameter_fixer.Point(section, point_id)

Bases: tuple

The class used to store a point as a section and point ID in this section.

neuror.zero_diameter_fixer._fix_downstream(section)[source]

Ensure that diameters are decreasing in downstream direction.

If the current diameter is below the threshold, change its value to the biggest value among the 1-degree children downstream diameters.

This is recursive only until a diameter above threshold is found so this fixes zero diameters that are located at the beginning of the neurite.

Fixes this: Soma--0--0--0--1--1--1

But not this: Soma--1--1--1--0--0--0--1--1

Note

This is a re-implementation of recursePullFix() available at https://bbpgitlab.epfl.ch/nse/morphologyrepair/MUK/-/blob/main/muk/Zero_Diameter_Fixer.cpp#L66

Parameters:

section (morphio.Section) –

neuror.zero_diameter_fixer._fix_in_between(section, stack, legacy)[source]

Fix diameters between two points with valid diameters by applying a ramp.

Parameters:
  • point – the current points

  • stack – the stack of upstream points

  • legacy – whether to use legacy algorithm that didn’t account for path lengths

neuror.zero_diameter_fixer._fix_upstream(section, upstream_good_diameter)[source]

Reset the diameter to upstream_good_diameter if the current value and all child values are below threshold.

Note

This is a re-implementation of recursePushFix() available at https://bbpgitlab.epfl.ch/nse/morphologyrepair/MUK/-/blob/main/muk/Zero_Diameter_Fixer.cpp#L94

Parameters:
  • section – the current section

  • upstream_good_diameter – the diameter value coming from upstream that will be used if the current diameter is not suitable

Returns:

The current diameter if above threshold, else the smallest child value above threshold else (if no child value is above threshold) returns 0.

Return type:

(float)

neuror.zero_diameter_fixer.fix_neurite(root_section, legacy=False)[source]

Apply all fixes to a neurite.

neuror.zero_diameter_fixer.fix_zero_diameters(neuron, legacy=False)[source]

Fix zero diameters.