SWC#

class swick.SWC(nodes: dict[int, swick.node.Node])#

Bases: object

A representation of the .swc file, which contains a mapping from node IDs to Node objects.

Parameters:

nodes – a dict mapping IDs to the Nodes belonging to this SWC

condense_node_ids()#

Modifies the IDs of the Nodes contained by this SWC such that they form a contiguous series of natural numbers beginning at 1. The order of node IDs will not change, i.e. a node ID that is greater than another given node ID before this operation will still be greater afterwards.

total_length()#

Calculates and returns the sum of the Euclidean distances between each pair of connected nodes in this SWC.

Returns:

the sum of the distances between each pair of connected nodes in this SWC