cell_to_swc

single_cell_parser.swc.cell_to_swc(cell, of, skip_myelin=False, remap_sections=None)

Write out a cell object to swc format:

index type x y z radius parent
Parameters:
cell : single_cell_parser.cell.Cell

A cell object. Must contain the sections attribute returning a generator for NEURON sections.

skip_myelin : bool

If True, myelin will not be written to the resulting .swc file.

remap_sections : dict

A dictionary mapping section indices to a custom label. Custom labels can often be re-assigned to a type of choice anyways after loading the SWC morphology. This feature is useful for temporarily remapping the label of same-type only-child sections, preserving the fact that they are different sections in SWC.

Note

The default labels recognized by SWC are: {‘Soma’: 1, “AIS”: 2, “Dendrite”: 3, “ApicalDendrite”: 4, “Myelin”: 5}

Returns:

Nested list of swc lines (index, type, x, y, z, radius, parent), organized per section.

Return type:

List[List[List]]