2018-10-26 12:02:23 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
//##########################################################################
|
|
|
|
|
//# #
|
|
|
|
|
//# CLOUDCOMPARE PLUGIN: q3DMASC #
|
|
|
|
|
//# #
|
|
|
|
|
//# This program is free software; you can redistribute it and/or modify #
|
|
|
|
|
//# it under the terms of the GNU General Public License as published by #
|
|
|
|
|
//# the Free Software Foundation; version 2 or later of the License. #
|
|
|
|
|
//# #
|
|
|
|
|
//# This program is distributed in the hope that it will be useful, #
|
|
|
|
|
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
|
|
|
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
|
|
|
//# GNU General Public License for more details. #
|
|
|
|
|
//# #
|
|
|
|
|
//# COPYRIGHT: Dimitri Lague / CNRS / UEB #
|
|
|
|
|
//# #
|
|
|
|
|
//##########################################################################
|
|
|
|
|
|
2018-10-28 21:22:04 +01:00
|
|
|
//Local
|
2018-11-04 19:23:11 +01:00
|
|
|
#include "FeaturesInterface.h"
|
2018-11-04 23:31:48 +01:00
|
|
|
#include "q3DMASCClassifier.h"
|
2018-10-26 12:02:23 +02:00
|
|
|
|
|
|
|
|
//CCLib
|
2018-11-04 00:06:47 +01:00
|
|
|
#include <GenericProgressCallback.h>
|
|
|
|
|
|
|
|
|
|
//qCC_db
|
|
|
|
|
class ccPointCloud;
|
2018-10-26 12:02:23 +02:00
|
|
|
|
|
|
|
|
class QWidget;
|
|
|
|
|
|
|
|
|
|
//! 3DMASC classifier
|
|
|
|
|
namespace masc
|
|
|
|
|
{
|
|
|
|
|
class Tools
|
|
|
|
|
{
|
|
|
|
|
public:
|
2018-10-28 21:22:04 +01:00
|
|
|
|
2019-01-21 00:10:47 +01:00
|
|
|
typedef QMap<QString, ccPointCloud* > NamedClouds;
|
|
|
|
|
|
2022-10-27 18:55:04 +02:00
|
|
|
static bool LoadTrainingFile(QString filename, Feature::Set& rawFeatures, std::vector<double>& scales, NamedClouds& loadedClouds, TrainParameters& parameters, CorePoints* corePoints = nullptr, QWidget* parent = nullptr);
|
2018-10-28 21:22:04 +01:00
|
|
|
|
2019-03-26 14:28:27 +01:00
|
|
|
static bool LoadClassifierCloudLabels(QString filename, QList<QString>& labels, QString& corePointsLabel, bool& filenamesSpecified);
|
2018-11-04 23:31:48 +01:00
|
|
|
|
2019-03-27 22:12:51 +01:00
|
|
|
static bool LoadClassifier(QString filename, NamedClouds& clouds, Feature::Set& rawFeatures, masc::Classifier& classifier, QWidget* parent = nullptr);
|
|
|
|
|
|
|
|
|
|
static bool LoadFile( const QString& filename,
|
|
|
|
|
Tools::NamedClouds* clouds,
|
|
|
|
|
bool cloudsAreProvided,
|
|
|
|
|
std::vector<Feature::Shared>* rawFeatures = nullptr, //requires 'clouds'
|
2022-10-27 18:55:04 +02:00
|
|
|
std::vector<double>* rawScales = nullptr,
|
2019-03-27 22:12:51 +01:00
|
|
|
masc::CorePoints* corePoints = nullptr, //requires 'clouds'
|
|
|
|
|
masc::Classifier* classifier = nullptr,
|
|
|
|
|
TrainParameters* parameters = nullptr,
|
|
|
|
|
QWidget* parent = nullptr);
|
|
|
|
|
|
|
|
|
|
static bool SaveClassifier(QString filename, const Feature::Set& features, const QString corePointsRole, const masc::Classifier& classifier, QWidget* parent = nullptr);
|
2018-11-04 19:23:11 +01:00
|
|
|
|
2023-05-30 15:41:04 +02:00
|
|
|
static bool PrepareFeatures(const CorePoints& corePoints, Feature::Set& features, QString& error,
|
|
|
|
|
CCCoreLib::GenericProgressCallback* progressCb = nullptr, SFCollector* generatedScalarFields = nullptr);
|
2018-11-03 00:23:08 +01:00
|
|
|
|
2020-06-04 00:32:27 +02:00
|
|
|
static bool RandomSubset(ccPointCloud* cloud, float ratio, CCCoreLib::ReferenceCloud* inRatioSubset, CCCoreLib::ReferenceCloud* outRatioSubset);
|
2018-11-04 11:21:50 +01:00
|
|
|
|
2020-06-04 00:32:27 +02:00
|
|
|
static CCCoreLib::ScalarField* RetrieveSF(const ccPointCloud* cloud, const QString& sfName, bool caseSensitive = true);
|
2019-04-05 11:15:57 +02:00
|
|
|
|
|
|
|
|
//! Helper: returns the classification SF associated to a cloud (if any)
|
2020-06-04 00:32:27 +02:00
|
|
|
static CCCoreLib::ScalarField* GetClassificationSF(const ccPointCloud* cloud);
|
2018-10-26 12:02:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}; //namespace masc
|