iVS3D v2.0.0
Loading...
Searching...
No Matches
ITransformRequestDequeue Class Reference

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>

Inheritance diagram for ITransformRequestDequeue:
ITransform

Public Slots

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
 

Signals

void sig_transformFinished (uint idx, TransformResult result)
 [signal] sig_transformFinished is emitted after ITransform::transform ran.
 
- Signals inherited from ITransform
void sendToGui (uint idx, const cv::Mat &img)
 [signal] sendToGui is emitted if the ITransform instance has an image to display to the user.
 

Public Member Functions

 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.
 
ITransformRequestDequeuecopy () 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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ ITransformRequestDequeue()

ITransformRequestDequeue::ITransformRequestDequeue ( ITransform transform)
explicit

ITransformRequestDequeue creates a proxy for the given ITransform.

Parameters
transformThe ITransform instance to hide behind the proxy

Member Function Documentation

◆ copy()

ITransformRequestDequeue * ITransformRequestDequeue::copy ( )
overridevirtual

copy creates a new ITransformRequestDequeue instance which is a deep copy.

Returns
The copy

Implements ITransform.

◆ enableCuda()

void ITransformRequestDequeue::enableCuda ( bool  enabled)
overridevirtual

enableCuda enables use of the CUDA api to accelerate computations.

Parameters
enabledThe 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
parentThe parent for the QWidget
Returns
The QWidget with the plugin settings

Implements ITransform.

◆ moveToThread()

void ITransformRequestDequeue::moveToThread ( QThread *  thread)

moveToThread moves this ITransformRequestDequeue with its ITransform instance to the given thread.

Parameters
threadThe worker thread to move to

◆ setSettings()

void ITransformRequestDequeue::setSettings ( QMap< QString, QVariant >  settings)
overridevirtual

setter for plugin's settings

Parameters
QMapwith the settings

Implements ITransform.

◆ sig_transformFinished

void ITransformRequestDequeue::sig_transformFinished ( uint  idx,
TransformResult  result 
)
signal

[signal] sig_transformFinished is emitted after ITransform::transform ran.

Parameters
idxThe index of the transformed image
resultThe resulting images of ITransform::transform or an error object

◆ slot_enableCuda

void ITransformRequestDequeue::slot_enableCuda ( bool  enabled)
slot

[slot] slot_enableCuda enables or disables the CUDA api for the ITransform

Parameters
enabledEnables 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
idxThe index of the image to transform
imgThe 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
idxThe index of the image to transform
imgThe image to transform
Returns
Pointers to the transformed images

Implements ITransform.


The documentation for this class was generated from the following files: