motile_plugin.data_views
Submodules
Classes
pyqtgraph-based widget for lineage tree visualization and navigation |
|
Extended tracks layer that holds the track information and emits and responds |
|
Extended labels layer that holds the track information and emits |
|
Extended points layer that holds the track information and emits and |
|
Updates the current selection (0, 1, or 2) of nodes. Sends a signal on every update. |
|
Purposes of the TracksViewer: |
Package Contents
- class motile_plugin.data_views.TreeWidget(viewer: napari.Viewer)
Bases:
qtpy.QtWidgets.QWidget
pyqtgraph-based widget for lineage tree visualization and navigation
- track_df
- lineage_df
- graph = None
- mode = 'all'
- feature = 'tree'
- view_direction = 'vertical'
- tracks_viewer
- selected_nodes
- mode_widget
- feature_widget
- keyPressEvent(event: qtpy.QtGui.QKeyEvent) None
Handle key press events.
- delete_node()
Delete a node.
- create_edge()
Create an edge.
- delete_edge()
Delete an edge.
- undo()
Undo action.
- redo()
Redo action.
- toggle_display_mode()
Toggle display mode.
- toggle_feature_mode()
Toggle feature mode.
- set_mouse_enabled(x: bool, y: bool)
Enable or disable mouse zoom scrolling in X or Y direction.
- keyReleaseEvent(ev)
Reset the mouse scrolling when releasing the X/Y key
- _update_selected()
Called whenever the selection list is updated. Only re-computes the full graph information when the new selection is not in the lineage df (and in lineage mode)
- _update_track_data(reset_view: bool | None = None) None
Called when the TracksViewer emits the tracks_updated signal, indicating that a new set of tracks should be viewed.
- _set_mode(mode: str) None
Set the display mode to all or lineage view. Currently, linage view is always horizontal and all view is always vertical.
- Args:
mode (str): The mode to set the view to. Options are “all” or “lineage”
- _set_feature(feature: str) None
Set the feature mode to ‘tree’ or ‘area’. For this the view is always horizontal.
- Args:
feature (str): The feature to plot. Options are “tree” or “area”
- _update_lineage_df() None
Subset dataframe to include only nodes belonging to the current lineage
- class motile_plugin.data_views.TrackGraph(name: str, tracks_viewer: motile_plugin.data_views.views_coordinator.tracks_viewer.TracksViewer)
Bases:
napari.layers.Tracks
Extended tracks layer that holds the track information and emits and responds to dynamics visualization signals
- tracks_viewer
- tracks_layer_graph
- colormap = 'turbo'
- _refresh()
Refreshes the displayed tracks based on the graph in the current tracks_viewer.tracks
- update_track_visibility(visible: list[int] | str) None
Optionally show only the tracks of a current lineage
- class motile_plugin.data_views.TrackLabels(viewer: napari.Viewer, data: numpy.array, name: str, opacity: float, scale: tuple, tracks_viewer: motile_plugin.data_views.views_coordinator.tracks_viewer.TracksViewer)
Bases:
napari.layers.Labels
Extended labels layer that holds the track information and emits and responds to dynamics visualization signals
- property _type_string: str
- tracks_viewer
- node_properties
- viewer
- _get_node_properties()
- redo()
Overwrite the redo functionality of the labels layer and invoke redo action on the tracks_viewer.tracks_controller first
- undo()
Overwrite undo function and invoke undo action on the tracks_viewer.tracks_controller
- _parse_paint_event(event_val)
_summary_
- Args:
- event_val (list[tuple]): A list of paint “atoms” generated by the labels layer.
Each atom is a 3-tuple of arrays containing: - a numpy multi-index, pointing to the array elements that were changed (a tuple with len ndims) - the values corresponding to those elements before the change - the value after the change
- Returns:
- tuple(int, list[tuple]): The new value, and a list of node update actions
defined by the time point and node update item Each “action” is a 2-tuple containing: - a numpy multi-index, pointing to the array elements that were changed (a tuple with len ndims) - the value before the change
- _on_paint(event)
Listen to the paint event and check which track_ids have changed
- _refresh()
Refresh the data in the labels layer
- update_label_colormap(visible: list[int] | str) None
Updates the opacity of the label colormap to highlight the selected label and optionally hide cells not belonging to the current lineage
- new_colormap()
Extended version of existing function, to emit refresh signal to also update colors in other layers/widgets
- _check_selected_label()
Check whether the selected label is larger than the current max_track_id and if so add it to the colormap (otherwise it draws in transparent color until the refresh event)
- class motile_plugin.data_views.TrackPoints(name: str, tracks_viewer: motile_plugin.data_views.views_coordinator.tracks_viewer.TracksViewer)
Bases:
napari.layers.Points
Extended points layer that holds the track information and emits and responds to dynamics visualization signals
- property _type_string: str
- tracks_viewer
- nodes
- node_index_dict
- _refresh()
Refresh the data in the points layer
- _create_node_attrs(new_point: numpy.array) tuple[numpy.array, dict]
Create attributes for a new node at given time point
- _update_data(event)
Calls the tracks controller with to update the data in the Tracks object and dispatch the update
- _update_selection()
Replaces the list of selected_nodes with the selection provided by the user
- get_symbols(tracks: motile_plugin.data_model.Tracks, symbolmap: dict[motile_plugin.data_model.NodeType, str]) list[str]
- update_point_outline(visible: list[int] | str) None
Update the outline color of the selected points and visibility according to display mode
- Args:
visible (list[int] | str): A list of track ids, or “all”
- class motile_plugin.data_views.NodeSelectionList
Bases:
PyQt5.QtCore.QObject
Updates the current selection (0, 1, or 2) of nodes. Sends a signal on every update. Stores a list of node ids only.
- list_updated
- _list = []
- add(item, append: bool | None = False)
Append or replace an item to the list, depending on the number of items present and the keyboard modifiers used. Emit update signal
- add_list(items: list, append: bool | None = False)
Add nodes from a list and emit a single signal
- flip()
Change the order of the items in the list
- reset()
Empty list and emit update signal
- __getitem__(index)
- __len__()
- class motile_plugin.data_views.TracksViewer(viewer: napari.viewer)
Purposes of the TracksViewer: - Emit signals that all widgets should use to update selection or update
the currently displayed Tracks object
Storing the currently displayed tracks
Store shared rendering information like colormaps (or symbol maps)
- tracks_updated
- classmethod get_instance(viewer=None)
- viewer
- colormap
- symbolmap: dict[motile_plugin.data_model.NodeType, str]
- mode = 'all'
- tracks = None
- visible = None
- tracking_layers
- selected_nodes
- tracks_list
- set_keybinds()
- _refresh(node: str | None = None, refresh_view: bool = False) None
Call refresh function on napari layers and the submit signal that tracks are updated Restore the selected_nodes, if possible
- update_tracks(tracks: motile_plugin.data_model.Tracks, name: str) None
Stop viewing a previous set of tracks and replace it with a new one. Will create new segmentation and tracks layers and add them to the viewer.
- Args:
tracks (motile_plugin.core.Tracks): The tracks to visualize in napari. name (str): The name of the tracks to display in the layer names
- toggle_display_mode(event=None) None
Toggle the display mode between available options
- set_display_mode(mode: str) None
Update the display mode and call to update colormaps for points, labels, and tracks
- filter_visible_nodes() list[int]
Construct a list of track_ids that should be displayed
- update_highlights() None
If the time dimension is changed, update the highlighting in the seg layer
- update_selection() None
Sets the view and triggers visualization updates in other components
- view_external_tracks(tracks: motile_plugin.data_model.SolutionTracks, name: str) None
View tracks created externally. Assigns tracklet ids, adds a hypothesis dimension to the segmentation, and relabels the segmentation based on the assigned track ids. Then calls update_tracks.
- Args:
tracks (Tracks): A tracks object to view, created externally from the plugin name (str): The name to display in napari layers
- set_napari_view() None
Adjust the current_step of the viewer to jump to the last item of the selected_nodes list
- delete_node(event=None)
Calls the tracks controller to delete currently selected nodes
- set_split_node(event=None)
- set_endpoint_node(event=None)
- set_linear_node(event=None)
- delete_edge(event=None)
Calls the tracks controller to delete an edge between the two currently selected nodes
- create_edge(event=None)
Calls the tracks controller to add an edge between the two currently selected nodes
- undo(event=None)
- redo(event=None)