The ITransformRequestDequeue class is a proxy for an ITransform. It is used to run ITransform::transform and other local methods in a worker thread. Therefore the proxy overrides the QObject::moveToThread method and provides slots and signals to interact with from the gui thread. Since requests from the gui thread usually come in much faster than they can be handled by the worker thread, requests are collected and only the most recent one is passed to the ITransform for computation.
More...
#include <itransformrequestdequeue.h>
|
| void | slot_transform (uint idx, const cv::Mat &img, const Resolution &resolution, const ROI &roi) |
| | [slot] slot_transform adds the given image to the waiting queue or starts transformation if queue is empty.
|
| |
|
void | slot_startTransform () |
| | [slot] slot_startTransform starts transformation with the most recent image in the waiting queue.
|
| |
| void | slot_enableCuda (bool enabled) |
| | [slot] slot_enableCuda enables or disables the CUDA api for the ITransform
|
| |
|
| | ITransformRequestDequeue (ITransform *transform) |
| | ITransformRequestDequeue creates a proxy for the given ITransform.
|
| |
| QWidget * | getSettingsWidget (QWidget *parent) override |
| | getSettingsWidget is provides an QWidget to display plugin specific settings to the user. Keep in mind that the widget will run in gui thread while this ITransform instance is moved to a worker thread!
|
| |
| QString | getName () const override |
| | getName returns the display name for the plugin.
|
| |
| ITransformRequestDequeue * | copy () override |
| | copy creates a new ITransformRequestDequeue instance which is a deep copy.
|
| |
| TransformResult | transform (uint idx, const cv::Mat &img, const Resolution &resolution, const ROI &roi) override |
| | transform generates additional images from the given image. The signal sendToGui can be used to update the preview for the user.
|
| |
| void | enableCuda (bool enabled) override |
| | enableCuda enables use of the CUDA api to accelerate computations.
|
| |
|
void | deactivate () override |
| | deactivate will be called when the plugin is no longer used, i.e. when the user deselects it in the sampling window or when exporting finishes. This should be used to free resources such as gpu memory.
|
| |
|
void | activate () override |
| | activate will be called before the plugin is used, i.e. when the user selects it in the seampling window or when exporting.
|
| |
| void | moveToThread (QThread *thread) |
| | moveToThread moves this ITransformRequestDequeue with its ITransform instance to the given thread.
|
| |
| void | setSettings (QMap< QString, QVariant > settings) override |
| | setter for plugin's settings
|
| |
| QMap< QString, QVariant > | getSettings () override |
| | getter for plugin's settings
|
| |
The ITransformRequestDequeue class is a proxy for an ITransform. It is used to run ITransform::transform and other local methods in a worker thread. Therefore the proxy overrides the QObject::moveToThread method and provides slots and signals to interact with from the gui thread. Since requests from the gui thread usually come in much faster than they can be handled by the worker thread, requests are collected and only the most recent one is passed to the ITransform for computation.
Note that while the ITransform instance is moved to the given worker thread in moveToThread, the SettingsWidget created by this ITransform is NOT MOVED TO THE WORKER THREAD. This reqeuires connections between the ITransform and the QWidget to be threadsafe!
- See also
- ITransform
◆ ITransformRequestDequeue()
| ITransformRequestDequeue::ITransformRequestDequeue |
( |
ITransform * |
transform | ) |
|
|
explicit |
◆ copy()
◆ enableCuda()
| void ITransformRequestDequeue::enableCuda |
( |
bool |
enabled | ) |
|
|
overridevirtual |
enableCuda enables use of the CUDA api to accelerate computations.
- Parameters
-
| enabled | The CUDA api is used if true |
Implements ITransform.
◆ getName()
| QString ITransformRequestDequeue::getName |
( |
| ) |
const |
|
overridevirtual |
getName returns the display name for the plugin.
- Returns
- The name to display.
Implements ITransform.
◆ getSettings()
| QMap< QString, QVariant > ITransformRequestDequeue::getSettings |
( |
| ) |
|
|
overridevirtual |
getter for plugin's settings
- Returns
- QMap with the settings
Implements ITransform.
◆ getSettingsWidget()
| QWidget * ITransformRequestDequeue::getSettingsWidget |
( |
QWidget * |
parent | ) |
|
|
overridevirtual |
getSettingsWidget is provides an QWidget to display plugin specific settings to the user. Keep in mind that the widget will run in gui thread while this ITransform instance is moved to a worker thread!
- Parameters
-
| parent | The parent for the QWidget |
- Returns
- The QWidget with the plugin settings
Implements ITransform.
◆ moveToThread()
| void ITransformRequestDequeue::moveToThread |
( |
QThread * |
thread | ) |
|
◆ setSettings()
| void ITransformRequestDequeue::setSettings |
( |
QMap< QString, QVariant > |
settings | ) |
|
|
overridevirtual |
setter for plugin's settings
- Parameters
-
Implements ITransform.
◆ sig_transformFinished
| void ITransformRequestDequeue::sig_transformFinished |
( |
uint |
idx, |
|
|
TransformResult |
result |
|
) |
| |
|
signal |
◆ slot_enableCuda
| void ITransformRequestDequeue::slot_enableCuda |
( |
bool |
enabled | ) |
|
|
slot |
[slot] slot_enableCuda enables or disables the CUDA api for the ITransform
- Parameters
-
| enabled | Enables CUDA if true, disables CUDA otherwise. |
◆ slot_transform
| void ITransformRequestDequeue::slot_transform |
( |
uint |
idx, |
|
|
const cv::Mat & |
img, |
|
|
const Resolution & |
resolution, |
|
|
const ROI & |
roi |
|
) |
| |
|
slot |
[slot] slot_transform adds the given image to the waiting queue or starts transformation if queue is empty.
- Parameters
-
| idx | The index of the image to transform |
| img | The image to transform |
◆ transform()
| TransformResult ITransformRequestDequeue::transform |
( |
uint |
idx, |
|
|
const cv::Mat & |
img, |
|
|
const Resolution & |
resolution, |
|
|
const ROI & |
roi |
|
) |
| |
|
overridevirtual |
transform generates additional images from the given image. The signal sendToGui can be used to update the preview for the user.
- Parameters
-
| idx | The index of the image to transform |
| img | The image to transform |
- Returns
- Pointers to the transformed images
Implements ITransform.
The documentation for this class was generated from the following files: