# Handling Morphology Files#

A number of formats are used in neuroscience to encode neuronal morphologies obtained from experiments involving neuronal reconstructions. This page provides general information on these formats, and documents how they may be converted to NeuroML 2 for use in computational models.

## Terminology#

All formats have their own terminology that is used to refer to different parts of the cell.

In NEURON:

• a section is an unbranched contiguous cell region

• the morphology of a cell is defined by 3D points, pt3D

• for simulation, one can specify how many segments a section should be divided into, given by nseg

In NeuroML:

• segments are 3D points describing the cell morphology

• continuous, unbranched segments groups, would form a section

• the numberInternalDivisions property can be used to set the number of divisions a segment or segment group should be divided into for simulation

## Cell validity#

In general, it is usually necessary to examine NeuroML cells converted from various formats, especially experimental reconstructions, before they can be used in simulations. This is because reconstructions may not always contain all the information necessary to simulate the cell.

Two potential problems that must be checked are:

• Point of connection of dendritic branches to the soma: e.g., in Neurolucida, there is no explicit soma but usually only an outline.

• Zero length sections: NEURON can work with zero segment lengths (consecutive pt3d points being equal), but a standard mapping of this may not be supported in other simulators such as GENESIS.

An incomplete list of checks to make to ensure a valid cell is (taken from neuroConstruct):

• Only one segment should be without a parent (root)

• All segments must have sections

• All segments must have endpoints

• All segments must have unique IDs

• All segments must have unique names

• All sections must have unique names

• Segments after the first in a section must only be connected to 1 parent

• Only one segment may be spherical and must belong to the soma_group SegmentGroup

• The cell must have at least one segment

• The cell must have at least one soma section, i.e., which is in the soma_group

• The cell must have a cell name

The NeuroML validation tools will check for some of these and report errors where possible.

## Formats#

### NEURON#

There is no fixed format in NEURON for specifying morphologies. However, cells created in NEURON may be exported to NeuroML2 format using the export_to_neuroml2 method included in pyNeuroML (example).

### GENESIS#

The format for a GENESIS cell description is given here.

### CVapp (SWC files)#

The SWC format was developed to cover most of the information common between Neurolucida, NEURON, and GENESIS formats. It is used by resources such as NeuroMorpho.org.

Information on the SWC format can be found in the NeuroMorpho FAQ under the “What is SWC format” entry.

A recommended application for converting SWC into NeuroML is neuroConstruct (see below).

### Neurolucida#

The Neurolucida file format is used by MicroBrightField products to store information on neuronal reconstructions. Both binary and ASCII format files can be generated by these products. The format allows recording of various anatomical features, not only neuronal processes such as dendrites and cell bodies, but can record other micro-anatomical features of potential interest to anatomists. Not all of these features will be relevant when constructing a single cell computational model.

## Tools#

### neuroConstruct#

neuroConstruct includes functionality to interactively import GENESIS, NEURON, CVapp (SWC), Neurolucida, and older MorphML formats to NeuroML2. Please see the neuroConstruct documentation for more information.

pyNeuroML includes functionality to convert NEURON files into NeuroML using the export_to_neuroml2 method included in pyNeuroML (example).