neurom.core.morphology¶
Morphology classes and functions.
Functions
|
Returns a morphology starting at section. |
|
Deprecated in favor of |
|
Iterator to a neurite, morphology or morphology population. |
|
Iterator to the sections in a neurite, morphology or morphology population. |
|
Return an iterator to the segments in a collection of neurites. |
Classes
|
Class representing a simple morphology. |
|
Class representing a neurite tree. |
|
Deprecated |
|
Simple recursive tree class. |
- class neurom.core.morphology.Morphology(filename, name=None)¶
Class representing a simple morphology.
Morphology constructor.
- Parameters:
filename (str|Path) – a filename
name (str) – a option morphology name
- property neurites¶
The list of neurites.
- property points¶
Returns the list of points.
- property sections¶
The array of all sections, excluding the soma.
- property soma¶
Corresponding soma.
- transform(trans)¶
Return a copy of this morphology with a 3D transformation applied.
- class neurom.core.morphology.Neurite(root_node)¶
Class representing a neurite tree.
Constructor.
- Parameters:
root_node (morphio.Section) – root section
- property area¶
Return the surface area of this neurite.
The area is defined as the sum of area of the sections.
- iter_sections(order=<function Section.ipreorder>, neurite_order=NeuriteIter.FileOrder)¶
Iteration over section nodes.
- Parameters:
order – section iteration order within a given neurite. Must be one of: Section.ipreorder: Depth-first pre-order iteration of tree nodes Section.ipostorder: Depth-first post-order iteration of tree nodes Section.iupstream: Iterate from a tree node to the root nodes Section.ibifurcation_point: Iterator to bifurcation points Section.ileaf: Iterator to all leaves of a tree
neurite_order – order upon which neurites should be iterated. Values: - NeuriteIter.FileOrder: order of appearance in the file - NeuriteIter.NRN: NRN simulator order: soma -> axon -> basal -> apical
- property length¶
Returns the total length of this neurite.
The length is defined as the sum of lengths of the sections.
- property points¶
Array with all the points in this neurite.
Note: Duplicate points at section bifurcations are removed
- property root_node¶
The first section of the neurite.
- property type¶
The type of the root node.
- property volume¶
Return the volume of this neurite.
The volume is defined as the sum of volumes of the sections.
- class neurom.core.morphology.Neuron(filename, name=None)¶
Deprecated
Neuron
class. UseMorphology
instead.Dont use me.
- class neurom.core.morphology.Section(morphio_section)¶
Simple recursive tree class.
The section constructor.
- append_section(section)¶
Appends a section to the current section object.
- Parameters:
section (morphio.Section|morphio.mut.Section|Section|morphio.PointLevel) – a section
- property area¶
Return the surface area of this section.
The area is calculated from the segments, as defined by this section’s points
- property children¶
Returns a list of child section.
- ibifurcation_point(iter_mode=<function Section.ipreorder>)¶
Iterator to bifurcation points.
- Parameters:
iter_mode – iteration mode. Default: ipreorder.
- property id¶
Returns the section ID.
- iforking_point(iter_mode=<function Section.ipreorder>)¶
Iterator to forking points.
- Parameters:
iter_mode – iteration mode. Default: ipreorder.
- ileaf()¶
Iterator to all leaves of a tree.
- ipostorder()¶
Depth-first post-order iteration of tree nodes.
- ipreorder()¶
Depth-first pre-order iteration of tree nodes.
- is_bifurcation_point()¶
Is tree a bifurcation point?
- is_forking_point()¶
Is this section a forking point?
- is_leaf()¶
Is tree a leaf?
- is_root()¶
Is tree the root node?
- iupstream()¶
Iterate from a tree node to the root nodes.
- property length¶
Return the path length of this section.
- property parent¶
Returns the parent section if non root section else None.
- property points¶
Returns the section list of points the NeuroM way (points + radius).
- property type¶
Returns the section type.
- property volume¶
Return the volume of this section.
The volume is calculated from the segments, as defined by this section’s points
- neurom.core.morphology.graft_morphology(section)¶
Returns a morphology starting at section.
- neurom.core.morphology.graft_neuron(section)¶
Deprecated in favor of
graft_morphology
.
- neurom.core.morphology.iter_neurites(obj, mapfun=None, filt=None, neurite_order=NeuriteIter.FileOrder)¶
Iterator to a neurite, morphology or morphology population.
Applies optional neurite filter and mapping functions.
- Parameters:
obj – a neurite, morphology or morphology population.
mapfun – optional neurite mapping function.
filt – optional neurite filter function.
neurite_order (NeuriteIter) – order upon which neurites should be iterated - NeuriteIter.FileOrder: order of appearance in the file - NeuriteIter.NRN: NRN simulator order: soma -> axon -> basal -> apical
Examples
Get the number of points in each neurite in a morphology population
>>> from neurom.core.morphology import iter_neurites >>> from neurom import load_morphologies >>> pop = load_morphologies('path/to/morphologies') >>> n_points = [n for n in iter_neurites(pop, lambda x : len(x.points))]
Get the number of points in each axon in a morphology population
>>> import neurom as nm >>> from neurom.core.morphology import iter_neurites >>> filter = lambda n : n.type == nm.AXON >>> mapping = lambda n : len(n.points) >>> n_points = [n for n in iter_neurites(pop, mapping, filter)]
- neurom.core.morphology.iter_sections(neurites, iterator_type=<function Section.ipreorder>, neurite_filter=None, neurite_order=NeuriteIter.FileOrder)¶
Iterator to the sections in a neurite, morphology or morphology population.
- Parameters:
neurites – morphology, population, neurite, or iterable containing neurite objects
iterator_type – section iteration order within a given neurite. Must be one of: Section.ipreorder: Depth-first pre-order iteration of tree nodes Section.ipostorder: Depth-first post-order iteration of tree nodes Section.iupstream: Iterate from a tree node to the root nodes Section.ibifurcation_point: Iterator to bifurcation points Section.ileaf: Iterator to all leaves of a tree
neurite_filter – optional top level filter on properties of neurite neurite objects.
neurite_order (NeuriteIter) – order upon which neurites should be iterated - NeuriteIter.FileOrder: order of appearance in the file - NeuriteIter.NRN: NRN simulator order: soma -> axon -> basal -> apical
Examples
Get the number of points in each section of all the axons in a morphology population
>>> import neurom as nm >>> from neurom.core.morphology import iter_sections >>> filter = lambda n : n.type == nm.AXON >>> n_points = [len(s.points) for s in iter_sections(pop, neurite_filter=filter)]
- neurom.core.morphology.iter_segments(obj, neurite_filter=None, neurite_order=NeuriteIter.FileOrder)¶
Return an iterator to the segments in a collection of neurites.
- Parameters:
obj – morphology, population, neurite, section, or iterable containing neurite objects
neurite_filter – optional top level filter on properties of neurite neurite objects
neurite_order – order upon which neurite should be iterated. Values: - NeuriteIter.FileOrder: order of appearance in the file - NeuriteIter.NRN: NRN simulator order: soma -> axon -> basal -> apical
Note
This is a convenience function provided for generic access to morphology segments. It may have a performance overhead WRT custom-made segment analysis functions that leverage numpy and section-wise iteration.