Skip to content

funtracks.actions.add_delete_node

AddNode

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

Bases: BasicAction

Action for adding new nodes. If a segmentation should also be added, the mask for the node should be provided. The label to set the mask 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
mask Mask | None

The segmentation mask 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 mask is None and position is not in attributes.

inverse

inverse() -> BasicAction

Invert the action to delete nodes instead

DeleteNode

DeleteNode(
    tracks: SolutionTracks,
    node: Node,
    mask: Mask | None = None,
)

Bases: BasicAction

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

inverse

inverse() -> BasicAction

Invert this action, and provide inverse segmentation operation if given