Skip to content

webknossos.skeleton.node

Node

A node in a skeleton tree representing a point in 3D space with additional metadata.

The Node class represents individual points in a skeleton annotation. Each node has a 3D position and can contain additional metadata such as comments, radius, rotation, and viewport information. Nodes are typically created and managed through Tree instances rather than directly.

Attributes:

  • position (Vec3Int) –

    3D coordinates of the node as (x, y, z).

  • comment (Optional[str]) –

    Optional text annotation for the node.

  • radius (Optional[float]) –

    Optional radius value, useful for representing varying thicknesses.

  • rotation (Optional[Vec3Float]) –

    Optional 3D rotation as (x, y, z) in radians.

  • inVp (Optional[int]) –

    Optional viewport number where the node was created.

  • inMag (Optional[int]) –

    Optional magnification level at which the node was created.

  • bitDepth (Optional[int]) –

    Optional bit depth of the data at node creation.

  • interpolation (Optional[bool]) –

    Optional flag indicating if the node was created through interpolation.

  • time (Optional[int]) –

    Optional timestamp for node creation.

  • is_branchpoint (bool) –

    Boolean indicating if this node is a branching point.

  • branchpoint_time (Optional[int]) –

    Optional timestamp when the node was marked as a branchpoint.

Notes

Nodes should typically be created using Tree.add_node() rather than instantiated directly. This ensures proper integration with the skeleton structure.

Examples:

# Create a skeleton and tree
skeleton = Skeleton(name="example")
tree = skeleton.add_tree("dendrite")

# Add nodes and connect them
node1 = tree.add_node(position=(0, 0, 0), comment="soma")
node2 = tree.add_node(position=(100, 0, 0), radius=1.5)
tree.add_edge(node1, node2)

# Mark as branchpoint if needed
node1.is_branchpoint = True

bitDepth class-attribute instance-attribute

bitDepth: Optional[int] = None

branchpoint_time class-attribute instance-attribute

branchpoint_time: Optional[int] = None

comment class-attribute instance-attribute

comment: Optional[str] = None

id property

id: int

inMag class-attribute instance-attribute

inMag: Optional[int] = None

inVp class-attribute instance-attribute

inVp: Optional[int] = None

interpolation class-attribute instance-attribute

interpolation: Optional[bool] = None

is_branchpoint class-attribute instance-attribute

is_branchpoint: bool = False

position instance-attribute

position: Vec3Int

radius class-attribute instance-attribute

radius: Optional[float] = None

rotation class-attribute instance-attribute

rotation: Optional[Vec3Float] = None

time class-attribute instance-attribute

time: Optional[int] = None