napari_track_edit.application_menus.feature_widget ================================================== .. py:module:: napari_track_edit.application_menus.feature_widget Classes ------- .. autoapisummary:: napari_track_edit.application_menus.feature_widget.IntensityLayerDialog napari_track_edit.application_menus.feature_widget.FeatureWidget Module Contents --------------- .. py:class:: IntensityLayerDialog(layers: list[napari.layers.Image], selected: list[napari.layers.Image] | None = None, parent: qtpy.QtWidgets.QWidget | None = None) Bases: :py:obj:`qtpy.QtWidgets.QDialog` Pick the image layers to measure mean intensity in. :param layers: The eligible image layers, in viewer order. :param selected: The layers to tick. None ticks all of them, which is the default for a first-time choice. :param parent: The widget the dialog belongs to. .. py:attribute:: _checkboxes :type: list[tuple[napari.layers.Image, qtpy.QtWidgets.QCheckBox]] :value: [] .. py:property:: selected_layers :type: list[napari.layers.Image] The ticked layers, in viewer order. .. py:class:: FeatureWidget(viewer: napari.Viewer) Bases: :py:obj:`qtpy.QtWidgets.QWidget` Widget 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. .. py:attribute:: viewer .. py:attribute:: tracks_viewer .. py:attribute:: _checkboxes :type: dict[str, qtpy.QtWidgets.QCheckBox] .. py:attribute:: intensity_checkbox :type: qtpy.QtWidgets.QCheckBox | None :value: None .. py:attribute:: _intensity_layers :type: list[napari.layers.Image] :value: [] .. py:attribute:: _name_connected :type: set[napari.layers.Image] .. py:attribute:: _tracks :value: None .. py:attribute:: _toggling :value: False .. py:attribute:: label .. py:attribute:: box .. py:attribute:: checkbox_layout .. py:attribute:: layout .. py:method:: _update_checkboxes() Update the list of available checkboxes. .. py:method:: _intensity_row() -> qtpy.QtWidgets.QWidget The mean intensity checkbox, with a button to change the layers measured. .. py:method:: _clear_layout() -> None Remove all checkboxes from the layout .. py:method:: _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). .. py:method:: _on_toggled(feature_key: str, checked: bool) -> None Enable/disable features on tracks :param feature_key: the feature the enable/disable :type feature_key: str :param checked: whether to enable (True) or disable (False) :type checked: bool .. py:method:: _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. :param checked: whether to enable (True) or disable (False) :type checked: bool .. py:method:: _disable_intensity() -> None Stop measuring, keeping the chosen layers for the next time it is switched back on. .. py:method:: _on_update_intensity_layers() -> None Reopen the layer choice and measure whatever comes back. .. py:method:: _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. .. py:method:: _apply_intensity_layers(layers: list[napari.layers.Image]) -> None Measure mean intensity in the given layers, or stop measuring if there are none. :param layers: the image layers to measure, in the order their columns appear. .. py:method:: _set_intensity_checked(checked: bool) -> None Show the feature's state without re-entering the toggle handler. .. py:method:: _refresh_views() -> None Rebuild the track dataframe and notify the other views of new features. .. py:method:: _live_intensity_layers() -> list[napari.layers.Image] The measured layers that are still in the viewer. .. py:method:: _remember_intensity_layers(layers: list[napari.layers.Image]) -> None Track the measured layers, and listen for renames of exactly those. .. py:method:: _forget_intensity_layers() -> None Drop the measured layers, e.g. when a different Tracks is loaded. .. py:method:: _on_layer_removed(event=None) -> None A removed layer cannot be measured: drop it and remeasure the rest. .. py:method:: _on_layer_renamed(event=None) -> None A measured layer's name is its column name, so push the new one through. .. py:method:: _measuring_intensity() -> bool Whether mean intensity is currently switched on. .. py:method:: _matching_image_layers() -> list[napari.layers.Image] Image layers with the same shape as the segmentation, in viewer order.