menus
Submodules
Classes
A widget that controls the backend components of the motile napari plugin. |
Package Contents
- class menus.MotileWidget(viewer: napari.Viewer)
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.
- solver_update
- new_run
- viewer: napari.Viewer
- edit_run_widget
- view_run_widget
- view_run(tracks: motile_plugin.data_model.SolutionTracks) → None
Populates the run viewer with the output of the provided run.
- Args:
run (MotileRun): The run to view
- edit_run(run: motile_plugin.motile.backend.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.motile.backend.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.
- relabel_segmentation(solution_nx_graph: networkx.DiGraph, segmentation: numpy.ndarray) → numpy.ndarray
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)
- solve_with_motile(run: motile_plugin.motile.backend.MotileRun) → motile_plugin.motile.backend.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.motile.backend.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.motile.backend.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