Skip to content

funtracks.actions.add_delete_node

AddNode

AddNode(
    tracks: SolutionTracks,
    node: Node,
    attributes: dict[str, Any],
    pixels: SegMask | None = None,
)

Bases: BasicAction

Action for adding new nodes. If a segmentation should also be added, the pixels for each node should be provided. The label to set the pixels will be taken from the node id. The existing pixel values are assumed to be zero - you must explicitly update any other segmentations that were overwritten using an UpdateNodes action if you want to be able to undo the action.

Create an action to add a new node, with optional segmentation

Parameters:

Name Type Description Default
tracks Tracks

The Tracks to add the node to

required
node Node

A node id

required
attributes Attrs

Includes times, track_ids, and optionally positions

required
pixels SegMask | None

The segmentation associated with the node. Defaults to None.

None

Raises: ValueError: If time attribute is not in attributes. ValueError: If track_id is not in attributes. ValueError: If pixels is None and position is not in attributes.

inverse

inverse() -> BasicAction

Invert the action to delete nodes instead

DeleteNode

DeleteNode(
    tracks: SolutionTracks,
    node: Node,
    pixels: SegMask | None = None,
)

Bases: BasicAction

Action of deleting existing nodes If the tracks contain a segmentation, this action also constructs a reversible operation for setting involved pixels to zero

inverse

inverse() -> BasicAction

Invert this action, and provide inverse segmentation operation if given