motile_plugin.widgets.motile.motile_widget

Attributes

logger

Classes

MotileWidget

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

Module Contents

motile_plugin.widgets.motile.motile_widget.logger
class motile_plugin.widgets.motile.motile_widget.MotileWidget(viewer: napari.Viewer)

Bases: qtpy.QtWidgets.QScrollArea

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.

solver_update
view_tracks
remove_layers
viewer: napari.Viewer
tracks_viewer
edit_run_widget
view_run_widget
run_list_widget
main_layout
main_widget
view_run(run: motile_plugin.backend.motile_run.MotileRun) None

Populates the run viewer and the napari layers with the output of the provided run.

Args:

run (MotileRun): The run to view

edit_run(run: motile_plugin.backend.motile_run.MotileRun | None)

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.

_generate_tracks(run: motile_plugin.backend.motile_run.MotileRun) None

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.

solve_with_motile(run: motile_plugin.backend.motile_run.MotileRun) motile_plugin.backend.motile_run.MotileRun

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.

_on_solver_event(run: motile_plugin.backend.motile_run.MotileRun, event_data: dict) None

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

_on_solve_complete(run: motile_plugin.backend.motile_run.MotileRun) None

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

_title_widget() qtpy.QtWidgets.QWidget

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

Returns:

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