6#include <QCoreApplication>
20 Q_PLUGIN_METADATA(IID
"iVS3D.IMask")
21 Q_PLUGIN_METADATA(IID
"iVS3D.IPreview")
22 Q_PLUGIN_METADATA(IID
"iVS3D.IBase")
26 using PLUG::IBase::IBase;
31 QString
getName()
const override {
return tr(
"Segmentation Masks"); }
33 QMap<QString, QVariant>
getSettings()
const override;
36 const QMap<QString, QVariant>& settings)
override;
47 void syncSettingsWidget(QString selectedModelName,
float overlayAlpha);
50 void onModelChanged(
const QString& modelName,
bool isValid);
51 void onClassSelectionChanged(
const QVector<uint>& selectedClassIds);
52 void onOverlayAlphaChanged(
float value);
63 tl::expected<NN::Tensor, NN::NeuralError> runInference(
64 const cv::Mat& image);
65 tl::expected<cv::Mat, NN::NeuralError> runColorization(
67 tl::expected<cv::Mat, NN::NeuralError> runMasking(
71 "/plugins/resources/neural_network_models"};
73 bool m_useCuda =
false;
74 float m_overlayAlpha = 0.5f;
76 QString m_currentModelName;
78 std::unique_ptr<QTranslator> m_segmentationTranslator;
85 cv::Mat colorizedImage =
87 cv::Mat maskImage = cv::Mat();
88 long inferenceDurationMs = 0;
90 std::optional<SegmentationCache> m_cache;
Discovery, validation, activation, and state tracking for model configs.
Factory class for creating NeuralNet instances.
Manages model configurations in a directory and exposes UI-friendly state.
Definition ModelManager.h:43
A Tensor represents a N-dimensional array containing elements of the same type. Can be used as input ...
Definition Tensor.h:201
The IBase interface provides a base class for all plugin interfaces in iVS3D. It inherits from QObjec...
Definition ibase.h:102
Interface for mask generation plugins in iVS3D.
Definition imask.h:46
The IPreview interface defines the contract for preview plugins in iVS3D. Plugins implementing this i...
Definition ipreview.h:41
Definition segplugin.h:18
PLUG::ApplySettingsResult applySettings(const QMap< QString, QVariant > &settings) override
applySettings applies the provided settings to the plugin. This method is used to restore plugin conf...
Definition segplugin.cpp:124
QString getSettingsString() const override
getSettingsString is a helper method that converts the plugin settings into a human-readable string f...
Definition segplugin.cpp:120
QString getName() const override
getName returns the name of the plugin which will be displayed in the iVS3D interface.
Definition segplugin.h:31
std::optional< PLUG::Error > ensureModelReady()
Ensures the model manager has an active, ready model and loads the neural network....
Definition segplugin.cpp:22
PLUG::MaskResult generateMask(const PLUG::MaskData &data) override
Generates a binary mask for the given image data.
Definition segplugin.cpp:150
void onCudaChanged(bool enabled) override
onCudaChanged is called when the CUDA usage setting is changed in iVS3D.
Definition segplugin.cpp:304
VIS::VisualizationResult generatePreview(const PLUG::PreviewData &data) override
Generates a preview visualization based on the provided data. This function is executed asynchronousl...
Definition segplugin.cpp:178
PLUG::SettingsWidgetResult getSettingsWidget() override
getSettingsWidget creates and returns a settings QWidget for this plugin.
Definition segplugin.cpp:65
QMap< QString, QVariant > getSettings() const override
getSettings retrieves the current settings of the plugin as a map of key-value pairs....
Definition segplugin.cpp:109
void deactivate() override
deactivate is called when the plugin is deactivated in iVS3D. Plugins can override this method to per...
Definition segplugin.cpp:313
std::shared_ptr< NeuralNet > NeuralNetPtr
Smart pointer type for managing NeuralNet instances.
Definition NeuralNet.h:121
tl::expected< void, Error > ApplySettingsResult
Type alias for the result of applying settings to a plugin, which can be either a successful void res...
Definition ibase.h:51
tl::expected< std::unique_ptr< QWidget >, Error > SettingsWidgetResult
Type alias for the result of a settings widget creation operation, which can be either a successful u...
Definition ibase.h:44
Struct containing data required to generate a binary mask. The image is resized to the working resolu...
Definition imask.h:26
Struct containing data required to generate a preview. The image is resized to the working resolution...
Definition ipreview.h:16
Definition segplugin.h:81