Skip to content

funtracks.candidate_graph.compute_graph

compute_graph_from_points_list

compute_graph_from_points_list(
    points_list: ndarray,
    max_edge_distance: float,
    scale: list[float] | None = None,
) -> td.graph.GraphView

Construct a candidate graph from a points list.

Parameters:

Name Type Description Default
points_list ndarray

An NxD numpy array with N points and D (3 or 4) dimensions. Dimensions should be in order (t, [z], y, x).

required
max_edge_distance float

Maximum distance that objects can travel between frames. All nodes with centroids within this distance in adjacent frames will by connected with a candidate edge.

required
scale list[float] | None

Amount to scale the points in each dimension. Only needed if the provided points are in "voxel" coordinates instead of world coordinates. Defaults to None, which implies the data is isotropic.

None

Returns:

Type Description
GraphView

td.graph.GraphView: A candidate graph that can be passed to the motile solver.

compute_graph_from_seg

compute_graph_from_seg(
    segmentation: ndarray,
    max_edge_distance: float,
    iou: bool = False,
    scale: list[float] | None = None,
) -> td.graph.GraphView

Construct a candidate graph from a segmentation array. Nodes are placed at the centroid of each segmentation and edges are added for all nodes in adjacent frames within max_edge_distance.

Parameters:

Name Type Description Default
segmentation ndarray

A numpy array with integer labels and dimensions (t, [z], y, x).

required
max_edge_distance float

Maximum distance that objects can travel between frames. All nodes with centroids within this distance in adjacent frames will by connected with a candidate edge.

required
iou bool

Whether to include IOU on the candidate graph. Defaults to False.

False
scale list[float] | None

The scale of the segmentation data. Will be used to rescale the point locations and attribute computations. Defaults to None, which implies the data is isotropic.

None

Returns:

Type Description
GraphView

td.graph.GraphView: A candidate graph that can be passed to the motile solver