ImageMaskPainterWidgetController.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package VisionX::gui-plugins::ImageMaskPainterWidgetController
17 * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * @date 2018
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22#pragma once
23
25
30
32#include <VisionX/gui-plugins/ImageMaskPainter/ui_ImageMaskPainterWidget.h>
33#include <VisionX/interface/components/Calibration.h>
34#include <VisionX/interface/core/ImageProviderInterface.h>
35
36#include "ImageMaskEditor.h"
37
38namespace armarx
39{
40 /**
41 \page VisionX-GuiPlugins-ImageMaskPainter ImageMaskPainter
42 \brief The ImageMaskPainter allows visualizing ...
43
44 \image html ImageMaskPainter.png
45 The user can
46
47 API Documentation \ref ImageMaskPainterWidgetController
48
49 \see ImageMaskPainterGuiPlugin
50 */
51
52 /**
53 * \class ImageMaskPainterWidgetController
54 * \brief ImageMaskPainterWidgetController brief one line description
55 *
56 * Detailed description
57 */
59 public armarx::ArmarXComponentWidgetControllerTemplate<ImageMaskPainterWidgetController>,
60 virtual public visionx::ImageProcessor
61 {
62 Q_OBJECT
63 public:
64 /// Controller Constructor
66
67 /// Controller destructor
69
70 /**
71 * @see ArmarXWidgetController::loadSettings()
72 */
73 void loadSettings(QSettings* settings) override;
74
75 /**
76 * @see ArmarXWidgetController::saveSettings()
77 */
78 void saveSettings(QSettings* settings) override;
79
80
81 /**
82 * Returns the Widget name displayed in the ArmarXGui to create an
83 * instance of this class.
84 */
85 static QString GetWidgetName();
86
87 QPointer<QDialog> getConfigDialog(QWidget* parent) override;
88
89 protected:
90 void onInitImageProcessor() override;
91 void onConnectImageProcessor() override;
92
93 void
95 {
96 }
97
98 void process() override;
99 void timerEvent(QTimerEvent*) override;
100
101 private slots:
102 void updatePenColor();
103 void imageIndexChanged(int i);
104 void maskUpdated();
105
106 private:
107 /// Widget Form
108 Ui::ImageMaskPainterWidget _widget;
109 //mask
110 ImageMaskEditor* _maskEditor{nullptr};
111
112 std::string _imageProviderName;
113 visionx::ImageProviderInfo _imageProviderInfo;
114 visionx::ImageProviderInterfacePrx _imageProvider;
115 std::atomic_int _imageIndex{0};
116 std::atomic_int _numberOfImages{1};
117 std::string _imageProviderReferenceFrame;
118 visionx::StereoCalibration _imageProviderCalibration;
119 bool _imageProviderAreImagesUndistorted;
120
121 QPointer<SimpleConfigDialog> _dialog;
122
123 std::vector<visionx::CByteImageUPtr> _providerImagesOwner;
124 std::vector<void*> _providerImages;
125 QImage _currentImage;
126 std::mutex _currentImageMutex;
127 std::atomic_bool _currentImageDirty{false};
128
129 bool _maskSet = false;
130 visionx::CByteImageUPtr _resultImage;
131
132 // ArmarXWidgetController interface
133 public:
134 void configured() override;
135 };
136} // namespace armarx
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
void onExitImageProcessor() override
Exit the ImapeProcessor component.
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
void process() override
Process the vision component.
void onInitImageProcessor() override
Setup the vision component.
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
virtual ~ImageMaskPainterWidgetController()
Controller destructor.
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::unique_ptr< CByteImage > CByteImageUPtr