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/interface/core/ImageProviderInterface.h>
33 #include <VisionX/interface/components/Calibration.h>
34 
35 #include <VisionX/gui-plugins/ImageMaskPainter/ui_ImageMaskPainterWidget.h>
36 #include "ImageMaskEditor.h"
37 
38 namespace 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  protected:
89  void onInitImageProcessor() override;
90  void onConnectImageProcessor() override;
91  void onExitImageProcessor() override {}
92  void process() override;
93  void timerEvent(QTimerEvent*) override;
94 
95  private slots:
96  void updatePenColor();
97  void imageIndexChanged(int i);
98  void maskUpdated();
99  private:
100  /// Widget Form
101  Ui::ImageMaskPainterWidget _widget;
102  //mask
103  ImageMaskEditor* _maskEditor{nullptr};
104 
105  std::string _imageProviderName;
106  visionx::ImageProviderInfo _imageProviderInfo;
107  visionx::ImageProviderInterfacePrx _imageProvider;
108  std::atomic_int _imageIndex{0};
109  std::atomic_int _numberOfImages{1};
110  std::string _imageProviderReferenceFrame;
111  visionx::StereoCalibration _imageProviderCalibration;
112  bool _imageProviderAreImagesUndistorted;
113 
114  QPointer<SimpleConfigDialog> _dialog;
115 
116  std::vector<visionx::CByteImageUPtr> _providerImagesOwner;
117  std::vector<void*> _providerImages;
118  QImage _currentImage;
119  std::mutex _currentImageMutex;
120  std::atomic_bool _currentImageDirty{false};
121 
122  bool _maskSet = false;
123  visionx::CByteImageUPtr _resultImage;
124 
125  // ArmarXWidgetController interface
126  public:
127  void configured() override;
128  };
129 }
130 
131 
armarx::ImageMaskPainterWidgetController::onInitImageProcessor
void onInitImageProcessor() override
Setup the vision component.
Definition: ImageMaskPainterWidgetController.cpp:77
armarx::ImageMaskPainterWidgetController::ImageMaskPainterWidgetController
ImageMaskPainterWidgetController()
Controller Constructor.
Definition: ImageMaskPainterWidgetController.cpp:35
visionx::ImageProcessor
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
Definition: ImageProcessor.h:87
ImageMaskEditor.h
armarx::ImageMaskPainterWidgetController::onConnectImageProcessor
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
Definition: ImageMaskPainterWidgetController.cpp:97
armarx::ImageMaskPainterWidgetController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: ImageMaskPainterWidgetController.cpp:82
armarx::ImageMaskPainterWidgetController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: ImageMaskPainterWidgetController.cpp:67
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
SimpleConfigDialog.h
armarx::ImageMaskPainterWidgetController::process
void process() override
Process the vision component.
Definition: ImageMaskPainterWidgetController.cpp:170
visionx::ImageProviderInfo
Definition: ImageProcessor.h:466
ArmarXGuiPlugin.h
visionx::CByteImageUPtr
std::unique_ptr< CByteImage > CByteImageUPtr
Definition: ImageProvider.h:57
ArmarXComponentWidgetController.h
ImageProcessor.h
IceProxyFinder.h
armarx::ImageMaskPainterWidgetController
ImageMaskPainterWidgetController brief one line description.
Definition: ImageMaskPainterWidgetController.h:58
ImageMaskEditor
Definition: ImageMaskEditor.h:8
armarx::ImageMaskPainterWidgetController::GetWidgetName
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
Definition: ImageMaskPainterWidgetController.cpp:210
armarx::ImageMaskPainterWidgetController::~ImageMaskPainterWidgetController
virtual ~ImageMaskPainterWidgetController()
Controller destructor.
armarx::ImageMaskPainterWidgetController::loadSettings
void loadSettings(QSettings *settings) override
Definition: ImageMaskPainterWidgetController.cpp:87
armarx::ImageMaskPainterWidgetController::timerEvent
void timerEvent(QTimerEvent *) override
Definition: ImageMaskPainterWidgetController.cpp:189
armarx::ImageMaskPainterWidgetController::saveSettings
void saveSettings(QSettings *settings) override
Definition: ImageMaskPainterWidgetController.cpp:92
armarx::ImageMaskPainterWidgetController::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: ImageMaskPainterWidgetController.h:91
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h