napari_track_edit.application_menus.feature_widget
Classes
Pick the image layers to measure mean intensity in. |
|
Widget to enable/disable RegionProps features. |
Module Contents
- class napari_track_edit.application_menus.feature_widget.IntensityLayerDialog(layers: list[napari.layers.Image], selected: list[napari.layers.Image] | None = None, parent: qtpy.QtWidgets.QWidget | None = None)
Bases:
qtpy.QtWidgets.QDialogPick the image layers to measure mean intensity in.
- Parameters:
layers – The eligible image layers, in viewer order.
selected – The layers to tick. None ticks all of them, which is the default for a first-time choice.
parent – The widget the dialog belongs to.
- _checkboxes: list[tuple[napari.layers.Image, qtpy.QtWidgets.QCheckBox]] = []
- property selected_layers: list[napari.layers.Image]
The ticked layers, in viewer order.
- class napari_track_edit.application_menus.feature_widget.FeatureWidget(viewer: napari.Viewer)
Bases:
qtpy.QtWidgets.QWidgetWidget to enable/disable RegionProps features.
Mean intensity needs pixel values, so it has one checkbox for the feature plus a refresh button that opens a dialog to choose which image layers to measure. The chosen layers’ data is handed to the tracks, which holds it (lazily) for as long as the feature is enabled, so the choice survives a rename. Renaming a measured layer renames its column, and removing one drops its measurement.
- viewer
- tracks_viewer
- _checkboxes: dict[str, qtpy.QtWidgets.QCheckBox]
- intensity_checkbox: qtpy.QtWidgets.QCheckBox | None = None
- _intensity_layers: list[napari.layers.Image] = []
- _name_connected: set[napari.layers.Image]
- _tracks = None
- _toggling = False
- label
- box
- checkbox_layout
- layout
- _update_checkboxes()
Update the list of available checkboxes.
- _intensity_row() → qtpy.QtWidgets.QWidget
The mean intensity checkbox, with a button to change the layers measured.
- _clear_layout() → None
Remove all checkboxes from the layout
- _discover_features() → dict[str, funtracks.features._feature.Feature]
Find all features available for the current tracks.
Excludes position (always computed) and intensity (which has its own row, since it also needs the layers to measure).
- _on_toggled(feature_key: str, checked: bool) → None
Enable/disable features on tracks
- Parameters:
feature_key (str) – the feature the enable/disable
checked (bool) – whether to enable (True) or disable (False)
- _on_intensity_toggled(checked: bool) → None
Turn mean intensity on (for the chosen layers) or off.
The layers are asked for the first time the feature is switched on; after that the choice is reused, and changed with the update button.
- Parameters:
checked (bool) – whether to enable (True) or disable (False)
- _disable_intensity() → None
Stop measuring, keeping the chosen layers for the next time it is switched back on.
- _on_update_intensity_layers() → None
Reopen the layer choice and measure whatever comes back.
- _ask_intensity_layers() → list[napari.layers.Image] | None
Ask which image layers to measure.
- Returns:
The chosen layers (possibly none, meaning “stop measuring”), or None if the user cancelled or there is nothing eligible to measure.
- _apply_intensity_layers(layers: list[napari.layers.Image]) → None
Measure mean intensity in the given layers, or stop measuring if there are none.
- Parameters:
layers – the image layers to measure, in the order their columns appear.
- _set_intensity_checked(checked: bool) → None
Show the feature’s state without re-entering the toggle handler.
- _refresh_views() → None
Rebuild the track dataframe and notify the other views of new features.
- _live_intensity_layers() → list[napari.layers.Image]
The measured layers that are still in the viewer.
- _remember_intensity_layers(layers: list[napari.layers.Image]) → None
Track the measured layers, and listen for renames of exactly those.
- _forget_intensity_layers() → None
Drop the measured layers, e.g. when a different Tracks is loaded.
- _on_layer_removed(event=None) → None
A removed layer cannot be measured: drop it and remeasure the rest.
- _on_layer_renamed(event=None) → None
A measured layer’s name is its column name, so push the new one through.
- _measuring_intensity() → bool
Whether mean intensity is currently switched on.
- _matching_image_layers() → list[napari.layers.Image]
Image layers with the same shape as the segmentation, in viewer order.