backend.solve

Attributes

logger

Functions

solve(→ networkx.DiGraph)

Get a tracking solution for the given segmentation and parameters.

construct_solver(→ motile.Solver)

Construct a motile solver with the parameters specified in the solver

Module Contents

backend.solve.logger
backend.solve.solve(solver_params: backend.solver_params.SolverParams, input_data: numpy.ndarray, on_solver_update: collections.abc.Callable | None = None, scale: list | None = None) networkx.DiGraph

Get a tracking solution for the given segmentation and parameters.

Constructs a candidate graph from the segmentation, a solver from the parameters, and then runs solving and returns a networkx graph with the solution. Most of this functionality is implemented in the motile toolbox.

Args:
solver_params (SolverParams): The solver parameters to use when

initializing the solver

input_data (np.ndarray): The input segmentation or points list to run

tracking on. If 2D, assumed to be a list of points, otherwise a segmentation.

on_solver_update (Callable, optional): A function that is called

whenever the motile solver emits an event. The function should take a dictionary of event data, and can be used to track progress of the solver. Defaults to None.

Returns:
nx.DiGraph: A solution graph where the ids of the nodes correspond to

the time and ids of the passed in segmentation labels. See the motile_toolbox for exact implementation details.

backend.solve.construct_solver(cand_graph: networkx.DiGraph, solver_params: backend.solver_params.SolverParams) motile.Solver

Construct a motile solver with the parameters specified in the solver params object.

Args:

cand_graph (nx.DiGraph): The candidate graph to use in the solver solver_params (SolverParams): The costs and constraints to use in

the solver

Returns:
Solver: A motile solver with the specified graph, costs, and

constraints.