napari_track_edit.data_views.views.layers.track_points
Classes
Extended points layer that holds the track information and emits and |
Functions
|
Block the current_size signal when selecting points to avoid changing the point |
Module Contents
- napari_track_edit.data_views.views.layers.track_points.custom_select(layer: napari.layers.Points, event: napari.utils.events.Event)
Block the current_size signal when selecting points to avoid changing the point size by accident.
- class napari_track_edit.data_views.views.layers.track_points.TrackPoints(name: str, tracks_viewer: napari_track_edit.data_views.views_coordinator.tracks_viewer.TracksViewer)
Bases:
napari_track_edit.data_views.views.layers.out_of_slice_points.ZOnlyPointsExtended points layer that holds the track information and emits and responds to dynamics visualization signals
- _drag_modes
- data_updated
- property _type_string: str
- tracks_viewer
- nodes
- node_index_dict
- default_size = 5
- add(coords: list[float])
Block the current_size event before calling the ‘add’ function to avoid calling set_point_size (triggered by the current_size event) with a new point size.
- property selected_data: psygnal.containers.Selection[int]
Set of currently selected point indices.
- process_click(event: napari.utils.events.Event, value: int | None = None, side_button: int | None = None, layer: napari.layers.Points | None = None)
Select the clicked point(s)
- Parameters:
event (Event) – The mouse event
value (int | None) – The index of the clicked point, or None if no point was clicked
side_button (int | None) – the button index (4: back, 5: forward) if a mouse side button was used, or None if no side button was used.
layer (napari.layers.Points | None) – Optional, unused. The (ortho view) layer on which the click occurred, which is forwarded by default.
- set_point_size(size: int) None
Sets a new default point size.
NOTE: This function call is triggered by the current_size event, which is emitted when the user moves the ‘point size’ slider in the layer controls. However, this event is also emitted in the ‘add’ and ‘select’ functions, so we have to block the signals there to avoid increasing the point size by accident, since new or selected points are displayed at a 30% bigger size.
- _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: napari.utils.events.Event)
Calls the UserActions 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
- _map_node_colors(nodes: list[int]) numpy.ndarray
Look up an (N, 4) array of face colors, one per node.
Per node rather than per track id, so the points follow whichever feature the colormap is set to.
With no nodes (an empty tracks graph, e.g. when tracking from scratch) a single white color is returned instead of a (0, 4) array: napari’s ColorManager treats the color argument as the current color when the layer holds no data, and feeding it an empty array raises in transform_color.
- get_symbols(tracks: funtracks.data_model.Tracks, symbolmap: dict[napari_track_edit.data_views.node_type.NodeType, str]) list[str]
- update_point_outline(visible_nodes: list[int] | str) None
Update the outline color of the selected points and visibility according to display mode
- Parameters:
visible_nodes (list[int] | str) – A list of node ids, or “all”