funtracks.data_model.solution_tracks
SolutionTracks
SolutionTracks(
graph: GraphView,
time_attr: str | None = None,
pos_attr: str | tuple[str] | list[str] | None = None,
tracklet_attr: str | None = None,
lineage_attr: str | None = None,
scale: list[float] | None = None,
ndim: int | None = None,
features: FeatureDict | None = None,
_segmentation: GraphArrayView | None = None,
)
Bases: Tracks
Difference from Tracks: every node must have a track_id
Initialize a SolutionTracks object.
SolutionTracks extends Tracks to ensure every node has a track_id. A TrackAnnotator is automatically added to manage track IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
GraphView
|
Tracksdata graph with nodes as detections and edges as links. |
required |
time_attr
|
str | None
|
Graph attribute name for time. Defaults to "time" if None. |
None
|
pos_attr
|
str | tuple[str, ...] | list[str] | None
|
Graph attribute name(s) for position. Can be: - Single string for one attribute containing position array - List/tuple of strings for multi-axis (one attribute per axis) Defaults to "pos" if None. |
None
|
tracklet_attr
|
str | None
|
Graph attribute name for tracklet/track IDs. Defaults to "track_id" if None. |
None
|
lineage_attr
|
str | None
|
Graph attribute name for lineage IDs. Defaults to "lineage_id" if None. |
None
|
scale
|
list[float] | None
|
Scaling factors for each dimension (including time). If None, all dimensions scaled by 1.0. |
None
|
ndim
|
int | None
|
Number of dimensions (3 for 2D+time, 4 for 3D+time). If None, inferred from segmentation or scale. |
None
|
features
|
FeatureDict | None
|
Pre-built FeatureDict with feature definitions. If provided, time_attr/pos_attr/tracklet_attr are ignored. Assumes that all features in the dict already exist on the graph (will be activated but not recomputed). If None, core computed features (pos, area, track_id) are auto-detected by checking if they exist on the graph. |
None
|
_segmentation
|
GraphArrayView | None
|
Internal parameter for reusing an existing GraphArrayView instance. Not intended for public use. |
None
|
get_lineage_id
get_lineage_id(node) -> int | None
Get the lineage ID for a node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
The node to get lineage ID for |
required |
Returns:
| Type | Description |
|---|---|
int | None
|
The lineage ID, or None if lineage feature is not enabled |
get_next_lineage_id
get_next_lineage_id() -> int
Return the next available lineage_id.
The max_lineage_id in TrackAnnotator is updated automatically when a node is added or lineage IDs are updated via UpdateTrackIDs.
get_next_track_id
get_next_track_id() -> int
Return the next available track_id.
The max_tracklet_id in TrackAnnotator is updated automatically when a node is added or track IDs are updated via UpdateTrackIDs.
get_track_ids
get_track_ids(nodes) -> list[int]
Batch version of get_track_id — one SQL query fetching all nodes in the graph. NOTE: always fetches the entire graph internally. Optimised for bulk (all-node) calls. For small subsets or single nodes use get_track_id() instead.
get_track_neighbors
get_track_neighbors(
track_id: int, time: int
) -> tuple[Node | None, Node | None]
Get the last node with the given track id before time, and the first node with the track id after time, if any. Does not assume that a node with the given track_id and time is already in tracks, but it can be.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track_id
|
int
|
The track id to search for |
required |
time
|
int
|
The time point to find the immediate predecessor and successor for |
required |
Returns:
| Type | Description |
|---|---|
Node | None
|
tuple[Node | None, Node | None]: The last node before time with the given |
Node | None
|
track id, and the first node after time with the given track id, |
tuple[Node | None, Node | None]
|
or Nones if there are no such nodes. |
has_track_id_at_time
has_track_id_at_time(track_id: int, time: int) -> bool
Function to check if a node with given track id exists at given time point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track_id
|
int
|
The track id to search for. |
required |
time
|
int
|
The time point to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if a node with given track id exists at given time point. |