Developers

Plugin Interface

STracking napari plugins implements a dedicated plugin interface for a custom management of the progress bar, progress log and advanced mode. To implement a new STracking plugin, developers needs to implement a SNapariPlugin class with a dedicated SNapariWidget for the graphical interface and a SNapariWorker that link the plugin widget to the STracking class.

class napari_stracking._splugin.SLogWidget

Widget to log the STracking plugins messages in the graphical interface

add_log(value: str)

Callback to add a new message in the log area

clear_log()

Callback to clear all the log area

set_advanced(mode: bool)

Show hide the log area depending on the plugin mode

set_progress(value: int)

Callback to update the progress bar

class napari_stracking._splugin.SNapariPlugin(napari_viewer)

Definition of a STracking napari widget

To create a new plugin, simply create a new class that inherit from SNapariPlugin and instantiate self.worker, self.widget and call init_ui in the constructor.

The SNapariPlugin purpose is to implement a default run button and log widget for all STracking plugins and provide a run method that start the worker in a separate thread

napari_viewer: Viewer

Napari viewer

worker: SNapariWorker

Instance of the plugin worker

widget: SNapariWidget

Instance of the plugin widget

init_ui()

Initialize the plugin graphical interface

The plugin interface add a run button and a log widget to the plugin (SNapariWidget) widget

run()

Start the worker in a new thread

set_advanced(mode: bool)

Toggle the graphical interface to advanced mode

mode: bool

True to set mode to advanced, False to set mode to default

set_enable(mode: bool)

Callback called to disable the run button when the inputs layers are not available

set_outputs()

Call the worker set_outputs method to set the plugin outputs to napari layers

class napari_stracking._splugin.SNapariWidget

Interface for a STracking napari widget

This interface implements three methods - show_error: to display a user input error - check_inputs (abstract): to check all the user input from the plugin widget - state (abstract): to get the plugin widget state, ie the user inputs values set in the widget

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

static show_error(message)

Display an error message in a QMessage box

message: str

Error message

state()

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

class napari_stracking._splugin.SNapariWorker(napari_viewer, widget)

Interface for a STracking napari plugin

The worker is an object that run the calculation (using the run method) using the user inputs from the plugin widget interface (SNapariWidget)

run()

Exec the data processing

state()

Get the states from the SNapariWidget

class napari_stracking._splugin.SProgressObserver

Implement the STRacking observer design pattern to display STracking tools progress

notify(message)

Callback to notify a new log message

progress(value)

Callback to refresh the computation progress

Plugin to change a layer scale

class napari_stracking._scale_plugin.SScale(napari_viewer)

Napari plugin to change a layer scale

napari_viewer: Viewer

Napari viewer

changed_layer(layer_name)

Update the plugin widget when the selected layer has changed

update_scale()

Update the scale in the napari layer

Plugins for import and export

class napari_stracking._reader_plugin.SLoad(napari_viewer)

Plugin to read particles and tracks from files

napari_viewer: Viewer

Napari viewer

browse_particles()

Callback called when the browse particles button is clicked

browse_tracks()

Callback called when the browse tracks button is clicked

load_particles()

Method that implements the particles loading

load_tracks()

Method that implements the tracks loading

class napari_stracking._export_plugin.SExport(napari_viewer)

Dock widget to export particles and tracks

napari_viewer: Viewer

Napari viewer

Detection plugins

class napari_stracking._sdetection_plugins.SDetectorDog(napari_viewer)

Napari plugin for DoG detection

napari_viewer: Viewer

Napari viewer

class napari_stracking._sdetection_plugins.SDetectorDoh(napari_viewer)

Napari plugin for DoH detection

napari_viewer: Viewer

Napari viewer

class napari_stracking._sdetection_plugins.SDetectorLog(napari_viewer)

Napari plugin for LoG detection

napari_viewer: Viewer

Napari viewer

class napari_stracking._sdetection_plugins.SDetectorSeg(napari_viewer)

Napari plugin for detection from segmentation map

napari_viewer: Viewer

Napari viewer

class napari_stracking._sdetection_workers.SDogWidget(napari_viewer)

Widget for the DoG detector plugins

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

toggle_advanced(value)

Change the parameters widget to advanced mode

class napari_stracking._sdetection_workers.SDogWorker(napari_viewer, widget)

Worker for the DoG detector plugins

run()

Execute the processing

set_outputs()

Set the plugin outputs to napari layers

class napari_stracking._sdetection_workers.SDohWidget(napari_viewer)

Widget for the DoH detector plugins

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

toggle_advanced(value)

Change the parameters widget to advanced mode

class napari_stracking._sdetection_workers.SDohWorker(napari_viewer, widget)

Worker for the DoH detector plugins

run()

Execute the processing

set_outputs()

Set the plugin outputs to napari layers

class napari_stracking._sdetection_workers.SLogWidget(napari_viewer)

Widget for the LoG detector plugins

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

toggle_advanced(value)

Change the parameters widget to advanced mode

class napari_stracking._sdetection_workers.SLogWorker(napari_viewer, widget)

