neurom.core.neuron

Neuron classes and functions.

Functions

graft_neuron

Returns a neuron starting at section.

iter_neurites

Iterator to a neurite, neuron or neuron population.

iter_sections

Iterator to the sections in a neurite, neuron or neuron population.

iter_segments

Return an iterator to the segments in a collection of neurites.

Classes

Neurite

Class representing a neurite tree.

Neuron

Class representing a simple neuron.

Section

Simple recursive tree class.

class neurom.core.neuron.COLS[source]

Bases: object

Column labels for internal data representation.

class neurom.core.neuron.Neurite(root_node)[source]

Bases: object

Class representing a neurite tree.

Constructor.

Parameters

root_node (morphio.Section) – root section

iter_sections(order=<function Section.ipreorder>, neurite_order=<NeuriteIter.FileOrder: 1>)[source]

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.ipreorder: 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

class neurom.core.neuron.NeuriteIter(value)[source]

Bases: neurom.utils.OrderedEnum

Neurite iteration orders.

class neurom.core.neuron.NeuriteType(value)[source]

Bases: enum.IntEnum

Type of neurite.

class neurom.core.neuron.Neuron(filename, name=None)[source]

Bases: morphio._morphio.mut.Morphology

Class representing a simple neuron.

Neuron constructor.

Parameters
  • filename (str|Path) – a filename

  • name (str) – a option neuron name

transform(trans)[source]

Return a copy of this neuron with a 3D transformation applied.

class neurom.core.neuron.Section(morphio_section)[source]

Bases: object

Simple recursive tree class.

The section constructor.

append_section(section)[source]

Appends a section to the current section object.

Parameters

section (morphio.Section|morphio.mut.Section|Section|morphio.PointLevel) – a section

ibifurcation_point(iter_mode=<function Section.ipreorder>)[source]

Iterator to bifurcation points.

Parameters

iter_mode – iteration mode. Default: ipreorder.

iforking_point(iter_mode=<function Section.ipreorder>)[source]

Iterator to forking points.

Parameters

iter_mode – iteration mode. Default: ipreorder.

ileaf()[source]

Iterator to all leaves of a tree.

ipostorder()[source]

Depth-first post-order iteration of tree nodes.

ipreorder()[source]

Depth-first pre-order iteration of tree nodes.

is_bifurcation_point()[source]

Is tree a bifurcation point?

is_forking_point()[source]

Is this section a forking point?

is_leaf()[source]

Is tree a leaf?

is_root()[source]

Is tree the root node?

iupstream()[source]

Iterate from a tree node to the root nodes.

neurom.core.neuron.graft_neuron(section)[source]

Returns a neuron starting at section.

neurom.core.neuron.iter_neurites(obj, mapfun=None, filt=None, neurite_order=<NeuriteIter.FileOrder: 1>)[source]

Iterator to a neurite, neuron or neuron population.

Applies optional neurite filter and mapping functions.

Parameters
  • obj – a neurite, neuron or neuron 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 neuron population

>>> from neurom.core.neuron import iter_neurites
>>> n_points = [n for n in iter_neurites(pop, lambda x : len(x.points))]

Get the number of points in each axon in a neuron population

>>> import neurom as nm
>>> from neurom.core.neuron 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.neuron.iter_sections(neurites, iterator_type=<function Section.ipreorder>, neurite_filter=None, neurite_order=<NeuriteIter.FileOrder: 1>)[source]

Iterator to the sections in a neurite, neuron or neuron population.

Parameters
  • neurites – neuron, 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 neuron population

>>> import neurom as nm
>>> from neurom.core.neuron 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.neuron.iter_segments(obj, neurite_filter=None, neurite_order=<NeuriteIter.FileOrder: 1>)[source]

Return an iterator to the segments in a collection of neurites.

Parameters
  • obj – neuron, 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 neuron segments. It may have a performance overhead WRT custom-made segment analysis functions that leverage numpy and section-wise iteration.

neurom.core.neuron.make_soma(morphio_soma)[source]

Make a soma object from a MorphIO soma.

Parameters

morphio_soma (morphio.Soma) – soma instance of MorphIO