Morphology

A morphology is the data representation of a neurone's anatomy. It is composed of one soma (cell body) and sections. Sections can be axons, dendrites, etc. A Morphology instance can be built from scratch (though it can be a bit tedious) but will generally be built using a JSON description.

new Morphology()
Instance Members
setId(id)
getId()
buildFromRawMorphology(rawMorphology)
getNumberOfSections()
getSection(id)
getArrayOfSections()
getSoma()
getOrphanSections(force)

A section is a list of 3D points and some metadata. A section can have one parent and multiple children when the dendrite or axone divide into mutliple dendrites and axons. A section instance can be built from scratch of it can be built using a raw object, usually from a JSON description.

constructor

To construct a section, we need a reference to the morphology instance that 'hosts' them. This may seem a bit a bit counter intuitive to have a reference in that direction but it can be very convenient, when knowing a section, to know to which morphology it belongs (i.e. raycasting a section)

constructor(morphology: Morphology)
Parameters
morphology (Morphology = null) the Morphology instance that host this section

setId

Defines the id of this seciton. Note: should probably not be used after initWithRawSection because then sections already have ids and chance to messup the id game are pretty high.

setId(id: (String | Number))
Parameters
id ((String | Number)) the id

getId

Get the id of this section

getId(): (String | Number)
Returns
(String | Number):

setTypename

Define the typename, like in the SWC spec. Must be one of:

setTypename(tn: String)
Parameters
tn (String) the typename

getTypename

Get the typename as a String

getTypename(): String
Returns
String:

setTypeValue

Defnies the typevalue, which is the integer that goes in pair with the type name. According to SWC spec. Must be one of:

  • 0, for undefined
  • 1, for soma (even though this one should be used to build a Soma instance)
  • 2, for axon
  • 3, for basal dendrite
  • 4, for apical dendrite
  • 5, for custom Note that defining the type value will automatically set the type name accordingly.
setTypeValue(tv: Number)
Parameters
tv (Number) the type value

getTypevalue

Get the type value

getTypevalue(): Number
Returns
Number:

addPoint

Add a point to this current section

addPoint(x: Number, y: Number, z: Number, r: Number)
Parameters
x (Number) the x coordinate of the point to add
y (Number) the y coordinate of the point to add
z (Number) the z coordinate of the point to add
r (Number = 1) the radius at the point to add. (default: 1)

getPoints

Get all the points of this section as an array

getPoints(): Array
Returns
Array: each element are of form [x: Number, y: Number, y: Number]

getRadiuses

Get all the radiuses of the point in this section

getRadiuses(): Array
Returns
Array:

initWithRawSection

Build a section using a raw section object.

initWithRawSection(rawSection: Object)
Parameters
rawSection (Object) usually comes from a JSON file

setParent

Define the parent section of this section, as an object reference. The only verification perfomed by this method is that a section is not added as its own parent.

setParent(section: Section): Boolean
Parameters
section (Section) the section that is the parent of this one
Returns
Boolean: true if parent was successfully defined, false if not.

getParent

Get the parent section of this section

getParent(): Section
Returns
Section: the parent

addChild

Make a given section the child of this one. Two verifications are perfomed before: ids must be diferent so that we are not allowing a section to be the child of itself, and that this section does not already have the given section as a children (=> avoid doublons)

addChild(section: Section): Boolean
Parameters
section (Section) The section to add as a child
Returns
Boolean: true if successfully added (of if already has the given child), false if the candidate cannot be a child

hasChild

Checks if a given section is already one of the children of this section

hasChild(section: Section): Boolean
Parameters
section (Section) a section to test
Returns
Boolean: true if the given section is already a child of this section, false if not.

getSize

Get the size of this section

getSize(): Number
Returns
Number:

getMorphology

Get the morphology object that contains this section

getMorphology(): Morphology
Returns
Morphology:

getChildren

Get all the children as an Array

getChildren(): Array
Returns
Array:

Soma

The soma is the cell body of a neurone and thus is sort of a simplified version of a Section, in term of datastructure. A soma can be made of a single point (then it's just a center point) or of several, then it's a more accurate description of a soma. When described with several points, the representation is usually as a 2D polygon (even though it's in a 3D space)

new Soma()
Instance Members
setId(id)
getId()
addPoint(x, y, z)
getPoints()
setRadius(r)
getRadius()
getCenter()
initWithRawSection(rawSoma)