neurom.check.morphtree

Python module of NeuroM to check morphology trees.

Functions

back_tracking_segments(neurite)

Check if a neurite process backtracks to a previous node.

get_back_tracking_neurites(morph)

Get neurites that have back-tracks.

get_flat_neurites(morph[, tol, method])

Check if a morphology has neurites that are flat within a tolerance.

get_nonmonotonic_neurites(morph[, tol])

Get neurites that are not monotonic.

get_overlapping_point_neurites(morph[, ...])

Get neurites that have overlapping points.

has_overlapping_points(neurite[, tolerance])

Check if a neurite has at least one overlapping point.

is_back_tracking(neurite)

Check if a neurite process backtracks to a previous node.

is_flat(neurite, tol[, method])

Check if neurite is flat using the given method.

is_monotonic(neurite, tol)

Check if neurite tree is monotonic.

overlapping_points(neurite[, tolerance])

Return overlapping points of a neurite.

neurom.check.morphtree.back_tracking_segments(neurite)

Check if a neurite process backtracks to a previous node.

Back-tracking takes place when a daughter of a branching process goes back and either overlaps with a previous point, or lies inside the cylindrical volume of the latter.

Parameters:

neurite (Neurite) – neurite to operate on

Returns:

A generator of tuples containing the section ID and the two segment indices in this section for which a back tracking is detected (so the first point of these segments can be retrieved with morph.section(section_id).points[segment_id].

neurom.check.morphtree.get_back_tracking_neurites(morph)

Get neurites that have back-tracks.

A back-track is the placement of a point near a previous segment during the reconstruction, causing a zigzag jump in the morphology which can cause issues with meshing algorithms.

Parameters:

morph (Morphology) – neurite to operate on

Returns:

List of morphologies with backtracks

neurom.check.morphtree.get_flat_neurites(morph, tol=0.1, method='ratio')

Check if a morphology has neurites that are flat within a tolerance.

Parameters:
  • morph (Morphology) – morphology to operate on

  • tol (float) – the tolerance or the ratio

  • method (str) – ‘tolerance’ or ‘ratio’ described in is_flat()

Returns:

Bool list corresponding to the flatness check for each neurite in morphology neurites with respect to the given criteria

neurom.check.morphtree.get_nonmonotonic_neurites(morph, tol=1e-06)

Get neurites that are not monotonic.

Parameters:
  • morph (Morphology) – morphology to operate on

  • tol (float) – the tolerance or the ratio

Returns:

list of neurites that do not satisfy monotonicity test

neurom.check.morphtree.get_overlapping_point_neurites(morph, tolerance=0)

Get neurites that have overlapping points.

Parameters:

morph (Morphology) – neurite to operate on

Returns:

List of morphologies with backtracks

neurom.check.morphtree.has_overlapping_points(neurite, tolerance=None)

Check if a neurite has at least one overlapping point.

See overlapping_points() for more details.

Parameters:
  • neurite (Neurite) – neurite to operate on

  • tolerance (float) – the tolerance used to find overlapping points

Returns:

True if two points of the neurite are overlapping.

neurom.check.morphtree.is_back_tracking(neurite)

Check if a neurite process backtracks to a previous node.

See back_tracking_segments() for more details.

Parameters:

neurite (Neurite) – neurite to operate on

Returns:

True when;
  1. A segment endpoint falls back and overlaps with a previous segment’s point

  2. The geometry of a segment overlaps with a previous one in the section

Return type:

bool

neurom.check.morphtree.is_flat(neurite, tol, method='tolerance')

Check if neurite is flat using the given method.

Parameters:
  • neurite (Neurite) – neurite to operate on

  • tol (float) – tolerance

  • method (str) – the method of flatness estimation: ‘tolerance’ returns true if any extent of the tree is smaller than the given tolerance ‘ratio’ returns true if the ratio of the smallest directions is smaller than tol. e.g. [1,2,3] -> 1/2 < tol

Returns:

True if neurite is flat

neurom.check.morphtree.is_monotonic(neurite, tol)

Check if neurite tree is monotonic.

If each child has smaller or equal diameters from its parent

Parameters:
  • neurite (Neurite) – neurite to operate on

  • tol (float) – tolerance

Returns:

True if neurite monotonic

neurom.check.morphtree.overlapping_points(neurite, tolerance=None)

Return overlapping points of a neurite.

Parameters:
  • neurite (Neurite) – neurite to operate on

  • tolerance (float) – the tolerance used to find overlapping points

Returns:

A generator of tuples containing the IDs of the two intersecting sections and the overlapping point.