Generates masks asynchronously via PluginThread and writes them to disk.
More...
#include <maskcommand.h>
|
| tl::expected< cv::Mat, QString > | waitForMask (uint imageIndex, int timeoutMs=30000) |
| | Waits for a specific mask to arrive from PluginThread.
|
| |
Generates masks asynchronously via PluginThread and writes them to disk.
Unlike TransformCommand which processes synchronously, MaskCommand:
- Sends async mask generation requests to PluginThread
- Blocks in execute() until the mask for the current image arrives
- Tracks pending mask count to prevent overwhelming the plugin thread
- Writes generated masks to disk
- Author
- Dominik Wüst
- Date
- February 2026
◆ MaskCommand()
Constructs a MaskCommand for async mask generation.
- Parameters
-
| record | The MaskRecord containing plugin name and settings |
| exportResolution | The resolution for the export |
| roi | The region of interest |
| folder | The output folder for masks |
| pluginThread | The PluginThread for async processing |
◆ execute()
| std::optional< QString > MaskCommand::execute |
( |
ImageContext & |
ctx | ) |
|
|
overridevirtual |
Requests mask generation and waits for result before writing to disk.
- Parameters
-
- Returns
- Error message if any, std::nullopt on success
Implements ImageCommand.
◆ onMaskFinished()
Receives completed mask from PluginThread (to be called by external connection).
- Parameters
-
| result | The mask generation result |
◆ waitForMask()
| tl::expected< cv::Mat, QString > MaskCommand::waitForMask |
( |
uint |
imageIndex, |
|
|
int |
timeoutMs = 30000 |
|
) |
| |
|
private |
Waits for a specific mask to arrive from PluginThread.
Blocks the calling thread until the mask for the specified image arrives via onMaskFinished() callback, or until the timeout expires.
- Parameters
-
| imageIndex | The image index to wait for |
| timeoutMs | Timeout in milliseconds (default 30000ms = 30 seconds). This provides a safety window to detect hung plugin operations. 30 seconds is sufficient for most GPU and CPU-based mask generation but will catch genuine failures (crashes, GPU errors). |
- Returns
- Expected with the mask on success, or unexpected with error message on failure
The documentation for this class was generated from the following files:
- iVS3D/src/iVS3D-core/model/export/maskcommand.h
- iVS3D/src/iVS3D-core/model/export/maskcommand.cpp