neurom.features

NeuroM, lightweight and fast.

Examples

Obtain some morphometrics

>>> ap_seg_len = features.get('segment_lengths', nrn, neurite_type=neurom.APICAL_DENDRITE)
>>> ax_sec_len = features.get('section_lengths', nrn, neurite_type=neurom.AXON)

Functions

deprecated

Issue a deprecation warning for a function.

feature

Feature decorator to automatically register the feature in the appropriate namespace.

get

Obtain a feature from a set of morphology objects.

register_neurite_feature

Register a feature to be applied to neurites.

Exceptions

NeuroMError

Base class for all NeuroM exceptions.

exception neurom.features.NeuroMError[source]

Bases: Exception

Base class for all NeuroM exceptions.

neurom.features.deprecated(fun_name=None, msg='')[source]

Issue a deprecation warning for a function.

neurom.features.feature(shape, namespace=None, name=None)[source]

Feature decorator to automatically register the feature in the appropriate namespace.

Parameters
  • shape (tuple) – the expected shape of the feature values

  • namespace (string) – a namespace (must be ‘NEURITEFEATURES’ or ‘NEURONFEATURES’)

  • name (string) – name of the feature, used to access the feature via neurom.features.get().

neurom.features.get(feature_name, obj, **kwargs)[source]

Obtain a feature from a set of morphology objects.

Parameters
  • feature (string) – feature to extract

  • obj – a neuron, population or neurite tree

  • kwargs – parameters to forward to underlying worker functions

Returns

features as a 1D, 2D or 3D numpy array.

Features:
Neurite features (neurite, neuron, neuron population):
  • diameter_power_relations:

    Calculate the diameter power relation at a bifurcation point.

    Diameter power relation is defined in https://www.ncbi.nlm.nih.gov/pubmed/18568015

    This quantity gives an indication of how far the branching is from the Rall ratio (when =1).

  • local_bifurcation_angles:

    Get a list of local bifurcation angles in a collection of neurites.

  • neurite_lengths:

    Get the path length per neurite in a collection.

  • neurite_volume_density:

    Get the volume density per neurite.

    The volume density is defined as the ratio of the neurite volume and the volume of the neurite’s enclosing convex hull

    Note

    Returns np.nan if the convex hull computation fails.

  • neurite_volumes:

    Get the volume per neurite in a collection.

  • number_of_bifurcations:

    Number of bifurcation points in a collection of neurites.

  • number_of_forking_points:

    Number of forking points in a collection of neurites.

  • number_of_neurites:

    Number of neurites in a collection of neurites.

  • number_of_sections:

    Number of sections in a collection of neurites.

  • number_of_sections_per_neurite:

    Get the number of sections per neurite in a collection of neurites.

  • number_of_segments:

    Number of sections in a collection of neurites.

  • number_of_terminations:

    Number of leaves points in a collection of neurites.

  • partition:

    Partition at bifurcation points of a collection of neurites.

  • partition_asymmetry:

    Partition asymmetry at bifurcation points of a collection of neurites.

    Variant: length is a different definition, as the absolute difference in downstream path lenghts, relative to the total neurite path length

  • partition_asymmetry_length:

    Partition asymmetry at bifurcation points of a collection of neurites.

    Variant: length is a different definition, as the absolute difference in downstream path lenghts, relative to the total neurite path length

  • partition_pairs:

    Partition pairs at bifurcation points of a collection of neurites.

    Partition pair is defined as the number of bifurcations at the two daughters of the bifurcating section

  • principal_direction_extents:

    Principal direction extent of neurites in neurons.

  • remote_bifurcation_angles:

    Get a list of remote bifurcation angles in a collection of neurites.

  • section_areas:

    Section areas in a collection of neurites.

  • section_bif_branch_orders:

    Bifurcation section branch orders in a collection of neurites.

  • section_bif_lengths:

    Bifurcation section lengths in a collection of neurites.

  • section_bif_radial_distances:

    Get the radial distances of the bifurcation sections for a collection of neurites.

  • section_branch_orders:

    Section branch orders in a collection of neurites.

  • section_end_distances:

    Section end to end distances in a collection of neurites.

  • section_lengths:

    Section lengths in a collection of neurites.

  • section_path_distances:

    Path lengths of a collection of neurites.

  • section_radial_distances:

    Section radial distances in a collection of neurites.

    The iterator_type can be used to select only terminal sections (ileaf) or only bifurcations (ibifurcation_point).

  • section_strahler_orders:

    Inter-segment opening angles in a section.

  • section_taper_rates:

    Diameter taper rates of the sections in a collection of neurites from root to tip.

    Taper rate is defined here as the linear fit along a section. It is expected to be negative for neurons.

  • section_term_branch_orders:

    Termination section branch orders in a collection of neurites.

  • section_term_lengths:

    Termination section lengths in a collection of neurites.

  • section_term_radial_distances:

    Get the radial distances of the termination sections for a collection of neurites.

  • section_tortuosity:

    Section tortuosities in a collection of neurites.

  • section_volumes:

    Section volumes in a collection of neurites.

  • segment_areas:

    Areas of the segments in a collection of neurites.

  • segment_lengths:

    Lengths of the segments in a collection of neurites.

  • segment_meander_angles:

    Inter-segment opening angles in a section.

  • segment_midpoints:

    Return a list of segment mid-points in a collection of neurites.

  • segment_path_lengths:

    Returns pathlengths between all non-root points and their root point.

  • segment_radial_distances:

    Returns the list of distances between all segment mid points and origin.

  • segment_radii:

    Arithmetic mean of the radii of the points in segments in a collection of neurites.

  • segment_taper_rates:

    Diameters taper rates of the segments in a collection of neurites.

    The taper rate is defined as the absolute radii differences divided by length of the section

  • segment_volumes:

    Volumes of the segments in a collection of neurites.

  • sibling_ratios:

    Sibling ratios at bifurcation points of a collection of neurites.

    The sibling ratio is the ratio between the diameters of the smallest and the largest child. It is a real number between 0 and 1. Method argument allows one to consider mean diameters along the child section instead of diameter of the first point.

  • terminal_path_lengths_per_neurite:

    Get the path lengths to each terminal point per neurite in a collection.

  • total_area_per_neurite:

    Surface area in a collection of neurites.

    The area is defined as the sum of the area of the sections.

  • total_length:

    Get the total length of all sections in the group of neurons or neurites.

  • total_length_per_neurite:

    Get the path length per neurite in a collection.

