ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvDeepSemanticSegmentationTool.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include <ecvOverlayDialog.h>
12 
13 // GUI
14 #include <ui_deepSemanticSegmentationDlg.h>
15 
16 // CV_CORE_LIB
17 #include <ClassMap.h>
18 
19 // CV_DB_LIB
20 #include <ecvHObject.h>
21 
22 // CV_PYTHON_LIB
23 #ifdef USE_PYTHON_MODULE
24 #include <recognition/PythonInterface.h>
25 
26 class ecvDeepSemanticSegmentationTool : public ccOverlayDialog,
27  public Ui::DeepSemanticSegmentationDlg {
28  Q_OBJECT
29 
30 public:
31  ecvDeepSemanticSegmentationTool(QWidget* parent = nullptr);
32  virtual ~ecvDeepSemanticSegmentationTool();
33 
35 
39  bool addEntity(ccHObject* entity);
40 
42  unsigned getNumberOfValidEntities() const;
43 
44  // inherited from ccOverlayDialog
45  virtual bool start() override;
46  virtual void stop(bool state) override;
47  virtual bool linkWith(QWidget* win) override;
48 
49  void clear();
50 
51  void getSegmentations(ccHObject::Container& result);
52 
53 public slots:
54  void apply();
55 
56  void detect();
57 
58  void cancel();
59 
60 protected:
61  bool m_show_progress;
62 
63  ccHObject m_entity;
64  ccHObject m_selectedEntity;
65 
66  std::vector<std::vector<size_t>> m_clusters;
67 
68  std::vector<ClassMap::ClusterMap> m_clusters_map;
69 
70 private:
71  void doCompute();
72  int checkSelected();
73  int startDetection();
74  void selectAllClasses();
75  int performSegmentation();
76  void updateSelectedEntity();
77  void refreshSelectedClouds();
78  void exportClustersToSF();
79  void exportClustersToEntities(ccHObject::Container& result);
80  void getSelectedFilterClasses(std::vector<size_t>& filteredClasses);
81 };
82 
83 #endif
static void doCompute()
#define slots
core::Tensor result
Definition: VtkUtils.cpp:76
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
Definition: ecvHObject.h:337
Generic overlay dialog interface.
virtual void stop(bool accepted)
Stops process/dialog.
virtual bool start()
Starts process.
virtual bool linkWith(QWidget *win)
Links the overlay dialog with a MDI window.