LVRMainWindow.hpp
Go to the documentation of this file.
1 
34 #ifndef MAINWINDOW_HPP_
35 #define MAINWINDOW_HPP_
36 
37 #include <vtkSmartPointer.h>
38 #include <vtkCamera.h>
39 #include <vtkCameraRepresentation.h>
40 #include <vtkCameraInterpolator.h>
41 #include <vtkCommand.h>
42 #include <vtkRenderer.h>
43 #include <vtkRendererCollection.h>
44 #include <vtkRenderWindow.h>
45 #include <vtkRenderWindowInteractor.h>
46 #include <vtkViewport.h>
47 #include <vtkObjectFactory.h>
48 #include <vtkGraphicsFactory.h>
49 #include <vtkOrientationMarkerWidget.h>
50 #include <vtkAxesActor.h>
51 #include <vtkOpenGLRenderer.h>
52 #include <vtkNew.h>
53 
54 #include <vtkCullerCollection.h>
55 
56 // EDL shading is only available in new vtk versions
57 #ifdef LVR2_USE_VTK_GE_7_1
58 #include <vtkEDLShading.h>
59 #include <vtkRenderStepsPass.h>
60 #endif
61 
62 #include <QtGui>
63 #ifdef LVR2_USE_VTK8
64  #include "ui_LVRMainWindowQVTKOGLUI.h"
65 #else
66  #include "ui_LVRMainWindowUI.h"
67 #endif
68 #include "ui_LVRAboutDialogUI.h"
69 #include "ui_LVRTooltipDialogUI.h"
70 
71 #include "LVRTreeWidgetHelper.hpp"
72 
73 #include "../widgets/LVRPlotter.hpp"
74 #include "../vtkBridge/LVRModelBridge.hpp"
75 #include "../widgets/LVRModelItem.hpp"
76 #include "../widgets/LVRPointCloudItem.hpp"
77 #include "../widgets/LVRMeshItem.hpp"
78 #include "../widgets/LVRItemTypes.hpp"
79 #include "../widgets/LVRRenameDialog.hpp"
80 #include "../widgets/LVRAnimationDialog.hpp"
81 #include "../widgets/LVRTransformationDialog.hpp"
82 #include "../widgets/LVRCorrespondanceDialog.hpp"
83 #include "../widgets/LVRLabelDialog.hpp"
84 #include "../widgets/LVRReconstructionEstimateNormalsDialog.hpp"
85 #include "../widgets/LVRReconstructionMarchingCubesDialog.hpp"
86 #include "../widgets/LVRReconstructionExtendedMarchingCubesDialog.hpp"
87 #include "../widgets/LVROptimizationPlanarOptimizationDialog.hpp"
88 #include "../widgets/LVROptimizationRemoveArtifactsDialog.hpp"
89 #include "../widgets/LVRFilteringMLSProjectionDialog.hpp"
90 #include "../widgets/LVRFilteringRemoveOutliersDialog.hpp"
91 #include "../widgets/LVRBackgroundDialog.hpp"
92 #include "../widgets/LVRHistogram.hpp"
93 #include "../widgets/LVRScanDataItem.hpp"
94 #include "../widgets/LVRCamDataItem.hpp"
95 #include "../widgets/LVRBoundingBoxItem.hpp"
96 #include "../widgets/LVRPointInfo.hpp"
97 #include "../vtkBridge/LVRPickingInteractor.hpp"
98 #include "../vtkBridge/LVRLabelInteractor.hpp"
99 #include "../vtkBridge/LVRVtkArrow.hpp"
100 
101 #include <iostream>
102 #include <iterator>
103 #include <vector>
104 #include <set>
105 #include <boost/format.hpp>
106 
107 #include "../vtkBridge/LVRChunkedMeshBridge.hpp"
108 #include "../vtkBridge/LVRChunkedMeshCuller.hpp"
109 
110 #define LABEL_NAME_COLUMN 0
111 #define LABELED_POINT_COLUMN 1
112 #define LABEL_VISIBLE_COLUMN 2
113 #define LABEL_ID_COLUMN 3
114 
115 
116 
117 using std::vector;
118 using std::cout;
119 using std::endl;
120 
121 namespace lvr2
122 {
123 
124 class LVRMainWindow : public QMainWindow, public Ui::MainWindow
125 {
126  Q_OBJECT
127 public:
128 
132  LVRMainWindow();
133  virtual ~LVRMainWindow();
134  std::mutex display_mutex;
135 
136 public Q_SLOTS:
137  void updateDisplayLists(actorMap lowRes, actorMap highRes);
138 
139  //std::unordered_map<size_t, vtkSmartPointer<MeshChunkActor> > lowResActors,
140  // std::unordered_map<size_t, vtkSmartPointer<MeshChunkActor> > highResActors);
141 
142 
143  void comboBoxIndexChanged(int index);
144  void addNewInstance(QTreeWidgetItem *);
145  void loadModel();
146  void loadModels(const QStringList& filenames);
147  void loadChunkedMesh();
148  void loadChunkedMesh(const QStringList& filenames, std::vector<std::string> layers, int cacheSize, float highResDistance);
149  void manualICP();
150  void manualLabeling();
151  void changePicker(bool labeling);
152  void showLabelTreeContextMenu(const QPoint&);
153  void updatePointCount(const uint16_t, const int);
154 
155  void cellSelected(QTreeWidgetItem* item, int column);
156  void addLabelClass();
157 
159  void showTreeContextMenu(const QPoint&);
160  void showColorDialog();
162  void showErrorDialog();
164  void showHistogramDialog();
165  void renameModelItem();
166  void estimateNormals();
170  void optimizePlanes();
171  void removeArtifacts();
172  void applyMLSProjection();
173  void removeOutliers();
174  void deleteModelItem();
175  void copyModelItem();
176  void pasteModelItem();
177  void loadPointCloudData();
178  void unloadPointCloudData();
179  void changePointSize(int pointSize);
180  void changeTransparency(int transparencyValue);
181  void changeShading(int shader);
182 
183  void showImage();
184  void setViewToCamera();
185 
187  void changeSpectralColor();
189  void onSpectralSliderChanged(int action = -1);
194 
196  void changeGradientColor();
198  void onGradientSliderChanged(int action = -1);
203 
204  void assertToggles();
205  void togglePoints(bool checkboxState);
206  void toggleNormals(bool checkboxState);
207  void toggleMeshes(bool checkboxState);
208  void toggleWireframe(bool checkboxState);
209  void toogleEDL(bool checkboxstate);
210 
211  void refreshView();
212  void updateView();
213  void saveCamera();
214  void loadCamera();
215  void parseCommandLine(int argc, char** argv);
216  void openCameraPathTool();
217  void removeArrow(LVRVtkArrow*);
218  void addArrow(LVRVtkArrow*);
219  void alignPointClouds();
220  void exportSelectedModel();
221  void buildIncompatibilityBox(string actionName, unsigned char allowedTypes);
222  void showBackgroundDialog();
223 
225  void showPointInfoDialog();
227  void showPointPreview(vtkActor* actor, int point);
229  void updatePointPreview(int pointId, PointBufferPtr points);
230 
232  void updateSpectralSlidersEnabled(bool checked);
234  void updateSpectralGradientEnabled(bool checked);
235  QTreeWidgetItem* addScans(std::shared_ptr<ScanDataManager> sdm, QTreeWidgetItem *parent);
236 
237  LVRModelItem* getModelItem(QTreeWidgetItem* item);
238  LVRPointCloudItem* getPointCloudItem(QTreeWidgetItem* item);
239  QList<LVRPointCloudItem*> getPointCloudItems(QList<QTreeWidgetItem*> items);
240  LVRMeshItem* getMeshItem(QTreeWidgetItem* item);
241  std::set<LVRModelItem*> getSelectedModelItems();
242  std::set<LVRPointCloudItem*> getSelectedPointCloudItems();
243  std::set<LVRMeshItem*> getSelectedMeshItems();
244  void exportLabels();
245 
246 protected Q_SLOTS:
247  void setModelVisibility(QTreeWidgetItem* treeWidgetItem, int column);
249  void restoreSliders();
250  void highlightBoundingBoxes();
251 
252  void visibilityChanged(QTreeWidgetItem*, int);
253  void loadLabels();
254 
255 Q_SIGNALS:
256  void labelChanged(uint16_t);
258  void labelAdded(QTreeWidgetItem*);
259  void hidePoints(int, bool);
260  void labelLoaded(int, std::vector<int>);
261 
262 private:
263  void setupQVTK();
264  void connectSignalsAndSlots();
265  LVRModelItem* loadModelItem(QString name);
266  bool childNameExists(QTreeWidgetItem* item, const QString& name);
267  QString increaseFilename(QString filename);
268 
269  QList<QTreeWidgetItem*> m_items_copied;
272  std::map<LVRPointCloudItem*, LVRHistogram*> m_histograms;
276  QDialog* m_aboutDialog;
277  QDialog* m_errorDialog;
278  QMessageBox* m_incompatibilityBox;
279  vtkSmartPointer<vtkRenderer> m_renderer;
280  vtkSmartPointer<vtkRenderWindowInteractor> m_renderWindowInteractor;
281  vtkSmartPointer<vtkCamera> m_camera;
282  vtkSmartPointer<vtkCameraRepresentation> m_pathCamera;
283  vtkSmartPointer<vtkOrientationMarkerWidget> m_axesWidget;
284  vtkSmartPointer<vtkAxesActor> m_axes;
285 
287 // vtkSmartPointer<ChunkedMeshCuller> m_chunkCuller;
291 
294  // Toolbar item "File"
295  QAction* m_actionOpen;
297  QAction* m_actionExport;
298  QAction* m_actionQuit;
299  // Toolbar item "Views"
304  // Toolbar item "Reconstruction"
312  // Toolbar item "Mesh Optimization"
315  // Toolbar item "Filtering"
318  // Toolbar item "Registration"
322  // Toolbar item "Classification"
325  // Toolbar items "Labeling"
329  // Toolbar item "About"
330  QMenu* m_menuAbout;
331  // QToolbar below toolbar
341  // Sliders below tree widget
344  // Combo boxes below sliders
345  QComboBox* m_comboBoxGradient;
346  QComboBox* m_comboBoxShading;
347  // Buttons below combo boxes
349  QPushButton* m_buttonCreateMesh;
350  QPushButton* m_buttonExportData;
352  // Spectral Settings
353  QSlider* m_spectralSliders[3];
354  QCheckBox* m_spectralCheckboxes[3];
355  QLabel* m_spectralLabels[3];
356  QLineEdit* m_spectralLineEdits[3];
357  // Gradient Settings
359  QLineEdit* m_gradientLineEdit;
360  // ContextMenu Items
369 
372 
373  //Label
377 
381 
382 
383  // EDM Rendering
384 #ifdef LVR2_USE_VTK_GE_7_1
385  vtkSmartPointer<vtkRenderStepsPass> m_basicPasses;
386  vtkSmartPointer<vtkEDLShading> m_edl;
387 #endif
388 
389  bool m_labeling = false;
390  int m_id = 1;
391  static const string UNKNOWNNAME;
392  QTreeWidgetItem* m_selectedLabelItem;
393 
394  enum TYPE {
402  };
403 };
404 
405 } /* namespace lvr2 */
406 
407 #endif /* MAINWINDOW_HPP_ */
QAction * m_actionOpenChunkedMesh
QAction * m_actionRenameModelItem
void updatePointPreview(int pointId, PointBufferPtr points)
Changes the Point displayed by the PointPreview.
void buildIncompatibilityBox(string actionName, unsigned char allowedTypes)
QAction * m_actionShowSpectralPointPreview
QPushButton * m_buttonCameraPathTool
QAction * m_actionSetViewToCamera
QSlider * m_horizontalSliderPointSize
QAction * m_actionShow_Wireframe
LVRLabelInteractorStyle * m_labelInteractor
QLineEdit * m_gradientLineEdit
vtkSmartPointer< vtkCamera > m_camera
QComboBox * m_comboBoxGradient
void showLabelTreeContextMenu(const QPoint &)
std::set< LVRModelItem * > getSelectedModelItems()
void onSpectralSliderChanged(int action=-1)
Determines if changeSpectralColor() should be called. Updates the m_spectralLineEdit to the value fro...
QPushButton * m_buttonTransformModel
QList< QTreeWidgetItem * > m_items_copied
QAction * m_actionRemove_Outliers
void loadModels(const QStringList &filenames)
QAction * m_actionPlanar_Optimization
QAction * m_actionMatch_Textures_from_Package
LVRPointCloudItem * getPointCloudItem(QTreeWidgetItem *item)
QMessageBox * m_incompatibilityBox
LVRPlotter * m_PointPreviewPlotter
void cellSelected(QTreeWidgetItem *item, int column)
void changePicker(bool labeling)
ChunkedMeshBridgePtr m_chunkBridge
void addNewInstance(QTreeWidgetItem *)
std::unordered_map< size_t, vtkSmartPointer< vtkActor > > actorMap
QAction * m_actionExtract_labeling
QAction * m_actionStop_labeling
QAction * m_actionRemoveInstance
void correspondenceDialogOpened()
QAction * m_actionExtract_and_Rematch_Patterns
ChunkedMeshCuller * m_chunkCuller
QAction * m_actionShowSpectralColorGradient
void onSpectralLineEditSubmit()
Same as onSpectralLineEditChanged(), but triggers changeSpectralView()
LVRMeshItem * getMeshItem(QTreeWidgetItem *item)
QAction * m_actionUnloadPointCloudData
std::map< LVRPointCloudItem *, LVRHistogram * > m_histograms
std::set< LVRPointCloudItem * > getSelectedPointCloudItems()
QAction * m_actionMLS_Projection
QAction * m_actionReset_Camera
QAction * m_actionAddNewInstance
LVRLabelDialog * m_labelDialog
static const string UNKNOWNNAME
vtkSmartPointer< vtkRenderWindowInteractor > m_renderWindowInteractor
std::shared_ptr< PointBuffer > PointBufferPtr
QAction * m_actionExportModelTransformed
void labelLoaded(int, std::vector< int >)
QAction * m_actionShow_Normals
QAction * m_actionGlobal_Relaxation
LVRTreeWidgetHelper * m_treeWidgetHelper
void reconstructUsingMarchingCubes()
void showTreeContextMenu(const QPoint &)
void onGradientSliderChanged(int action=-1)
Determines if changeGradientColor() should be called. Updates the m_gradientLineEdit to the value fro...
void reconstructUsingPlanarMarchingCubes()
QAction * m_actionLoadPointCloudData
QSlider * m_horizontalSliderTransparency
void updateSpectralGradientEnabled(bool checked)
Switches between Sliders and Gradients. checked == true => Gradient DockWidget enabled.
QPushButton * m_buttonExportData
vtkSmartPointer< vtkOrientationMarkerWidget > m_axesWidget
void changeTransparency(int transparencyValue)
QList< LVRPointCloudItem * > getPointCloudItems(QList< QTreeWidgetItem *> items)
QAction * m_actionStart_labeling
void updateSpectralSlidersEnabled(bool checked)
Switches between Sliders and Gradients. checked == true => Slider DockWidget enabled.
LVRModelItem * loadModelItem(QString name)
QAction * m_actionPasteModelItem
void showErrorDialog()
Shows a Popup Dialog saying that no PointClouds with spectral data are selected.
QAction * m_actionRemove_Artifacts
void changeShading(int shader)
QLabel * m_spectralLabels[3]
QMenu * m_treeChildItemContextMenu
QMenu * m_labelTreeParentItemContextMenu
void onSpectralLineEditChanged()
Updates the m_spectralSlider to the value from m_spectralLineEdit.
LVRMainWindow()
MainWindow.
QAction * m_actionStore_Current_View
QTreeWidgetItem * m_selectedLabelItem
void changeGradientColor()
Updates all selected LVRPointCloudItems to the desired Gradient. can take seconds ...
QCheckBox * m_spectralCheckboxes[3]
void toogleEDL(bool checkboxstate)
QAction * m_actionShowSpectralSlider
QAction * m_actionICP_Using_Manual_Correspondance
std::set< LVRMeshItem * > getSelectedMeshItems()
QAction * m_actionICP_Using_Pose_Estimations
QMenu * m_treeParentItemContextMenu
void onGradientLineEditSubmit()
Same as onGradientLineEditChanged(), but triggers changeGradientView()
void changePointSize(int pointSize)
QAction * m_actionCopyModelItem
void visibilityChanged(QTreeWidgetItem *, int)
QSlider * m_spectralSliders[3]
void removeArrow(LVRVtkArrow *)
QTreeWidgetItem * addScans(std::shared_ptr< ScanDataManager > sdm, QTreeWidgetItem *parent)
void onGradientLineEditChanged()
Updates the m_gradientSlider to the value from m_gradientLineEdit.
QAction * m_actionExtended_Marching_Cubes
void comboBoxIndexChanged(int index)
QAction * m_actionPlanar_Marching_Cubes
bool childNameExists(QTreeWidgetItem *item, const QString &name)
LVRPickingInteractor * m_pickingInteractor
QAction * m_actionShowColorDialog
QAction * m_actionShowBackgroundSettings
QAction * m_actionCameraPathTool
QAction * m_actionMarching_Cubes
QAction * m_actionEstimate_Normals
QLineEdit * m_spectralLineEdits[3]
QPushButton * m_buttonCreateMesh
QAction * m_actionFurniture_Recognition
vtkSmartPointer< vtkAxesActor > m_axes
A wrapper class to generate arrow actors for vtk based on VTK&#39;s oriented arrow example.
Definition: LVRVtkArrow.hpp:49
void reconstructUsingExtendedMarchingCubes()
void toggleWireframe(bool checkboxState)
void setModelVisibility(QTreeWidgetItem *treeWidgetItem, int column)
void parseCommandLine(int argc, char **argv)
void changeSpectralColor()
Updates all selected LVRPointCloudItems to the desired Spectral. can take seconds ...
QComboBox * m_comboBoxShading
QAction * m_actionRecall_Stored_View
QAction * m_actionShow_Points
void togglePoints(bool checkboxState)
void updateDisplayLists(actorMap lowRes, actorMap highRes)
void toggleNormals(bool checkboxState)
void labelChanged(uint16_t)
LVRModelItem * getModelItem(QTreeWidgetItem *item)
void showHistogramDialog()
Shows a Popup Dialog with the average Intensity per Spectral Channel.
QAction * m_actionAddLabelClass
void restoreSliders()
Adjusts all the Sliders, LineEdits and CheckBoxes to the currently selected Items.
QAction * m_actionSimple_Plane_Classification
QAction * m_actionDeleteModelItem
void hidePoints(int, bool)
vtkSmartPointer< vtkRenderer > m_renderer
void addArrow(LVRVtkArrow *)
QString increaseFilename(QString filename)
QAction * m_actionShowSpectralHistogram
QAction * m_actionCompute_Textures
QMenu * m_labelTreeChildItemContextMenu
boost::shared_ptr< LVRChunkedMeshBridge > ChunkedMeshBridgePtr
void updatePointCount(const uint16_t, const int)
void showPointInfoDialog()
Shows a Popup Dialog with Information about a Point.
PointBufferPtr m_previewPointBuffer
void labelAdded(QTreeWidgetItem *)
LVRCorrespondanceDialog * m_correspondanceDialog
void showPointPreview(vtkActor *actor, int point)
Shows the DockerWidget with the preview of the PointInfoDialog.
vtkSmartPointer< vtkCameraRepresentation > m_pathCamera
char ** argv
void toggleMeshes(bool checkboxState)


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:08