diff --git a/q3DMASC.cpp b/q3DMASC.cpp index 65506bf..6675140 100644 --- a/q3DMASC.cpp +++ b/q3DMASC.cpp @@ -120,8 +120,8 @@ void q3DMASCPlugin::doClassifyAction() QList cloudLabels; QString corePointsLabel; bool filenamesSpecified = false; - QMap labelMapName; - if (!masc::Tools::LoadClassifierCloudLabels(inputFilename, cloudLabels, corePointsLabel, filenamesSpecified, labelMapName)) + QMap rolesAndNames; + if (!masc::Tools::LoadClassifierCloudLabels(inputFilename, cloudLabels, corePointsLabel, filenamesSpecified, rolesAndNames)) { m_app->dispToConsole("Failed to read classifier file (see Console)", ccMainAppInterface::ERR_CONSOLE_MESSAGE); return; @@ -139,7 +139,7 @@ void q3DMASCPlugin::doClassifyAction() //now show a dialog where the user will be able to set the cloud roles Classify3DMASCDialog classifDlg(m_app); - classifDlg.setCloudRoles(cloudLabels, corePointsLabel, labelMapName); + classifDlg.setCloudRoles(cloudLabels, corePointsLabel, rolesAndNames); classifDlg.label_trainOrClassify->setText(corePointsLabel + " will be classified"); classifDlg.classifierFileLineEdit->setText(inputFilename); classifDlg.testCloudComboBox->hide(); diff --git a/q3DMASCTools.cpp b/q3DMASCTools.cpp index 8b1f7b4..b391127 100644 --- a/q3DMASCTools.cpp +++ b/q3DMASCTools.cpp @@ -112,12 +112,12 @@ bool Tools::SaveClassifier( QString filename, return true; } -bool Tools::LoadClassifierCloudLabels(QString filename, QList& labels, QString& corePointsLabel, bool& filenamesSpecified, QMap& labelsAndNames) +bool Tools::LoadClassifierCloudLabels(QString filename, QList& labels, QString& corePointsLabel, bool& filenamesSpecified, QMap& rolesAndNames) { //just in case corePointsLabel.clear(); labels.clear(); - labelsAndNames.clear(); + rolesAndNames.clear(); QFile file(filename); if (!file.open(QFile::Text | QFile::ReadOnly)) @@ -156,7 +156,7 @@ bool Tools::LoadClassifierCloudLabels(QString filename, QList& labels, return false; } labels.push_back(label); - labelsAndNames[label] = tokens.back(); + rolesAndNames[label] = tokens.back(); if (tokens.size() > 1) ++filenameCount; diff --git a/q3DMASCTools.h b/q3DMASCTools.h index a3f142a..f424fa5 100644 --- a/q3DMASCTools.h +++ b/q3DMASCTools.h @@ -40,7 +40,7 @@ namespace masc static bool LoadTrainingFile(QString filename, Feature::Set& rawFeatures, std::vector& scales, NamedClouds& loadedClouds, TrainParameters& parameters, CorePoints* corePoints = nullptr, QWidget* parent = nullptr); - static bool LoadClassifierCloudLabels(QString filename, QList& labels, QString& corePointsLabel, bool& filenamesSpecified, QMap& labelsAndNames); + static bool LoadClassifierCloudLabels(QString filename, QList& labels, QString& corePointsLabel, bool& filenamesSpecified, QMap& rolesAndNames); static bool LoadClassifier(QString filename, NamedClouds& clouds, Feature::Set& rawFeatures, masc::Classifier& classifier, QWidget* parent = nullptr); diff --git a/qClassify3DMASCDialog.cpp b/qClassify3DMASCDialog.cpp index d9a6ba9..1cc4c95 100644 --- a/qClassify3DMASCDialog.cpp +++ b/qClassify3DMASCDialog.cpp @@ -90,7 +90,7 @@ Classify3DMASCDialog::Classify3DMASCDialog(ccMainAppInterface* app, bool trainMo testCloudComboBox->addItem("", 0); - //if 3 clouds are loaded, then there's chances that the first one is the global cloud! + //if 3 clouds are loaded, then there's chances that the first one is the global cloud! cloud1ComboBox->setCurrentIndex(/*cloudCount > 0 ? (cloudCount > 2 ? 1 : 0) : */-1); connect(cloud1ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCloudChanged(int))); cloud2ComboBox->setCurrentIndex(/*cloudCount > 1 ? (cloudCount > 2 ? 2 : 1) : */-1); @@ -143,13 +143,13 @@ void Classify3DMASCDialog::setComboBoxIndex(QMap rolesAndNames { QString name; - if (label != testLabel) + if (label == testLabel) { - name = rolesAndNames[label->text()]; + name = rolesAndNames[QString("TEST")]; // testLabel is specific, the role is always TEST } else { - name = rolesAndNames[QString("TEST")]; // this is because the label text of testLabel is 'TEST on (optional)' + name = rolesAndNames[label->text()]; } QMap::iterator it = namesAndUniqueIds.find(name); if (it != namesAndUniqueIds.end())