Neuron features (neuron, neuron population):
  • sholl_crossings:

    Calculate crossings of neurites.

    Args:

    nrn(morph): morphology on which to perform Sholl analysis radii(iterable of floats): radii for which crossings will be counted

    Returns:

    Array of same length as radii, with a count of the number of crossings for the respective radius

  • sholl_frequency:

    Perform Sholl frequency calculations on a population of neurites.

    Args:

    nrn(morph): nrn or population neurite_type(NeuriteType): which neurites to operate on step_size(float): step size between Sholl radii

    Note:

    Given a neuron, the soma center is used for the concentric circles, which range from the soma radii, and the maximum radial distance in steps of step_size. When a population is given, the concentric circles range from the smallest soma radius to the largest radial neurite distance. Finally, each segment of the neuron is tested, so a neurite that bends back on itself, and crosses the same Sholl radius will get counted as having crossed multiple times.

  • soma_radii:

    Get the radii of the somata of a population of neurons.

    Note:

    If a single neuron is passed, a single element list with the radius of its soma member is returned.

  • soma_surface_area:

    Get the surface area of a neuron’s soma.

    Note:

    The surface area is calculated by assuming the soma is spherical.

  • soma_surface_areas:

    Get the surface areas of the somata in a population of neurons.

    Note:

    The surface area is calculated by assuming the soma is spherical.

    Note:

    If a single neuron is passed, a single element list with the surface area of its soma member is returned.

  • soma_volume:

    Get the volume of a neuron’s soma.

  • soma_volumes:

    Get the volume of the somata in a population of neurons.

    Note:

    If a single neuron is passed, a single element list with the volume of its soma member is returned.

  • trunk_angles:

    Calculates the angles between all the trunks of the neuron.

    The angles are defined on the x-y plane and the trees are sorted from the y axis and anticlock-wise.

  • trunk_origin_azimuths:

    Get a list of all the trunk origin azimuths of a neuron or population.

    The azimuth is defined as Angle between x-axis and the vector defined by (initial tree point - soma center) on the x-z plane.

    The range of the azimuth angle [-pi, pi] radians

  • trunk_origin_elevations:

    Get a list of all the trunk origin elevations of a neuron or population.

    The elevation is defined as the angle between x-axis and the vector defined by (initial tree point - soma center) on the x-y half-plane.

    The range of the elevation angle [-pi/2, pi/2] radians

  • trunk_origin_radii:

    Radii of the trunk sections of neurites in a neuron.

  • trunk_section_lengths:

    List of lengths of trunk sections of neurites in a neuron.

  • trunk_vectors:

    Calculates the vectors between all the trunks of the neuron and the soma center.

neurom.features.register_neurite_feature(name, func)[source]

Register a feature to be applied to neurites.

Warning

This feature has been deprecated in 1.6.0

Parameters
  • name – name of the feature, used for access via get() function.

  • func – single parameter function of a neurite.