iVS3D v2.0.9
Loading...
Searching...
No Matches
SegmentationPlugin Class Reference
Inheritance diagram for SegmentationPlugin:
PLUG::IBase PLUG::IMask PLUG::IPreview

Classes

struct  SegmentationCache
 

Public Member Functions

QString getName () const override
 getName returns the name of the plugin which will be displayed in the iVS3D interface.
 
PLUG::SettingsWidgetResult getSettingsWidget () override
 getSettingsWidget creates and returns a settings QWidget for this plugin.
 
QMap< QString, QVariant > getSettings () const override
 getSettings retrieves the current settings of the plugin as a map of key-value pairs. The settings are stored in the history within iVS3D and in combination with applySettings allow for saving and restoring plugin configurations.
 
QString getSettingsString () const override
 getSettingsString is a helper method that converts the plugin settings into a human-readable string format.
 
PLUG::ApplySettingsResult applySettings (const QMap< QString, QVariant > &settings) override
 applySettings applies the provided settings to the plugin. This method is used to restore plugin configurations from the history within iVS3D.
 
void onCudaChanged (bool enabled) override
 onCudaChanged is called when the CUDA usage setting is changed in iVS3D.
 
void deactivate () override
 deactivate is called when the plugin is deactivated in iVS3D. Plugins can override this method to perform any necessary cleanup when they are no longer active.
 
PLUG::MaskResult generateMask (const PLUG::MaskData &data) override
 Generates a binary mask for the given image data.
 
VIS::VisualizationResult generatePreview (const PLUG::PreviewData &data) override
 Generates a preview visualization based on the provided data. This function is executed asynchronously by iVS3D, such that expensive operations such as neural network inference do not block the main thread and GUI. Plugins should ensure that communication with the settings widget is thread-safe, e.g. by using signals and slots!
 
- Public Member Functions inherited from PLUG::IBase
virtual void activate ()
 activate is called when the plugin is activated in iVS3D. Plugins can override this method to perform any necessary setup when they become active.
 
virtual InputLoadedResult onInputLoaded (const InputData &input)
 onInputLoaded is called when a new input video or image set is loaded.
 
virtual MetaDataLoadedResult onMetaDataLoaded (const InputMetaData &inputMetaData)
 onMetaDataLoaded is called whenever metadata was loaded or refreshed for the currently active input.
 
virtual void onIndexChanged (uint index)
 onIndexChanged is called when the currently displayed frame index changes in the viewer.
 
virtual void onSelectedImagesChanged (const std::vector< uint > &selectedImages)
 onSelectedImagesChanged is called when the current keyframe / selected-image list changed.
 

Private Member Functions

std::optional< PLUG::ErrorensureModelReady ()
 Ensures the model manager has an active, ready model and loads the neural network. Validates that there is an active model in Ready state and loads the neural network if needed.
 

Additional Inherited Members

- Signals inherited from PLUG::IBase
void updatePreview (bool clearOldPreview=true)
 [signal] updatePreview(bool clearOldPreview) can be emitted when the plugin requests an update of the preview visualization.
 
void updateSelectedImages (std::vector< uint > selectedImages)
 [signal] updateSelectedImages(std::vector<uint> selectedImages) can be emitted when the plugin wants to update the selection of images in the video player. iVS3D will only handle this signal if the plugin is currently active.
 
void updateProgress (int progress, QString message=QString())
 [signal] updateProgress(int progress, QString message) can be emitted to inform iVS3D about the progress of a long-running operation.
 

Member Function Documentation

◆ applySettings()

ApplySettingsResult SegmentationPlugin::applySettings ( const QMap< QString, QVariant > &  settings)
overridevirtual

applySettings applies the provided settings to the plugin. This method is used to restore plugin configurations from the history within iVS3D.

See also
getSettings
Parameters
settingsA QMap containing the plugin settings as key-value pairs.

Implements PLUG::IBase.

◆ ensureModelReady()

std::optional< Error > SegmentationPlugin::ensureModelReady ( )
private

Ensures the model manager has an active, ready model and loads the neural network. Validates that there is an active model in Ready state and loads the neural network if needed.

Returns
std::nullopt if successful, Error if validation fails

◆ generateMask()

MaskResult SegmentationPlugin::generateMask ( const PLUG::MaskData data)
overridevirtual

Generates a binary mask for the given image data.

This method should be implemented by the plugin to create a binary mask based on the provided MaskData. The image in MaskData is already resized to the working resolution and cropped to the region of interest.

Parameters
dataThe MaskData containing the image and its index.
Returns
A MaskResult containing either the generated cv::Mat mask or an Error if the mask generation failed.

Implements PLUG::IMask.

◆ generatePreview()

VisualizationResult SegmentationPlugin::generatePreview ( const PLUG::PreviewData data)
overridevirtual

Generates a preview visualization based on the provided data. This function is executed asynchronously by iVS3D, such that expensive operations such as neural network inference do not block the main thread and GUI. Plugins should ensure that communication with the settings widget is thread-safe, e.g. by using signals and slots!

Parameters
dataThe PreviewData containing the image and its index.
Returns
A VisualizationResult containing either the generated Visualization or an Error if the preview generation failed.

Implements PLUG::IPreview.

◆ getName()

QString SegmentationPlugin::getName ( ) const
inlineoverridevirtual

getName returns the name of the plugin which will be displayed in the iVS3D interface.

Returns
The name of the plugin as a QString.

Implements PLUG::IBase.

◆ getSettings()

QMap< QString, QVariant > SegmentationPlugin::getSettings ( ) const
overridevirtual

getSettings retrieves the current settings of the plugin as a map of key-value pairs. The settings are stored in the history within iVS3D and in combination with applySettings allow for saving and restoring plugin configurations.

See also
applySettings
Returns
A QMap containing the plugin settings as key-value pairs.

Implements PLUG::IBase.

◆ getSettingsString()

QString SegmentationPlugin::getSettingsString ( ) const
overridevirtual

getSettingsString is a helper method that converts the plugin settings into a human-readable string format.

This is used to display the settings in the iVS3D interface and to store them in the history. The default implementation converts the settings map into a semicolon-separated list of key=value pairs.

Implements PLUG::IBase.

◆ getSettingsWidget()

SettingsWidgetResult SegmentationPlugin::getSettingsWidget ( )
overridevirtual

getSettingsWidget creates and returns a settings QWidget for this plugin.

Ownership contract:

  • The plugin must allocate and return a std::unique_ptr<QWidget>.
  • Returning the unique_ptr transfers ownership to the caller.
  • The plugin must NOT keep ownership of, or store a pointer to, the returned widget.
  • The caller (core application) owns the widget and may assign a QObject/QWidget parent.

Threading contract:

  • The widget is part of the UI and must only be accessed from the UI thread.
  • Plugins may run in worker threads and therefore must not directly access the widget after handing it over.

If a plugin needs to reflect state changes in the UI later (e.g. from applySettings), it must do so via Qt signals/slots connected during widget creation.

Returns
A unique_ptr to the created settings QWidget or an Error if the widget could not be created.

Implements PLUG::IBase.

◆ onCudaChanged()

void SegmentationPlugin::onCudaChanged ( bool  enabled)
overridevirtual

onCudaChanged is called when the CUDA usage setting is changed in iVS3D.

Parameters
enabledIndicates whether CUDA is enabled (true) or disabled (false).

Plugins can override this method to adjust their behavior based on the CUDA setting.

Implements PLUG::IBase.


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