15 #include <QApplication>
17 #include <QMainWindow>
18 #include <QPushButton>
29 : QDialog(app ? app->getActiveWindow() : 0),
34 int maxThreadCount = QThread::idealThreadCount();
35 maxThreadCountSpinBox->setRange(1, maxThreadCount);
36 maxThreadCountSpinBox->setSuffix(QString(
"/%1").arg(maxThreadCount));
37 maxThreadCountSpinBox->setValue(maxThreadCount);
41 connect(template1CloudComboBox, SIGNAL(currentIndexChanged(
int)),
this,
43 connect(template2CloudComboBox, SIGNAL(currentIndexChanged(
int)),
this,
57 unsigned cloudCount = 0;
58 template1CloudComboBox->clear();
59 template2CloudComboBox->clear();
60 evaluationCloudComboBox->clear();
61 for (
size_t i = 0; i < clouds.size(); ++i) {
66 QVariant uniqueID(clouds[i]->getUniqueID());
67 template1CloudComboBox->addItem(
name, uniqueID);
68 template2CloudComboBox->addItem(
name, uniqueID);
69 evaluationCloudComboBox->addItem(
name, uniqueID);
76 template1CloudComboBox->setCurrentIndex(
77 cloudCount > 0 ? (cloudCount > 2 ? 1 : 0) : -1);
78 template2CloudComboBox->setCurrentIndex(
79 cloudCount > 1 ? (cloudCount > 2 ? 2 : 1) : -1);
81 if (cloudCount < 1 &&
m_app)
89 int c1 = template1CloudComboBox->currentIndex();
90 if (template1checkBox->isChecked()) {
95 int c2 = template2CloudComboBox->currentIndex();
96 if (template2checkBox->isChecked()) {
102 if (template1checkBox->isChecked() && template2checkBox->isChecked()) {
103 if (c1 == c2)
return false;
110 return maxThreadCountSpinBox->value();
114 return static_cast<float>(normalRadiusSpinBox->value());
118 return static_cast<float>(featureRadiusSpinBox->value());
122 return static_cast<float>(minSampleDistanceSpinBox->value());
126 return static_cast<float>(maxCorrespondenceDistanceSpinBox->value() *
127 maxCorrespondenceDistanceSpinBox->value());
131 return maxIterationsSpinBox->value();
135 if (useVoxelGridCheckBox->isChecked()) {
136 return static_cast<float>(leafSizeSpinBox->value());
146 if (scalesRampRadioButton->isChecked()) {
147 double maxScale = maxScaleDoubleSpinBox->value();
148 double step = stepScaleDoubleSpinBox->value();
149 double minScale = minScaleDoubleSpinBox->value();
150 if (maxScale < minScale || maxScale < 0 || step < 1.0e-6)
153 static_cast<unsigned>(
154 floor((maxScale - minScale) / step + 1.0e-6)) +
156 scales.resize(stepCount);
157 for (
unsigned i = 0; i < stepCount; ++i)
158 scales[i] =
static_cast<float>(maxScale - i * step);
159 }
else if (scalesListRadioButton->isChecked()) {
160 QStringList scaleList = scalesListLineEdit->text().split(
163 int listSize = scaleList.size();
164 scales.resize(listSize);
165 for (
int i = 0; i < listSize; ++i) {
168 f = scaleList[i].toFloat(&ok);
169 if (!ok)
return false;
175 }
catch (
const std::bad_alloc&) {
183 buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
validParameters());
188 if (template1checkBox->isChecked()) {
197 if (template2checkBox->isChecked()) {
210 QSettings settings(
"templateAlignment");
211 settings.beginGroup(
"Align");
249 QSettings settings(
"templateAlignment");
250 settings.beginGroup(
"Align");
272 if (
name.isEmpty())
name = tr(
"unnamed");
280 assert(comboBox && dbRoot);
281 if (!comboBox || !dbRoot) {
287 int index = comboBox->currentIndex();
292 unsigned uniqueID = comboBox->itemData(index).toUInt();
CANUPO plugin's training dialog.
float getMaxCorrespondenceDistance() const
Returns the Maximum Correspondence Distance.
TemplateAlignmentDialog(ecvMainAppInterface *app)
Default constructor.
float getFeatureRadius() const
Returns the Feature Radius.
bool validParameters() const
float getVoxelGridLeafSize() const
float getMinSampleDistance() const
Returns the Minimum Sample Distance.
ecvMainAppInterface * m_app
Gives access to the application (data-base, UI, etc.)
void loadParamsFromPersistentSettings()
Loads parameters from persistent settings.
bool getScales(std::vector< float > &scales) const
Returns input scales.
int getMaxIterations() const
Returns the Maximum Iterations.
int getMaxThreadCount() const
Returns the max number of threads to use.
void saveParamsToPersistentSettings()
Saves parameters to persistent settings.
ccPointCloud * getTemplate1Cloud()
Get template #1 point cloud.
float getNormalRadius() const
Returns the Normal Radius.
void refreshCloudComboBox()
ccPointCloud * getCloudFromCombo(QComboBox *comboBox, ccHObject *dbRoot)
ccPointCloud * getTemplate2Cloud()
Get template #2 point cloud.
ccPointCloud * getEvaluationCloud()
Get evaluation point cloud.
QString getEntityName(ccHObject *obj)
Hierarchical CLOUDVIEWER Object.
ccHObject * find(unsigned uniqueID)
Finds an entity in this object hierarchy.
unsigned filterChildren(Container &filteredChildren, bool recursive=false, CV_CLASS_ENUM filter=CV_TYPES::OBJECT, bool strict=false) const
Collects the children corresponding to a certain pattern.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
virtual QString getName() const
Returns object name.
virtual unsigned getUniqueID() const
Returns object unique ID.
bool isA(CV_CLASS_ENUM type) const
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Main application interface (for plugins)
virtual ccHObject * dbRootObject()=0
Returns DB root (as a ccHObject)
virtual void dispToConsole(QString message, ConsoleMessageLevel level=STD_CONSOLE_MESSAGE)=0
constexpr Qt::SplitBehavior SkipEmptyParts
MiniVec< float, N > floor(const MiniVec< float, N > &a)