neuralib.morpho.swc

Swc morphology plot

Example for CLI usage

python -m neuralib.morpho.swc -h

3D view with radius

  • Press Shift+s for vedo interactive saving

python -m neuralib.morpho.swc <SWC_FILE> --radius

2D view with radius

python -m neuralib.morpho.swc <SWC_FILE> --radius --2d
class neuralib.morpho.swc.SwcNode[source]

SwcNode(n, identifier, x, y, z, r, parent)

n: int

node number

identifier: int

See IDENTIFIER_DICT

x: float

position x

y: float

position y

z: float

position z

r: float

radius

parent: int

parent connectivity

property identifier_name: str
property point: ndarray
property is_undefined: bool
property is_soma: bool
property is_axon: bool
property is_basal_dendrite: bool
property is_apical_dendrite: bool
property is_dendrite: bool
property is_custom: bool
static __new__(_cls, n, identifier, x, y, z, r, parent)

Create new instance of SwcNode(n, identifier, x, y, z, r, parent)

Parameters:
  • n (int)

  • identifier (int)

  • x (float)

  • y (float)

  • z (float)

  • r (float)

  • parent (int)

class neuralib.morpho.swc.SwcFile[source]
__init__(node)[source]
Parameters:

node (list[SwcNode])

node: list[SwcNode]
classmethod load(file)[source]
Parameters:

file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – swc filepath

Returns:

SwcFile

Return type:

Self

property points: ndarray
property radii: ndarray
property parents: ndarray
property unique_identifier: list[str]
foreach_identifier(as_dict)[source]
Parameters:

as_dict (bool)

Return type:

list[Self] | dict[str, Self]

foreach_node()[source]
Return type:

Iterator[SwcNode]

foreach_line()[source]
Return type:

Iterator[tuple[SwcNode, SwcNode]]

neuralib.morpho.swc.plot_swc(swc, radius=True, color=None, as_2d=False)[source]

Plot swc file as 2d

Parameters:
  • swc (SwcFile) – SwcFile

  • radius (bool) – Plot with radius.

  • color (dict[str, str] | None) – Color dict. With {identifier name: color coded}

  • as_2d (bool)