iRoCS Toolbox
1.1.0
|
#include <PluginEpidermisLabelling.hh>
Public Member Functions | |
PluginEpidermisLabelling () | |
~PluginEpidermisLabelling () | |
void | abort () |
Abort the plugin. More... | |
QString | name () const |
Get the plugin name. More... | |
void | run () |
Run the plugin. More... | |
void | setLabellingMainWidget (LabellingMainWidget *parent) |
Set the LabellingMainWidget this plugin will act on. More... | |
void | setParameters (const std::map< std::string, std::string > ¶meters) |
Set plugin-specific parameters. More... | |
Definition at line 36 of file PluginEpidermisLabelling.hh.
PluginEpidermisLabelling::PluginEpidermisLabelling | ( | ) |
PluginEpidermisLabelling::~PluginEpidermisLabelling | ( | ) |
|
virtual |
Get the plugin name.
Sub-classes must implement this method and return a short plugin title string. The given string will be shown in the Plugins menu.
Implements PluginInterface.
|
virtual |
Set the LabellingMainWidget this plugin will act on.
Sub-classes must implement this method. Typically they just store the given pointer s.t. it can be used in the run() method.
Implements PluginInterface.
|
virtual |
Set plugin-specific parameters.
Sub-classes must implement this method. The given map contains attribute-value pairs that have to be parsed and remapped to plugin-specific parameters. The purpose of this method is to allow writing of macros in a later version. Currently it is not used by labelling, and therefore the implementation can be left empty without loss of function.
Implements PluginInterface.
|
virtual |
Run the plugin.
Sub-classes must implement this method. It contains the plugin body which can be a simple sequence of commands or more complicated interactive steps.
Typically it first opens a dialog asking the user to provide parameters for the plugin. Then it does the work and returns.
For long-running jobs a separate worker thread should be started that processes the data. Currently the GUI thread must be put to sleep during execution. Labelling is not thread-safe, therefore it is also a good idea to disable active control elements during processing especially to avoid execution of multiple plugins in parallel which will almost certainly crash labelling. This is done using LabellingMainWidget::setUserInteractionEnabled(bool). Long-running plugins should show their progress using LabellingMainWidget::progressReporter(). It is good practize to call QCoreApplication::processEvents() every 10 milliseconds to keep the GUI responsive.
If the plugin creates new items like channels, markers or the like make sure that the thread affinity for all created objects is passed to the GUI thread before the worker thread ends. If possible generate such structures in the GUI thread directly.
Implements PluginInterface.
|
virtual |
Abort the plugin.
If the worker thread uses the iRoCS::ProgressReporter of LabellingMainWidget this method should set its state to aborted using iRoCS::ProgressReporter::abort(). If the run() method regularly polls the progress reporter state it can react accordingly and gracefully end the thread and restore the old state or perform other actions. Progress reporting is using a thread-safe SIGNAL-SLOT connection, therefore all progress reporting and reactions on abort can be done in the worker thread.
Implements PluginInterface.