ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
qTrain3DMASCDialog.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 // # #
12 // # ACLOUDVIEWER PLUGIN: q3DMASC #
13 // # #
14 // # This program is free software; you can redistribute it and/or modify #
15 // # it under the terms of the GNU General Public License as published by #
16 // # the Free Software Foundation; version 2 or later of the License. #
17 // # #
18 // # This program is distributed in the hope that it will be useful, #
19 // # but WITHOUT ANY WARRANTY; without even the implied warranty of #
20 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
21 // # GNU General Public License for more details. #
22 // # #
23 // # COPYRIGHT: Dimitri Lague / CNRS / UEB #
24 // # #
25 // ##########################################################################
26 
27 // Qt
28 #include <ui_Train3DMASCDialog.h>
29 
30 #include <QDialog>
31 #include <QFile>
32 
33 // Qt5/Qt6 Compatibility
34 #include <QtCompat.h>
35 
36 #include "confusionmatrix.h"
37 
39 class Train3DMASCDialog : public QDialog, public Ui::Train3DMASCDialog {
40  Q_OBJECT
41 
42 public:
44  Train3DMASCDialog(QWidget* parent = nullptr);
46 
47  void readSettings();
48  void writeSettings();
49 
50  void clearResults();
51 
53 
55  int addFeature(QString name, float importance, bool isChecked = true);
56  int addScale(double scale, bool isChecked = true);
57  void scaleStateChanged(QTableWidgetItem* item);
59  void setResultText(QString text);
60  void setFirstRunDone();
61  inline void setClassifierSaved() {
62  classifierSaved = true;
63  saveRequested = false;
64  }
65 
66  bool isFeatureSelected(QString featureName) const;
67  void setFeatureImportance(QString featureName, float importance);
69 
70  inline bool shouldSaveClassifier() const { return saveRequested; }
71 
73  void setInputFilePath(QString filename);
74  void setCheckBoxSaveTrace(bool state);
75  bool openTraceFile();
76  bool closeTraceFile();
77  void saveTraces(ConfusionMatrix* confusionMatrix);
78  bool getSaveTrace();
79  QString getTracePath();
80  int getRun();
81 
82 protected slots:
83 
84  void onClose();
85  void onSave();
86  void onExportResults(QString filePath = "");
87 
88 protected: // members
91  std::vector<ConfusionMatrix*> toDeleteLater;
93  QFile* m_traceFile;
94  QString m_tracePath;
95  QTextStream m_traceStream;
97  QString m_baseName;
99 };
std::string filename
std::string name
#define slots
3DMASC plugin 'train' dialog
void connectScaleSelectionToFeatureSelection()
void saveTraces(ConfusionMatrix *confusionMatrix)
void addConfusionMatrixAndSaveTraces(ConfusionMatrix *ptr)
void setInputFilePath(QString filename)
bool isFeatureSelected(QString featureName) const
QTextStream m_traceStream
int addFeature(QString name, float importance, bool isChecked=true)
Adds a feature (entry) to the results table.
int addScale(double scale, bool isChecked=true)
bool shouldSaveClassifier() const
void setCheckBoxSaveTrace(bool state)
void scaleStateChanged(QTableWidgetItem *item)
Train3DMASCDialog(QWidget *parent=nullptr)
Default constructor.
std::vector< ConfusionMatrix * > toDeleteLater
void setFeatureImportance(QString featureName, float importance)
void onExportResults(QString filePath="")
void setResultText(QString text)
unsigned int uint
Definition: cutil_math.h:28