menus

Submodules

Classes

MotileWidget

A widget that controls the backend components of the motile napari plugin.

Package Contents

Bases: qtpy.QtWidgets.QWidget

A widget that controls the backend components of the motile napari plugin. Recieves user input about solver parameters, runs motile, and passes results to the TrackingViewController.

Populates the run viewer with the output of the provided run.

Args:

run (MotileRun): The run to view

Create or edit a new run in the run editor. Also removes solution layers from the napari viewer. Args:

run (MotileRun | None): Initialize the new run with the parameters and name

from this run. If not provided, uses the SolverParams default values.

Called when we start solving a new run. Switches from run editor to run viewer and starts solving of the new run in a separate thread to avoid blocking

Args:

run (MotileRun): Start solving this motile run.

Relabel a segmentation based on tracking results so that nodes in same track share the same id. IDs do change at division.

Args:
solution_nx_graph (nx.DiGraph): Networkx graph with the solution to use

for relabeling. Nodes not in graph will be removed from seg. Original segmentation ids and hypothesis ids have to be stored in the graph so we can map them back.

segmentation (np.ndarray): Original (potentially multi-hypothesis)

segmentation with dimensions (t,h,[z],y,x), where h is 1 for single input segmentation.

Returns:
np.ndarray: Relabeled segmentation array where nodes in same track share same

id with shape (t,1,[z],y,x)

Runs the solver and relabels the segmentation to match the solution graph. Emits: self.solver_event when the solver provides an update (will be emitted from the thread, which is why it needs to be an event and not just a normal function callback)

Args:
run (MotileRun): A run with name, parameters, and input segmentation,

but not including the output graph or segmentation.

Returns:

MotileRun: The provided run with the output graph and segmentation included.

Parse the solver event and set the run status and gap accordingly. Also emits a solver_update event to tell the run viewer to update. Note: This will simply tell the run viewer to refresh its plot and status. If the run viewer is not viewing this run, it will refresh anyways, which is pointless but not harmful.

Args:

run (MotileRun): The run that the solver is working on event_data (dict): The solver event data from ilpy.EventData

Called when the solver thread returns. Updates the run status to done and tells the run viewer to update.

Args:

run (MotileRun): The completed run

Create the title and intro paragraph widget, with links to docs

Returns:

QWidget: A widget introducing the motile plugin and linking to docs