ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
qTreeIso.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 // #######################################################################################
11 // # # # ACLOUDVIEWER PLUGIN: qTreeIso # # # # This
12 // program is free software; you can redistribute it and/or modify # #
13 // it under the terms of the GNU General Public License as published by # # the
14 // Free Software Foundation; version 2 or later of the License. # #
15 // # # This program is distributed in the hope that it will be useful, #
16 // # but WITHOUT ANY WARRANTY; without even the implied warranty of # #
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU
18 // General Public License for more details. # # # # Please cite the
19 // following paper if you find this tool helpful # # # # Xi, Z.;
20 // Hopkinson, C. 3D Graph-Based Individual-Tree Isolation (Treeiso) # # from
21 // Terrestrial Laser Scanning Point Clouds. Remote Sens. 2022, 14, 6116. # #
22 // https://doi.org/10.3390/rs14236116 # # # # Our work relies on
23 // the cut-pursuit algorithm, please also consider citing: # # Landrieu, L.;
24 // Obozinski, G. Cut Pursuit: Fast Algorithms to Learn Piecewise # # Constant
25 // Functions on General Weighted Graphs. SIAM J. Imaging Sci. # # 2017,
26 // 10, 1724–1766. # # # # Copyright © # #
27 // Artemis Lab, Department of Geography & Environment # #
28 // University of Lethbridge, Canada # # # # # # Zhouxin
29 // Xi and Chris Hopkinson; # #
30 // truebelief2010@gmail.com; c.hopkinson@uleth.ca # # #
31 // #######################################################################################
32 
33 // A Matlab version shared via:
34 // https://github.com/truebelief/artemis_treeiso
35 
36 #include "ecvStdPluginInterface.h"
37 
38 class ccTreeIsoDlg;
39 
41 class qTreeIso : public QObject, public ccStdPluginInterface {
42  Q_OBJECT
44 
45  Q_PLUGIN_METADATA(IID "ecvcorp.cloudviewer.plugin.qTreeISO" FILE
46  "../info.json")
47 
48 public:
50  explicit qTreeIso(QObject* parent = nullptr);
52  virtual ~qTreeIso() = default;
53 
54  // inherited from ccStdPluginInterface
55  void onNewSelection(const ccHObject::Container& selectedEntities) override;
56  QList<QAction*> getActions() override;
57  void registerCommands(ccCommandLineInterface* cmd) override;
58 
60  struct Parameters {
61  float reg_strength1 = 1.0f; // lambda1
62  int min_nn1 = 5; // K1:key parameter
63  float decimate_res1 = 0.05f;
64 
65  int reg_strength2 = 20; // lambda2:key parameter
66  int min_nn2 = 20; // K2:key parameter
67  float decimate_res2 = 0.1f;
68  float max_gap = 2.0f;
69 
70  float rel_height_length_ratio = 0.5f; // rho
71  float vertical_weight = 0.5; // w:key parameter
72  };
73 
74 protected:
76  void doAction();
77 
78  void init_segs(const Parameters& parameters, QWidget* parent = nullptr);
79  void intermediate_segs(const Parameters& parameters,
80  QWidget* parent = nullptr);
81  void final_segs(const Parameters& parameters, QWidget* parent = nullptr);
82 
83 protected: // members
85  QAction* m_action;
86 };
Command line interface.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
Definition: ecvHObject.h:337
Standard ECV plugin interface.
Standard ECV plugin interface.
Dialog for qTreeIso plugin.
Definition: ccTreeIsoDlg.h:18
TreeIso plugin.
Definition: qTreeIso.h:41
void final_segs(const Parameters &parameters, QWidget *parent=nullptr)
Definition: qTreeIso.cpp:163
QAction * m_action
Associated action.
Definition: qTreeIso.h:85
void init_segs(const Parameters &parameters, QWidget *parent=nullptr)
Definition: qTreeIso.cpp:112
void intermediate_segs(const Parameters &parameters, QWidget *parent=nullptr)
Definition: qTreeIso.cpp:136
void doAction()
Slot called when associated ation is triggered.
Definition: qTreeIso.cpp:70
Parameters()=default
Default initializer.