ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
q3DMASCTools.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 // Local
28 #include "FeaturesInterface.h"
29 #include "q3DMASCClassifier.h"
30 
31 // CCLib
33 
34 // qCC_db
35 class ccPointCloud;
36 
37 class QWidget;
38 
40 namespace masc {
41 class Tools {
42 public:
43  typedef QMap<QString, ccPointCloud*> NamedClouds;
44 
45  static bool LoadTrainingFile(QString filename,
46  Feature::Set& rawFeatures,
47  std::vector<double>& scales,
48  NamedClouds& loadedClouds,
49  TrainParameters& parameters,
50  CorePoints* corePoints = nullptr,
51  QWidget* parent = nullptr);
52 
53  static bool LoadClassifierCloudLabels(
54  QString filename,
55  QList<QString>& labels,
56  QString& corePointsLabel,
57  bool& filenamesSpecified,
58  QMap<QString, QString>& rolesAndNames);
59 
60  static bool LoadClassifier(QString filename,
61  NamedClouds& clouds,
62  Feature::Set& rawFeatures,
63  masc::Classifier& classifier,
64  QWidget* parent = nullptr);
65 
66  static bool LoadFile(
67  const QString& filename,
68  Tools::NamedClouds* clouds,
69  bool cloudsAreProvided,
70  std::vector<Feature::Shared>* rawFeatures =
71  nullptr, // requires 'clouds'
72  std::vector<double>* rawScales = nullptr,
73  masc::CorePoints* corePoints = nullptr, // requires 'clouds'
74  masc::Classifier* classifier = nullptr,
75  TrainParameters* parameters = nullptr,
76  QWidget* parent = nullptr);
77 
78  static bool SaveClassifier(QString filename,
79  const Feature::Set& features,
80  const QString corePointsRole,
81  const masc::Classifier& classifier,
82  QWidget* parent = nullptr);
83 
84  static bool PrepareFeatures(
85  const CorePoints& corePoints,
86  Feature::Set& features,
87  QString& error,
88  cloudViewer::GenericProgressCallback* progressCb = nullptr,
89  SFCollector* generatedScalarFields = nullptr);
90 
91  static bool RandomSubset(ccPointCloud* cloud,
92  float ratio,
93  cloudViewer::ReferenceCloud* inRatioSubset,
94  cloudViewer::ReferenceCloud* outRatioSubset);
95 
97  const QString& sfName,
98  bool caseSensitive = true);
99 
102  const ccPointCloud* cloud);
103 };
104 
105 }; // namespace masc
std::string filename
SF collector.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
A very simple point cloud (no point duplication)
A simple scalar field (to be associated to a point cloud)
Definition: ScalarField.h:25
static bool RandomSubset(ccPointCloud *cloud, float ratio, cloudViewer::ReferenceCloud *inRatioSubset, cloudViewer::ReferenceCloud *outRatioSubset)
static bool LoadFile(const QString &filename, Tools::NamedClouds *clouds, bool cloudsAreProvided, std::vector< Feature::Shared > *rawFeatures=nullptr, std::vector< double > *rawScales=nullptr, masc::CorePoints *corePoints=nullptr, masc::Classifier *classifier=nullptr, TrainParameters *parameters=nullptr, QWidget *parent=nullptr)
static bool LoadClassifier(QString filename, NamedClouds &clouds, Feature::Set &rawFeatures, masc::Classifier &classifier, QWidget *parent=nullptr)
static cloudViewer::ScalarField * RetrieveSF(const ccPointCloud *cloud, const QString &sfName, bool caseSensitive=true)
static bool PrepareFeatures(const CorePoints &corePoints, Feature::Set &features, QString &error, cloudViewer::GenericProgressCallback *progressCb=nullptr, SFCollector *generatedScalarFields=nullptr)
static bool LoadClassifierCloudLabels(QString filename, QList< QString > &labels, QString &corePointsLabel, bool &filenamesSpecified, QMap< QString, QString > &rolesAndNames)
static bool LoadTrainingFile(QString filename, Feature::Set &rawFeatures, std::vector< double > &scales, NamedClouds &loadedClouds, TrainParameters &parameters, CorePoints *corePoints=nullptr, QWidget *parent=nullptr)
static cloudViewer::ScalarField * GetClassificationSF(const ccPointCloud *cloud)
Helper: returns the classification SF associated to a cloud (if any)
static bool SaveClassifier(QString filename, const Feature::Set &features, const QString corePointsRole, const masc::Classifier &classifier, QWidget *parent=nullptr)
QMap< QString, ccPointCloud * > NamedClouds
Definition: q3DMASCTools.h:43
static void error(char *msg)
Definition: lsd.c:159
3DMASC classifier
cloudViewer::GenericIndexedCloud * corePoints
Core points descriptor.
Definition: CorePoints.h:39
std::vector< Shared > Set
Set of features.