Morphology#

A morphology is the geometry of a neuron: the branching tree of cable segments, each with a length, radius, and position in space. In braincell this is represented by braincell.Morphology, built from braincell.Branch segments.

A morphology is required only for multi-compartment Cell models. Single-compartment models have no geometry.

The pieces#

Object

Role

braincell.Branch

An immutable geometric cable segment: sample points (x, y, z, radius) and the topology connecting them. Typed subclasses tag what part of the neuron a branch is.

braincell.Morphology

The tree of branches with parent/child connectivity. The object you pass to Cell.

Typed branches#

Branches carry a type so that mechanisms can target anatomically meaningful regions (“paint sodium channels on the soma”). The built-in types are:

These map onto the standard SWC structure identifiers, so loading an SWC file assigns types automatically.

Where morphologies come from#

You almost never type coordinates by hand. Instead you load a reconstruction:

import braincell

# from a local SWC file
morpho = braincell.Morphology.from_swc("neuron.swc")

# from a Neurolucida ASC file
morpho = braincell.Morphology.from_asc("neuron.asc")

# directly from NeuroMorpho.Org (downloaded and cached)
morpho = braincell.Morphology.from_neuromorpho("cnic_001")

See File Formats & IO for the full set of readers, reader options, and validation reports.

Inspecting and visualizing#

Once loaded, a morphology can be explored and rendered:

import braincell.vis as vis

vis.plot2d(morpho)   # 2-D dendrogram / tree layout (matplotlib)
vis.plot3d(morpho)   # 3-D rendering (PyVista or Plotly)

The braincell.vis layer also provides morphometry plots (Sholl analysis, branch-order histograms, topology) — see the braincell.vis module reference.

The mutable analysis tree (braincell.morph)#

braincell.Morphology is the immutable object you simulate. For programmatic construction and analysis there is a richer, mutable tree in braincell.morph:

Use braincell.morph when you need to modify or measure a reconstruction; use Morphology when you are ready to build a cell.

See also#