# NeuroM morphology definitions¶

These are `NeuroM`

specific working definitions of various components of
neuron morpholigies.

## Point¶

A point is a vector of numbers **[X, Y, Z, R, TYPE, ID, PID]** where the components are

- X, Y, Z: Cartesian coordinates of position
- R: Radius
- TYPE: One of the
`NeuroM valid point types`

- ID: Unique identifier of the point.
- PID: ID of the parent of the point.

Typically only the first four or five components are of interest to morphology analysis. The rest are used to construct the soma and hierarchical tree structures of the neuron, and to check its semantic validity.

In `NeuroM`

a point is represented as an iterable of floating point numbers, usually
a `numpy`

array.

Note

For most of what follows, it suffices to consider a
**point** as a vector of **[X, Y, Z, R, TYPE]**. The remaining
components **ID** and **PID** can be considered book-keeping.

Todo

Point types may need to be restricted to align SWC with H5. This is dependent on future H5 specs.

## Segment¶

A segment consists of two consecutive points belonging to the same neurite and section.

In `NeuroM`

a segment is represented as a length 2 tuple or numpy array of
points<point-label>.

## Section¶

A section is a tree node containing a series of two or more points whose first and last element are any of the following combinations:

- root node, forking point
- forking point, forking point
- forking point, end point
- root node, end point

The first point of a section is a duplicate of the last point of its parent section, unless the latter is a soma section.

In `NeuroM`

, a section is represented by class `Section`

.
This pseudocode shows the relevant parts of the section class:

```
section = {
section_id,
points,
parent,
children
}
```

## Soma¶

A soma can be represented by one, three or more points. The soma is classified solely based on the number of points it contains thus:

- Type A: 1 point defining the center and radius.
- Type B: 3 points. Only the centers of the points are considered. The first point defines the center. The radius is estimated from the mean distance between the center and the two remaining points.
- Type C: More than three points. The center is defined as the mean position of all points. The radius is defined as the mean distance of all points to the center.

Todo

Expand list if and when specifications require new types of soma.

The soma is represented by classes derived from `Soma`

.
The interface exports a center and radius. These can be calculated in different
ways, but the default is to use the center and radius for type A and the mean center
and radius for types B and C.

Todo

In the future, type B may be interpreted as 3 points on an ellipse. In this case, the points would have to be non-collinear. Currently there is no such restriction.

See also

See also

## Neurite tree¶

A neurite is essentially a tree of sections. The tree structure implies the following:

- A node can only have one parent.
- A node can have an arbitrary number of children.
- No loops are present in the structure.

Neurites are represented by the class `Neurite`

, which contains
the root node of the aforementioned tree as well as some helper functions to aid iteration
over sections and collection of points.

In `NeuroM`

neurite trees are implemented using the recursive structure
`neurom.core.Section`

, described above.

## Neuron¶

A neuron structure consists of a single soma and a collection of neurites.

The trees that are expected to be present depend on the type of cell:

- Interneuron (IN): basal dendrite, axon
- Pyramidal cell (PC): basal dendrite, apical dendrite, axon

Neurons are represented by the class `Neuron`

. This is more
or less what it looks like:

```
neuron = {
soma,
neurites,
points,
name
}
```