neurom.check.morphology_checks

NeuroM morphology checking functions.

Contains functions for checking validity of morphology neurites and somata.

Functions

has_all_nonzero_neurite_radii(morph[, threshold])

Check presence of neurite points with radius not above threshold.

has_all_nonzero_section_lengths(morph[, ...])

Check presence of morphology sections with length not above threshold.

has_all_nonzero_segment_lengths(morph[, ...])

Check presence of morphology segments with length not above threshold.

has_apical_dendrite(morph[, min_number, treefun])

Check if a morphology has apical dendrites.

has_axon(morph[, treefun])

Check if a morphology has an axon.

has_basal_dendrite(morph[, min_number, treefun])

Check if a morphology has basal dendrites.

has_multifurcation(morph)

Check if a section has more than 3 children.

has_no_back_tracking(morph)

Check if the morphology has sections with back-tracks.

has_no_dangling_branch(morph)

Check if the morphology has dangling neurites.

has_no_fat_ends(morph[, multiple_of_mean, ...])

Check if leaf points are too large.

has_no_flat_neurites(morph[, tol, method])

Check that a morphology has no flat neurites.

has_no_jumps(morph[, max_distance, axis])

Check if there are jumps (large movements in the axis).

has_no_narrow_neurite_section(morph, ...[, ...])

Check if the morphology has dendrites with narrow sections.

has_no_narrow_start(morph[, frac])

Check if neurites have a narrow start.

has_no_overlapping_point(morph[, tolerance])

Check if the morphology has overlapping points.

has_no_root_node_jumps(morph[, ...])

Check that the neurites have no root node jumps.

has_no_single_children(morph)

Check if the morphology has sections with only one child section.

has_nonzero_soma_radius(morph[, threshold])

Check if soma radius not above threshold.

has_unifurcation(neuron)

Check if a section has 1 child.

neurom.check.morphology_checks.has_all_nonzero_neurite_radii(morph, threshold=0.0)

Check presence of neurite points with radius not above threshold.

Parameters:
  • morph (Morphology) – the morphology to test

  • threshold (float) – value above which a radius is considered to be non-zero

Returns:

CheckResult with result including list of (section ID, point ID) pairs of zero-radius points

neurom.check.morphology_checks.has_all_nonzero_section_lengths(morph, threshold=0.0)

Check presence of morphology sections with length not above threshold.

Parameters:
  • morph (Morphology) – the morphology to test

  • threshold (float) – value above which a section length is considered to be non-zero

Returns:

CheckResult with result including list of ids of bad sections

neurom.check.morphology_checks.has_all_nonzero_segment_lengths(morph, threshold=0.0)

Check presence of morphology segments with length not above threshold.

Parameters:
  • morph (Morphology) – the morphology to test

  • threshold (float) – value above which a segment length is considered to be non-zero

Returns:

CheckResult with result including list of (section_id, segment_id) of zero length segments

neurom.check.morphology_checks.has_apical_dendrite(morph, min_number=1, treefun=<function _read_neurite_type>)

Check if a morphology has apical dendrites.

Parameters:
  • morph (Morphology) – the morphology to test

  • min_number – minimum number of apical dendrites required

  • treefun – optional function to calculate the tree type of morphology’s neurites

Returns:

CheckResult with result

neurom.check.morphology_checks.has_axon(morph, treefun=<function _read_neurite_type>)

Check if a morphology has an axon.

Parameters:
  • morph (Morphology) – The morphology object to test

  • treefun – Optional function to calculate the tree type of morphology’s neurites

Returns:

CheckResult with result

neurom.check.morphology_checks.has_basal_dendrite(morph, min_number=1, treefun=<function _read_neurite_type>)

Check if a morphology has basal dendrites.

Parameters:
  • morph (Morphology) – The morphology object to test

  • min_number – minimum number of basal dendrites required

  • treefun – Optional function to calculate the tree type of morphology’s neurites

Returns:

CheckResult with result

neurom.check.morphology_checks.has_multifurcation(morph)

Check if a section has more than 3 children.

neurom.check.morphology_checks.has_no_back_tracking(morph)

Check if the morphology has sections with back-tracks.

neurom.check.morphology_checks.has_no_dangling_branch(morph)

Check if the morphology has dangling neurites.

Are considered dangling

  • dendrites whose first point is too far from the soma center

  • axons whose first point is too far from the soma center AND from any point belonging to a dendrite

Parameters:

morph (Morphology) – the morphology to test

Returns:

CheckResult with a list of all first segments of dangling neurites

neurom.check.morphology_checks.has_no_fat_ends(morph, multiple_of_mean=2.0, final_point_count=5)

Check if leaf points are too large.

Parameters:
  • morph (Morphology) – the morphology to test

  • multiple_of_mean (float) – how many times larger the final radius

  • points (has to be compared to the mean of the final)

  • final_point_count (int) – how many points to include in the mean

Returns:

CheckResult with result list of ids of bad sections

Note

A fat end is defined as a leaf segment whose last point is larger by a factor of multiple_of_mean than the mean of the points in final_point_count

neurom.check.morphology_checks.has_no_flat_neurites(morph, tol=0.1, method='ratio')

Check that a morphology has no flat neurites.

Parameters:
Returns:

CheckResult with result

neurom.check.morphology_checks.has_no_jumps(morph, max_distance=30.0, axis='z')

Check if there are jumps (large movements in the axis).

Parameters:
  • morph (Morphology) – the morphology to test

  • max_distance (float) – value above which consecutive z-values are

  • jump (considered a)

  • axis (str) – one of x/y/z, which axis to check for jumps

Returns:

CheckResult with result list of ids of bad sections

neurom.check.morphology_checks.has_no_narrow_neurite_section(morph, neurite_filter, radius_threshold=0.05, considered_section_min_length=50)

Check if the morphology has dendrites with narrow sections.

Parameters:
  • morph (Morphology) – the morphology to test

  • neurite_filter (callable) – filter the neurites by this callable

  • radius_threshold (float) – radii below this are considered narro

  • considered_section_min_length (float) – sections with length below

  • account (this are not taken into)

Returns:

CheckResult with result. result.info contains the narrow section ids and their first point

neurom.check.morphology_checks.has_no_narrow_start(morph, frac=0.9)

Check if neurites have a narrow start.

Parameters:
  • morph (Morphology) – the morphology to test

  • frac (float) – Ratio that the second point must be smaller than the first

Returns:

CheckResult with a list of all first segments of neurites with a narrow start

neurom.check.morphology_checks.has_no_overlapping_point(morph, tolerance=None)

Check if the morphology has overlapping points.

Returns:

CheckResult with result. result.info contains a tuple with the two overlapping section ids and a list containing only the first overlapping points.

neurom.check.morphology_checks.has_no_root_node_jumps(morph, radius_multiplier=2)

Check that the neurites have no root node jumps.

Their first point not should not be further than radius_multiplier * soma radius from the soma center

neurom.check.morphology_checks.has_no_single_children(morph)

Check if the morphology has sections with only one child section.

neurom.check.morphology_checks.has_nonzero_soma_radius(morph, threshold=0.0)

Check if soma radius not above threshold.

Parameters:
  • morph (Morphology) – the morphology to test

  • threshold – value above which the soma radius is considered to be non-zero

Returns:

CheckResult with result

neurom.check.morphology_checks.has_unifurcation(neuron)

Check if a section has 1 child.