neurom.check.morphtree

Python module of NeuroM to check neuronal trees.

Functions

get_back_tracking_neurites

Get neurites that have back-tracks.

get_flat_neurites

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

get_nonmonotonic_neurites

Get neurites that are not monotonic.

is_back_tracking

Check if a neurite process backtracks to a previous node.

is_flat

Check if neurite is flat using the given method.

is_monotonic

Check if neurite tree is monotonic.

class neurom.check.morphtree.COLS[source]

Bases: object

Column labels for internal data representation.

neurom.check.morphtree.get_back_tracking_neurites(neuron)[source]

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

neuron (Neuron) – neurite to operate on

Returns

List of neurons with backtracks

neurom.check.morphtree.get_flat_neurites(neuron, tol=0.1, method='ratio')[source]

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

Parameters
  • neurite (Neurite) – neurite to operate on

  • tol (float) – the tolerance or the ratio

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

Returns

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

neurom.check.morphtree.get_nonmonotonic_neurites(neuron, tol=1e-06)[source]

Get neurites that are not monotonic.

Parameters
  • neuron (Neuron) – neuron to operate on

  • tol (float) – the tolerance or the ratio

Returns

list of neurites that do not satisfy monotonicity test

neurom.check.morphtree.is_back_tracking(neurite)[source]

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

  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

True Under the following scenaria

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

Check if neurite is flat using the given method.

Parameters
  • neurite (Neurite) – neurite to operate on

  • tol (float) – tolerance

  • method (string) – 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)[source]

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.principal_direction_extent(points)[source]

Calculate the extent of a set of 3D points.

The extent is defined as the maximum distance between the projections on the principal directions of the covariance matrix of the points.

Parameter:

points : a 2D numpy array of points

Returns

the extents for each of the eigenvectors of the cov matrix eigs : eigenvalues of the covariance matrix eigv : respective eigenvectors of the covariance matrix

Return type

extents