From 55c7181126aa7defce38c9b82872d14223d4c1dd Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Tue, 7 Feb 2017 17:33:01 +0100 Subject: Initial import of upstream's 1.3.1. --- GudhUI/gui/KNearestNeighborsMenu.ui | 150 ++++++++++++++++ GudhUI/gui/MainWindow.cpp | 299 ++++++++++++++++++++++++++++++++ GudhUI/gui/MainWindow.h | 118 +++++++++++++ GudhUI/gui/MenuEdgeContraction.ui | 118 +++++++++++++ GudhUI/gui/Menu_edge_contraction.cpp | 97 +++++++++++ GudhUI/gui/Menu_edge_contraction.h | 63 +++++++ GudhUI/gui/Menu_k_nearest_neighbors.cpp | 59 +++++++ GudhUI/gui/Menu_k_nearest_neighbors.h | 51 ++++++ GudhUI/gui/Menu_persistence.cpp | 53 ++++++ GudhUI/gui/Menu_persistence.h | 51 ++++++ GudhUI/gui/Menu_uniform_neighbors.cpp | 60 +++++++ GudhUI/gui/Menu_uniform_neighbors.h | 51 ++++++ GudhUI/gui/PersistenceMenu.ui | 139 +++++++++++++++ GudhUI/gui/UniformNeighborsMenu.ui | 153 ++++++++++++++++ GudhUI/gui/gudhui.cpp | 38 ++++ GudhUI/gui/main_window.ui | 255 +++++++++++++++++++++++++++ 16 files changed, 1755 insertions(+) create mode 100644 GudhUI/gui/KNearestNeighborsMenu.ui create mode 100644 GudhUI/gui/MainWindow.cpp create mode 100644 GudhUI/gui/MainWindow.h create mode 100644 GudhUI/gui/MenuEdgeContraction.ui create mode 100644 GudhUI/gui/Menu_edge_contraction.cpp create mode 100644 GudhUI/gui/Menu_edge_contraction.h create mode 100644 GudhUI/gui/Menu_k_nearest_neighbors.cpp create mode 100644 GudhUI/gui/Menu_k_nearest_neighbors.h create mode 100644 GudhUI/gui/Menu_persistence.cpp create mode 100644 GudhUI/gui/Menu_persistence.h create mode 100644 GudhUI/gui/Menu_uniform_neighbors.cpp create mode 100644 GudhUI/gui/Menu_uniform_neighbors.h create mode 100644 GudhUI/gui/PersistenceMenu.ui create mode 100644 GudhUI/gui/UniformNeighborsMenu.ui create mode 100644 GudhUI/gui/gudhui.cpp create mode 100644 GudhUI/gui/main_window.ui (limited to 'GudhUI/gui') diff --git a/GudhUI/gui/KNearestNeighborsMenu.ui b/GudhUI/gui/KNearestNeighborsMenu.ui new file mode 100644 index 00000000..472db48b --- /dev/null +++ b/GudhUI/gui/KNearestNeighborsMenu.ui @@ -0,0 +1,150 @@ + + + KNearestNeighborsMenu + + + + 0 + 0 + 298 + 209 + + + + k-nearest neighbors + + + + + 50 + 160 + 171 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 30 + 10 + 229 + 84 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + k + + + + + + + 10000000 + + + 0 + + + + + + + Metric + + + + + + + + Ambient + + + + + Reduced Space + + + + + + + + + + 30 + 110 + 250 + 40 + + + + + + + Compute + + + + + + + auto update + + + true + + + + + + + + + + buttonBox + accepted() + KNearestNeighborsMenu + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + KNearestNeighborsMenu + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/GudhUI/gui/MainWindow.cpp b/GudhUI/gui/MainWindow.cpp new file mode 100644 index 00000000..779ccd33 --- /dev/null +++ b/GudhUI/gui/MainWindow.cpp @@ -0,0 +1,299 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "MainWindow.h" + +#include +#include +#include + +#include + +#include "gui/Menu_k_nearest_neighbors.h" +#include "gui/Menu_uniform_neighbors.h" +#include "gui/Menu_edge_contraction.h" +#include "gui/Menu_persistence.h" + +MainWindow::MainWindow(QWidget* parent) : + menu_k_nearest_neighbors_(new Menu_k_nearest_neighbors(this)), + menu_uniform_neighbors_(new Menu_uniform_neighbors(this)), + menu_edge_contraction_(new Menu_edge_contraction(this, model_)), + menu_persistence_(new Menu_persistence(this)) { + // #ifndef NDEBUG // catch nan + // feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + // #endif + + setupUi(this); + + viewer_instructor_ = new Viewer_instructor( + this, + this->viewer, + model_.complex_); + + connectActions(); + + update_view(); +} + +void +MainWindow::closeEvent(QCloseEvent *event) { + exit(0); +} + +void +MainWindow::connectActions() { + QObject::connect(this->actionLoad_complex, SIGNAL(triggered()), this, + SLOT(off_file_open())); + QObject::connect(this->actionLoad_points, SIGNAL(triggered()), this, + SLOT(off_points_open())); + QObject::connect(this->actionSave_complex, SIGNAL(triggered()), this, + SLOT(off_file_save())); + QObject::connect(this->actionSave_points, SIGNAL(triggered()), this, + SLOT(off_points_save())); + + QObject::connect(this->actionShow_graph_stats, SIGNAL(triggered()), this, + SLOT(show_graph_stats())); + QObject::connect(this->actionShow_complex_stats, SIGNAL(triggered()), this, + SLOT(show_complex_stats())); + QObject::connect(this->actionShow_complex_dimension, SIGNAL(triggered()), this, + SLOT(show_complex_dimension())); + + QObject::connect(this->actionUniform_proximity_graph, SIGNAL(triggered()), this, + SLOT(build_rips_menu())); + QObject::connect(this->actionK_nearest_neighbors_graph, SIGNAL(triggered()), this, + SLOT(build_k_nearest_neighbors_menu())); + + + QObject::connect(this->actionContract_edges, SIGNAL(triggered()), this, + SLOT(contract_edge_menu())); + + QObject::connect(this->actionCollapse_vertices, SIGNAL(triggered()), this, + SLOT(collapse_vertices())); + + QObject::connect(this->actionCollapse_edges, SIGNAL(triggered()), this, + SLOT(collapse_edges())); + + QObject::connect(this->actionNoise, SIGNAL(triggered()), this, + SLOT(uniform_noise())); + QObject::connect(this->actionLloyd, SIGNAL(triggered()), this, + SLOT(lloyd())); + + + // view + QObject::connect(this->actionPoints, SIGNAL(triggered()), this->viewer_instructor_, + SLOT(change_draw_vertices())); + QObject::connect(this->actionEdges, SIGNAL(triggered()), this->viewer_instructor_, + SLOT(change_draw_edges())); + QObject::connect(this->actionTriangles, SIGNAL(triggered()), this->viewer_instructor_, + SLOT(change_draw_triangles())); + + // topology + QObject::connect(this->actionShow_homology_group, SIGNAL(triggered()), this, + SLOT(show_homology_group())); + QObject::connect(this->actionEuler_characteristic, SIGNAL(triggered()), this, + SLOT(show_euler_characteristic())); + QObject::connect(this->actionPersistence, SIGNAL(triggered()), this, + SLOT(persistence_menu())); + QObject::connect(this->actionEstimate_topological_changes, SIGNAL(triggered()), this, + SLOT(critical_points_menu())); + QObject::connect(this->actionIs_manifold, SIGNAL(triggered()), this, + SLOT(is_manifold_menu())); + + + QObject::connect(this, SIGNAL(sceneChanged()), this->viewer_instructor_, + SLOT(sceneChanged())); +} + +void +MainWindow::init_view() const { + viewer_instructor_->initialize_bounding_box(); + viewer_instructor_->show_entire_scene(); + update_view(); +} + +void +MainWindow::update_view() const { + emit(sceneChanged()); +} + +/** + * open a file chooser to choose an off to load + */ +void +MainWindow::off_file_open() { + QString fileName = QFileDialog::getOpenFileName(this, tr("Open off File"), + "~/", tr("off files (*.off)")); + if (!fileName.isEmpty()) { + model_.off_file_open(fileName.toStdString()); + init_view(); + } +} + +void +MainWindow::off_points_open() { + QString fileName = QFileDialog::getOpenFileName(this, tr("Open points in a off file"), + "~/", tr("off files (*.off)")); + if (!fileName.isEmpty()) { + model_.off_points_open(fileName.toStdString()); + init_view(); + } +} + +/** + * open a file chooser to choose an off to save + */ +void +MainWindow::off_file_save() { + QString fileName = QFileDialog::getOpenFileName(this, tr("Save to off File"), + "~/", tr("off files (*.off)")); + if (!fileName.isEmpty()) { + model_.off_file_save(fileName.toStdString()); + } +} + +/** + * open a file chooser to choose an off to save + */ +void +MainWindow::off_points_save() { + QString fileName = QFileDialog::getOpenFileName(this, tr("Save to off File"), + "~/", tr("off files (*.off)")); + if (!fileName.isEmpty()) { + model_.off_points_save(fileName.toStdString()); + } +} + +void +MainWindow::show_graph_stats() { + model_.show_graph_stats(); +} + +void +MainWindow::show_complex_stats() { + model_.show_complex_stats(); +} + +void +MainWindow::show_complex_dimension() { + model_.show_complex_dimension(); +} + +void +MainWindow::build_rips_menu() { + menu_uniform_neighbors_->show(); +} + +void +MainWindow::build_rips(double alpha) { + model_.build_rips(alpha); + update_view(); +} + +void +MainWindow::build_k_nearest_neighbors_menu() { + menu_k_nearest_neighbors_->show(); +} + +void +MainWindow::build_k_nearest_neighbors(unsigned k) { + model_.build_k_nearest_neighbors(k); + update_view(); +} + +void +MainWindow::contract_edge_menu() { + menu_edge_contraction_->show(); +} + +void +MainWindow::contract_edges(unsigned num_collapses) { + std::cerr << "Collapse " << num_collapses << " vertices\n"; + model_.contract_edges(num_collapses); + update_view(); +} + +void +MainWindow::collapse_edges() { + model_.collapse_edges(model_.num_edges()); + update_view(); +} + +void +MainWindow::collapse_vertices() { + std::cerr << "Collapse vertices edges\n"; + model_.collapse_vertices(0); + update_view(); +} + +void +MainWindow::uniform_noise() { + bool ok; + double amplitude = QInputDialog::getDouble(this, tr("Uniform noise"), + tr("Amplitude:"), 0, 0, 10000, 3, &ok); + srand(time(NULL)); + if (ok) + model_.uniform_noise(amplitude); +} + +void +MainWindow::lloyd() { + // todo 1 ask lloyd parameters + model_.lloyd(0, 0); + update_view(); +} + +void +MainWindow::show_homology_group() { + model_.show_homology_group(); +} + +void +MainWindow::show_euler_characteristic() { + model_.show_euler_characteristic(); +} + +void +MainWindow::persistence_menu() { + menu_persistence_->show(); +} + +void +MainWindow::compute_persistence(int p, double threshold, int max_dim, double min_pers) { + model_.show_persistence(p, threshold, max_dim, min_pers); +} + +void +MainWindow::critical_points_menu() { + bool ok; + double max_length = QInputDialog::getDouble(this, tr("Maximal edge length for the Rips"), + tr("Maximal edge length:"), 0, 0, 10000, 3, &ok); + if (ok) + model_.show_critical_points(max_length); +} + +void +MainWindow::is_manifold_menu() { + model_.show_is_manifold(); +} + + +#include "MainWindow.moc" diff --git a/GudhUI/gui/MainWindow.h b/GudhUI/gui/MainWindow.h new file mode 100644 index 00000000..c8c3fcf6 --- /dev/null +++ b/GudhUI/gui/MainWindow.h @@ -0,0 +1,118 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GUI_MAINWINDOW_H_ +#define GUI_MAINWINDOW_H_ + +// Workaround for moc-qt4 not parsing boost headers +#include + +#include +#include "ui_main_window.h" +#include "model/Model.h" +#include "view/Viewer_instructor.h" + + +class Menu_k_nearest_neighbors; +class Menu_uniform_neighbors; +class Menu_edge_contraction; +class Menu_persistence; + +class MainWindow : public QMainWindow, public Ui::MainWindow { + Q_OBJECT + + private: + Model model_; + Viewer_instructor* viewer_instructor_; + Menu_k_nearest_neighbors* menu_k_nearest_neighbors_; + Menu_uniform_neighbors* menu_uniform_neighbors_; + Menu_edge_contraction* menu_edge_contraction_; + Menu_persistence* menu_persistence_; + + public: + MainWindow(QWidget* parent = 0); + void connectActions(); + + /** + * compute the bounding box and calls update view + */ + void init_view() const; + void update_view() const; + + + protected: + void closeEvent(QCloseEvent *event); + + void keyPressEvent(QKeyEvent *event) { } + + public: + public slots: + /** + * open a file chooser to choose an off to load + */ + void off_file_open(); + + void off_points_open(); + + /** + * open a file chooser to choose an off to save + */ + void off_file_save(); + void off_points_save(); + + void show_graph_stats(); + void show_complex_stats(); + void show_complex_dimension(); + + + void build_rips_menu(); + void build_rips(double alpha); + void build_k_nearest_neighbors_menu(); + void build_k_nearest_neighbors(unsigned k); + + + void contract_edge_menu(); + void contract_edges(unsigned num_collapses); + + + void collapse_vertices(); + void collapse_edges(); + + + void uniform_noise(); + void lloyd(); + + void show_homology_group(); + void show_euler_characteristic(); + void persistence_menu(); + void compute_persistence(int p, double threshold, int max_dim, double min_pers); + void critical_points_menu(); + void is_manifold_menu(); + + + public: + signals: + void sceneChanged() const; +}; + + +#endif // GUI_MAINWINDOW_H_ diff --git a/GudhUI/gui/MenuEdgeContraction.ui b/GudhUI/gui/MenuEdgeContraction.ui new file mode 100644 index 00000000..b1696431 --- /dev/null +++ b/GudhUI/gui/MenuEdgeContraction.ui @@ -0,0 +1,118 @@ + + + MenuEdgeContraction + + + + 0 + 0 + 362 + 209 + + + + Edge contraction + + + + + + 1 + + + 999999999 + + + 1 + + + + + + + false + + + Link condition + + + true + + + + + + + 1 + + + + + + + Policy + + + + + + + + Length_midpoint + + + + + + + + 0 + + + + + + + Number of vertices + + + + + + + Number of contractions + + + + + + + Number of vertices after + + + + + + + 0 + + + 100 + + + Qt::Horizontal + + + + + + + Perform collapse + + + + + + + + diff --git a/GudhUI/gui/Menu_edge_contraction.cpp b/GudhUI/gui/Menu_edge_contraction.cpp new file mode 100644 index 00000000..a679b0bf --- /dev/null +++ b/GudhUI/gui/Menu_edge_contraction.cpp @@ -0,0 +1,97 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GUI_MENU_EDGE_CONTRACTION_CPP_ +#define GUI_MENU_EDGE_CONTRACTION_CPP_ + +#include "Menu_edge_contraction.h" + +Menu_edge_contraction::Menu_edge_contraction(MainWindow* parent, const Model& model) : + parent_(parent), model_(model) { + setupUi(this); + connectActions(parent_); +} + +void Menu_edge_contraction::connectActions(MainWindow* parent) { + QObject::connect( + this->horizontalSlider, + SIGNAL(valueChanged(int)), + this, + SLOT(slider_value_changed(int))); + + + QObject::connect(this, SIGNAL(contract_edges(unsigned)), parent, SLOT(contract_edges(unsigned))); + + QObject::connect(this->pushButton_collapse, SIGNAL(clicked()), this, SLOT(send_contract_edges())); +} + +void Menu_edge_contraction::slider_value_changed(int new_slider_value) { + int num_collapses = + (horizontalSlider->value() == 1) ? 1 : horizontalSlider->value() * model_.num_vertices() / 100; + this->txt_nb_vertices->setNum(static_cast(model_.num_vertices())); + this->txt_nb_collapses->setNum(num_collapses); + this->spinBox_nb_remaining_vertices->setValue(model_.num_vertices() - num_collapses); +} + +void +Menu_edge_contraction::update_slider_value() { + int num_vertices = model_.num_vertices(); + int num_collapses = (horizontalSlider->value() == 1) ? 1 : horizontalSlider->value() * num_vertices / 100; + int horizontal_slider_position = num_vertices > 0 ? num_collapses / static_cast(num_vertices * 100) : 1; + horizontalSlider->setValue(horizontal_slider_position); +} + +void +Menu_edge_contraction::update_gui_numbers() { + update_slider_value(); + bool ok; + int num_collapses = this->txt_nb_collapses->text().toInt(&ok, 10); + if (!ok) return; + this->txt_nb_vertices->setNum(static_cast(model_.num_vertices())); + this->txt_nb_collapses->setNum(num_collapses); + this->spinBox_nb_remaining_vertices->setValue(model_.num_vertices() - num_collapses); +} + +void +Menu_edge_contraction::update_gui_numbers(int new_value) { + update_gui_numbers(); +} + +void +Menu_edge_contraction::send_contract_edges() { + emit(contract_edges(num_collapses())); + update_gui_numbers(); +} + +unsigned +Menu_edge_contraction::num_vertices() { + return model_.num_vertices(); +} + +unsigned +Menu_edge_contraction::num_collapses() { + return (horizontalSlider->value() == 1) ? 1 : horizontalSlider->value() * num_vertices() / 100; +} + +#include "Menu_edge_contraction.moc" + +#endif // GUI_MENU_EDGE_CONTRACTION_CPP_ diff --git a/GudhUI/gui/Menu_edge_contraction.h b/GudhUI/gui/Menu_edge_contraction.h new file mode 100644 index 00000000..08f0bf67 --- /dev/null +++ b/GudhUI/gui/Menu_edge_contraction.h @@ -0,0 +1,63 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GUI_MENU_EDGE_CONTRACTION_H_ +#define GUI_MENU_EDGE_CONTRACTION_H_ + +// Workaround for moc-qt4 not parsing boost headers +#include + +#include "gui/MainWindow.h" +#include "gui/ui_MenuEdgeContraction.h" + +#include "model/Model.h" + +class Menu_edge_contraction : public QDialog, public Ui::MenuEdgeContraction { + Q_OBJECT + + private: + MainWindow* parent_; + const Model& model_; + + void update_slider_value(); + + public: + Menu_edge_contraction(MainWindow* parent, const Model& model); + + void connectActions(MainWindow* parent); + + private: + unsigned num_vertices(); + unsigned num_collapses(); + + public slots: + void slider_value_changed(int new_slider_value); + void update_gui_numbers(); + void update_gui_numbers(int gui_numbers); + + void send_contract_edges(); + + signals: + void contract_edges(unsigned num_collapses); +}; + +#endif // GUI_MENU_EDGE_CONTRACTION_H_ diff --git a/GudhUI/gui/Menu_k_nearest_neighbors.cpp b/GudhUI/gui/Menu_k_nearest_neighbors.cpp new file mode 100644 index 00000000..e24865f2 --- /dev/null +++ b/GudhUI/gui/Menu_k_nearest_neighbors.cpp @@ -0,0 +1,59 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "Menu_k_nearest_neighbors.h" + +Menu_k_nearest_neighbors::Menu_k_nearest_neighbors(QMainWindow* parent_) + : parent(parent_) { + setupUi(this); + connectActions(parent_); +} + +void Menu_k_nearest_neighbors::connectActions(QMainWindow* parent) { + QObject::connect(this->pushButtonCompute, + SIGNAL(clicked()), + this, + SLOT(send_compute_k_nearest_neighbors())); + QObject::connect(this->spinBoxK, + SIGNAL(valueChanged(int)), + this, + SLOT(update_k(int))); + QObject::connect(this, + SIGNAL(compute_k_nearest_neighbors(unsigned)), + parent, + SLOT(build_k_nearest_neighbors(unsigned))); +} + +void Menu_k_nearest_neighbors::send_compute_k_nearest_neighbors() { + emit(compute_k_nearest_neighbors((unsigned) spinBoxK->value())); +} + +void Menu_k_nearest_neighbors::accept() { + send_compute_k_nearest_neighbors(); +} + +void Menu_k_nearest_neighbors::update_k(int new_k_value) { + if (checkBoxAutoUpdate->isChecked()) + emit(compute_k_nearest_neighbors((unsigned) spinBoxK->value())); +} + +#include "Menu_k_nearest_neighbors.moc" diff --git a/GudhUI/gui/Menu_k_nearest_neighbors.h b/GudhUI/gui/Menu_k_nearest_neighbors.h new file mode 100644 index 00000000..8088b768 --- /dev/null +++ b/GudhUI/gui/Menu_k_nearest_neighbors.h @@ -0,0 +1,51 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GUI_MENU_K_NEAREST_NEIGHBORS_H_ +#define GUI_MENU_K_NEAREST_NEIGHBORS_H_ + +#include +#include "gui/ui_KNearestNeighborsMenu.h" + +class QWidget; + +class Menu_k_nearest_neighbors : public QDialog, public Ui::KNearestNeighborsMenu { + Q_OBJECT + + private: + QMainWindow* parent; + + public: + Menu_k_nearest_neighbors(QMainWindow* parent_); + + void connectActions(QMainWindow* parent); + + public slots: + void send_compute_k_nearest_neighbors(); + void update_k(int k); + void accept(); + + signals: + void compute_k_nearest_neighbors(unsigned k); +}; + +#endif // GUI_MENU_K_NEAREST_NEIGHBORS_H_ diff --git a/GudhUI/gui/Menu_persistence.cpp b/GudhUI/gui/Menu_persistence.cpp new file mode 100644 index 00000000..016c076b --- /dev/null +++ b/GudhUI/gui/Menu_persistence.cpp @@ -0,0 +1,53 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + + +#include "Menu_persistence.h" + +Menu_persistence::Menu_persistence(QMainWindow* parent_) : parent(parent_) { + setupUi(this); + connectActions(parent_); +} + +void Menu_persistence::connectActions(QMainWindow* parent) { + QObject::connect(this, + SIGNAL(compute_persistence(int, double, int, double)), + parent, + SLOT(compute_persistence(int, double, int, double))); +} + +void Menu_persistence::send_compute_persistence() { + emit(compute_persistence(p_spinBox->value(), threshold_doubleSpinBox->value(), + maxdimension_spinBox->value(), minpersistence_doubleSpinBox->value())); +} + +void Menu_persistence::accept() { + send_compute_persistence(); +} + +// void Menu_persistence::compute_persistence(int p_fied,double threshold,int dim_max,double min_persistence) { +// if(checkBoxAutoUpdate->isChecked()) +// emit(compute_k_nearest_neighbors((unsigned)spinBoxK->value())); +// } + +#include "Menu_persistence.moc" diff --git a/GudhUI/gui/Menu_persistence.h b/GudhUI/gui/Menu_persistence.h new file mode 100644 index 00000000..8c4df158 --- /dev/null +++ b/GudhUI/gui/Menu_persistence.h @@ -0,0 +1,51 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifndef GUI_MENU_PERSISTENCE_H_ +#define GUI_MENU_PERSISTENCE_H_ + +#include +#include "gui/ui_PersistenceMenu.h" + +class QWidget; + +class Menu_persistence : public QDialog, public Ui::PersistenceMenu { + Q_OBJECT + + private: + QMainWindow* parent; + + public: + Menu_persistence(QMainWindow* parent_); + + void connectActions(QMainWindow* parent); + + public slots: + void send_compute_persistence(); + void accept(); + + signals: + void compute_persistence(int p_fied, double threshold, int dim_max, double min_persistence); +}; + +#endif // GUI_MENU_PERSISTENCE_H_ diff --git a/GudhUI/gui/Menu_uniform_neighbors.cpp b/GudhUI/gui/Menu_uniform_neighbors.cpp new file mode 100644 index 00000000..20e4f98f --- /dev/null +++ b/GudhUI/gui/Menu_uniform_neighbors.cpp @@ -0,0 +1,60 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "Menu_uniform_neighbors.h" + +Menu_uniform_neighbors::Menu_uniform_neighbors(QMainWindow* parent_) : + parent(parent_) { + setupUi(this); + connectActions(parent_); +} + +void Menu_uniform_neighbors::connectActions(QMainWindow* parent) { + QObject::connect(this->pushButtonCompute, + SIGNAL(clicked()), + this, + SLOT(send_compute_uniform_neighbors())); + QObject::connect(this->doubleSpinBoxAlpha, + SIGNAL(valueChanged(double)), + this, + SLOT(update_alpha(double))); + QObject::connect(this, + SIGNAL(compute_uniform_neighbors(double)), + parent, + SLOT(build_rips(double))); +} + +void Menu_uniform_neighbors::send_compute_uniform_neighbors() { + emit(compute_uniform_neighbors(doubleSpinBoxAlpha->value())); +} + +void Menu_uniform_neighbors::accept() { + send_compute_uniform_neighbors(); +} + +void Menu_uniform_neighbors::update_alpha(double alpha) { + if (checkBoxAutoUpdate->isChecked()) + emit(compute_uniform_neighbors(doubleSpinBoxAlpha->value())); +} + +#include "Menu_uniform_neighbors.moc" diff --git a/GudhUI/gui/Menu_uniform_neighbors.h b/GudhUI/gui/Menu_uniform_neighbors.h new file mode 100644 index 00000000..0b6f65fe --- /dev/null +++ b/GudhUI/gui/Menu_uniform_neighbors.h @@ -0,0 +1,51 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifndef GUI_MENU_UNIFORM_NEIGHBORS_H_ +#define GUI_MENU_UNIFORM_NEIGHBORS_H_ + +#include +#include "gui/ui_UniformNeighborsMenu.h" + +class Menu_uniform_neighbors : public QDialog, public Ui::UniformMenu { + Q_OBJECT + + private: + QMainWindow* parent; + + public: + Menu_uniform_neighbors(QMainWindow* parent_); + + void connectActions(QMainWindow* parent); + + public slots: + void send_compute_uniform_neighbors(); + void update_alpha(double alpha); + void accept(); + + signals: + void compute_uniform_neighbors(double alpha); +}; + + +#endif // GUI_MENU_UNIFORM_NEIGHBORS_H_ diff --git a/GudhUI/gui/PersistenceMenu.ui b/GudhUI/gui/PersistenceMenu.ui new file mode 100644 index 00000000..29327db2 --- /dev/null +++ b/GudhUI/gui/PersistenceMenu.ui @@ -0,0 +1,139 @@ + + + PersistenceMenu + + + + 0 + 0 + 354 + 275 + + + + Point cloud persistence + + + + + 20 + 23 + 318 + 226 + + + + + + + + + 2 + + + 2 + + + + + + + Coefficient Z/pZ + + + + + + + 9999 + + + 10 + + + + + + + Max dimension + + + + + + + 9999.000000000000000 + + + 1.000000000000000 + + + + + + + Max Rips offset + + + + + + + + + + Minimum Persistence + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + buttonBox + accepted() + PersistenceMenu + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + PersistenceMenu + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/GudhUI/gui/UniformNeighborsMenu.ui b/GudhUI/gui/UniformNeighborsMenu.ui new file mode 100644 index 00000000..f8ef7a24 --- /dev/null +++ b/GudhUI/gui/UniformNeighborsMenu.ui @@ -0,0 +1,153 @@ + + + UniformMenu + + + + 0 + 0 + 292 + 209 + + + + Uniform neighbors (Rips) + + + + + 50 + 160 + 171 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 30 + 10 + 262 + 84 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + alpha + + + + + + + Metric + + + + + + + + Ambient + + + + + Reduced Space + + + + + + + + 3 + + + 100000000.000000000000000 + + + 0.100000000000000 + + + + + + + + + 30 + 110 + 250 + 40 + + + + + + + Compute + + + + + + + auto update + + + true + + + + + + + + + + buttonBox + accepted() + UniformMenu + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + UniformMenu + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/GudhUI/gui/gudhui.cpp b/GudhUI/gui/gudhui.cpp new file mode 100644 index 00000000..276c4a5f --- /dev/null +++ b/GudhUI/gui/gudhui.cpp @@ -0,0 +1,38 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "MainWindow.h" +#include +#include + +int main(int argc, char** argv) { + QApplication application(argc, argv); + application.setOrganizationDomain("inria.fr"); + application.setOrganizationName("INRIA"); + application.setApplicationName("GudhUI"); + + MainWindow mw; + application.setQuitOnLastWindowClosed(false); + mw.show(); + return application.exec(); +} diff --git a/GudhUI/gui/main_window.ui b/GudhUI/gui/main_window.ui new file mode 100644 index 00000000..312480b6 --- /dev/null +++ b/GudhUI/gui/main_window.ui @@ -0,0 +1,255 @@ + + + MainWindow + + + + 0 + 0 + 861 + 880 + + + + GudhUI + + + QTabWidget::Rounded + + + + + + + + + false + + + + + + + + + + + 0 + 0 + 861 + 34 + + + + + File + + + + + + + + + Points + + + + + + Graph + + + + + + + + Complex + + + + + + + + + + View + + + + + + + + + Topology + + + + + + + + + + + + + + + + + + Load points + + + + + Load complex + + + + + Save points + + + + + Save complex + + + + + Noise + + + + + Lloyd + + + + + Uniform proximity graph + + + + + k-nearest neighbors graph + + + + + Show graph stats + + + + + Graph expansion + + + + + Delaunay from points + + + + + Contract edges + + + + + Collapse vertices + + + + + Collapse edges + + + + + Points + + + + + Edges + + + + + Triangles + + + + + Change projection + + + + + Show complex stats + + + + + Show complex dimension + + + + + Homology groups + + + + + Point cloud persistence + + + + + true + + + Euler characteristic + + + true + + + + + Homology groups + + + + + false + + + Rips critical points approximation + + + false + + + + + Is manifold + + + + + + Viewer + QWidget +
view/Viewer.h
+
+
+ + +
-- cgit v1.2.3