Worker for the LoG detector plugins

run()

Execute the processing

set_outputs()

Set the plugin outputs to napari layers

class napari_stracking._sdetection_workers.SSegWidget(napari_viewer)

Widget for the Seg detector plugins

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

toggle_advanced(value)

Change the parameters widget to advanced mode

class napari_stracking._sdetection_workers.SSegWorker(napari_viewer, widget)

Worker for the Seg detector plugins

run()

Execute the processing

set_outputs()

Set the plugin outputs to napari layers

Properties plugins

class napari_stracking._sproperties_plugins.SParticlesProperties(napari_viewer)

Plugin to calculate particles properties

napari_viewer: Viewer

Napari viewer

class napari_stracking._sproperties_workers.SIntensityPropertyWidget(parent_plugin)

Widget for the intensity property inputs

check_inputs()

Check the widget user inputs

True is the inputs are correct, False if at least one input is not correct

parameters()

Get the parameters values (state)

dict: a dictionary with the inputs values

class napari_stracking._sproperties_workers.SSpotPropertiesWidget(napari_viewer)

Widget for the particles properties plugin

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

show_properties()

reload and display the particles properties in a popup window

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

toggle_advanced(value)

Change the parameters widget to advanced mode

class napari_stracking._sproperties_workers.SSpotPropertiesWorker(napari_viewer, widget)

Worker fot the particles properties plugin

run()

Execute the processing

set_outputs()

“set the calculated properties to a new napari layer

Linking plugins

class napari_stracking._slinking_plugins.SLinkerNearestNeighbor(napari_viewer)

Plugin to link detections using the nearest neighbor algorithm

napari_viewer: Viewer

Napari viewer

class napari_stracking._slinking_plugins.SLinkerShortestPath(napari_viewer)

Plugin to link detections using the shortest path algorithm

napari_viewer: Viewer

Napari viewer

class napari_stracking._slinking_workers.SLinkerNearestNeighborWidget(napari_viewer)

Widget for the linker nearest neighbor plugin

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

class napari_stracking._slinking_workers.SLinkerNearestNeighborWorker(napari_viewer, widget)

Worker for the linker nearest neighbor plugin

run()

Execute the processing

set_outputs()

Set the linker tracks to a new napari layer

class napari_stracking._slinking_workers.SLinkerShortestPathWidget(napari_viewer)

Widget for the shortest path linker plugin

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

class napari_stracking._slinking_workers.SLinkerShortestPathWorker(napari_viewer, widget)

Worker for the shortest path linker plugin

run()

Execute the processing

set_outputs()

Set the calculated tracks to a new napari layer

Features plugins

class napari_stracking._sfeatures_plugins.STracksFeatures(napari_viewer)

Plugin to calculate tracks features

napari_viewer: Viewer

Napari viewer

class napari_stracking._sfeatures_workers.SDisplacementFeatureWidget

Widget for the displacement feature

class napari_stracking._sfeatures_workers.SDistanceFeatureWidget

Widget for the distance feature

class napari_stracking._sfeatures_workers.SLengthFeatureWidget

Widget for the length feature

class napari_stracking._sfeatures_workers.STracksFeaturesWidget(napari_viewer)

Widget for the tracks features plugins

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

show_features()

Method to call to force the features table display

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

toggle_advanced(value)

Change the parameters widget to advanced mode

class napari_stracking._sfeatures_workers.STracksFeaturesWorker(napari_viewer, widget)

Worker fot the tracks features plugin

run()

Execute the processing

set_outputs()

Set the output features in a new napari layer

Filters plugins

class napari_stracking._strackfilter_plugins.SFilterTrack(napari_viewer)

Dock widget to filter tracks

napari_viewer: Viewer

Napari viewer

class napari_stracking._strackfilter_workers.SFeatureFilterWidget(napari_viewer, layer_name, parent_plugin)

Widget for the features filter plugin

class napari_stracking._strackfilter_workers.STrackFilterWidget(napari_viewer)

Widget for the tracks filter plugin

check_inputs()

Check the user input in this widget

Returns:

True if no error, False if at least one input contains an error. (ex not well writen number)

init_layer_list()

Initialize the layers lists

state() dict

Return the current state of the widget

The state in inputs values displayed in the the widget. Example

{'name': 'SDoGDetector',
 'inputs': {'image': self._input_layer_box.currentText()},
 'parameters': {'min_sigma': float(self._min_sigma_value.text()),
                'max_sigma': float(self._max_sigma_value.text()),
                'threshold': float(self._threshold_value.text()),
                'sigma_ratio': float(self._sigma_ratio_value.text()),
                'overlap': float(self._overlap_value.text()),
                'current_frame': self._current_frame_check.isChecked()
                },
 'outputs': ['points', 'DoG detections']
 }
Returns:

dict: a dictionary containing the widget inputs

toggle_advanced(value)

Change the parameters widget to advanced mode

class napari_stracking._strackfilter_workers.STrackFilterWorker(napari_viewer, widget)

Worker for the track filter plugin

run()

Execute the processing

set_outputs()

Set the plugin output to a napari layer