-
Notifications
You must be signed in to change notification settings - Fork 217
Current Morphology class
The basic Morphology class is a branch with n compartments. It also has a list and dictionary of children, which are branches. Each compartment has coordinates (x
, y
, z
), diameter
, length
, area
and distance
.
The implied geometry used to calculate axial resistances is the following:
-
diameter
is the diameter in the middle of the compartment. - Truncated cones between the middle of successive compartments.
- Half-cylinders at boundaries.
This provides n+1 values for resistances, which are calculated from
diameter
andlength
. Capacitances and other surfacic quantities are directly calculated fromarea
. Coordinates are not used for the simulation, i.e., they are electrically neutral. All quantities (membrane potential and other variables) are assumed at the middle of the compartment. Note that resistances are calculated not in the Morphology class, but in the class that does the actual simulation.
Therefore this is slightly different from Neuron, which considers that a branch is a sequence of truncated cones delimiting junctions between compartments. It might be different from the standard interpretation of the SWC format.
Coordinates are used as end points, therefore only n-1 lines are plotted, except if an origin is stated, in which case there are n lines, and coordinates can be interpreted as end points of the compartments. Diameter is then the diameter of the compartment (ie the middle). When a tree is plotted, the child is plotted with origin being the end of the previous branch. In other words, children always originate from the end point of the parent branch. Therefore it plots a tree of branches, each branch being a sequence of cylinders, with diameter given by diameter
and coordinates corresponding to end points of the cylinders.
If there is a single compartment, a single point is plotted, with thickness equal to the diameter. It is assumed that this is the soma.
Therefore coordinates x
, y
, z
should thus be interpreted as the end points of the compartments, while diameter
is the diameter at the middle of compartment.
If origin is not given, then some weirdness can happen. It then plots only n-1 segments, with diameter equal to the diameter
of the previous compartment. Diameter and coordinates are not in register anymore. A possible solution is to always consider that the origin of an isolated point is zero.
distance
is meant to represent the distance between the origin (soma) and that compartment, by recursively summing the lengths of all compartments. However, currently, it actually doesn't do that (in set_distance
) but instead calculates the distance of between the end point of each compartment and the origin of the branch.
One additional issue here is that the soma has zero length, whereas its length for the calculation of distance should rather be equal to the diameter.
It is a set of compartments with identical diameters, which makes it a uniform cylinder. One can either set the total length, or the coordinates of the end point, assuming origin at zero. Coordinates are generated if necessary, with a random direction.
The soma is treated electrically as an isopotential compartment, that is, with a finite area but a zero axial resistance. In practice, I think we use a small non-zero resistance. Area is calculated from diameter based on spherical geometry. Initially, it has zero length and coordinates (i.e. it is located at the origin).
The Morphology
class also does automatic calculations, like set_distance
.
set_length
calculates lengths based on coordinates. However, it is only correct for an isolated branch
that starts at the origin. Therefore, it can be used when building branches, but not after connecting them.
set_area
calculates the area of all compartments assuming cylindrical geometry of each compartment, using
diameter
and length
.
However, this is not consistent with the calculation of axial resistances, which assumes truncated cone
geometry with midpoints.
set_coordinates
creates random coordinates from the lengths of compartments, with zero origin.
Although it is recursive, all branches start at the origin.
In summary, it seems that recursivity in these functions is misleading.
Trees are building by adding branches at the end of one branch, never at the beginning.
The coordinates of the subtree are relative before function call, and are absolute after function call.
When a branch is added, coordinates and distance
are shifted, so that the origin of the branch is
now the end point of the parent. This is done recursively.
This causes an oddness with the soma, which has zero coordinates and zero length. We might want to keep it at zero length (for the distance), but add an additional shift of one radius.
- This class was done with a tree structure originating from an isopotential soma in mind. It is problematic when the soma is modeled with several compartments.
- One cannot make a tapering cable in this way, because the first half-compartment is always a cylinder. But this is a relatively small issue.
- Junctions between two cylinders are incorrect for the calculation of the area: the area of the bigger cylinder should include the junction area. Also a small issue.
- A
Morphology
or an isolated branch is assumed to start from the origin. But when a branch is connected, coordinates are shifted. Therefore the list of coordinates of a branch is incomplete, unless the parent is known. Indeed the origin of the branch is the end point of the parent.