summaryrefslogtreecommitdiff
path: root/src/GudhUI
diff options
context:
space:
mode:
authorsalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-01-27 15:09:04 +0000
committersalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-01-27 15:09:04 +0000
commite8e889c52c96a3055a1237c389186cb08b0f6708 (patch)
treec7879f69d52a9cdde35f38ac2718ec9d8ce7815a /src/GudhUI
parentd7a3c90ef611b1c104b6a4ee900b56bf39d56cf5 (diff)
critical poitns
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@432 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 27e660f593f25a00cbd8b1794ed83bb76fd34eea
Diffstat (limited to 'src/GudhUI')
-rw-r--r--src/GudhUI/CMakeLists.txt11
-rw-r--r--src/GudhUI/gui/MainWindow.cpp12
-rw-r--r--src/GudhUI/gui/MainWindow.h2
-rw-r--r--src/GudhUI/gui/UniformNeighborsMenu.ui5
-rw-r--r--src/GudhUI/gui/main_window.ui18
-rw-r--r--src/GudhUI/model/Model.h9
-rw-r--r--src/GudhUI/utils/K_nearest_builder.h5
-rw-r--r--src/GudhUI/utils/Persistence_compute.h2
8 files changed, 50 insertions, 14 deletions
diff --git a/src/GudhUI/CMakeLists.txt b/src/GudhUI/CMakeLists.txt
index 769e1d30..b62be8ff 100644
--- a/src/GudhUI/CMakeLists.txt
+++ b/src/GudhUI/CMakeLists.txt
@@ -3,12 +3,12 @@ project(GudhUI)
#Specify Gudhi's path here
#for instance
-set(Gudhi_Path "C:/Users/dsalinas/Documents/Recherche/Code/c++/Gudhi_library_1.1.0/include")
-#set(Gudhi_Path "/home/dsalinas/Documents/CodeSVN/gudhi/src/include")
+#set(Gudhi_Path "C:/Users/dsalinas/Documents/Recherche/Code/c++/Gudhi_library_1.1.0/include")
+set(Gudhi_Path "/home/dsalinas/Documents/CodeSVN/gudhi/src/include")
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018 -frounding-math")
else()
- list(APPEND CMAKE_CXX_FLAGS "-std=c++11 -Wall -pedantic -frounding-math")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic -frounding-math")
endif()
set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
@@ -16,11 +16,10 @@ set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
find_package(Boost REQUIRED COMPONENTS)
find_package(CGAL COMPONENTS Qt4)
find_package(Qt4)
-find_package(OpenGL)
find_package(QGLViewer)
+find_package(OpenGL)
if ( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
-
set( QT_USE_QTXML TRUE )
set( QT_USE_QTMAIN TRUE )
set( QT_USE_QTSCRIPT TRUE )
@@ -38,7 +37,7 @@ if ( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
include_directories(.)
include_directories(${Gudhi_Path})
-
+
# qt : ui file, created wih Qt Designer ###############
set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gui")
qt4_wrap_ui( uis
diff --git a/src/GudhUI/gui/MainWindow.cpp b/src/GudhUI/gui/MainWindow.cpp
index f1dd8e83..f5abfffc 100644
--- a/src/GudhUI/gui/MainWindow.cpp
+++ b/src/GudhUI/gui/MainWindow.cpp
@@ -96,8 +96,8 @@ MainWindow::connectActions(){
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, SIGNAL(sceneChanged()), this->viewer_instructor_,
SLOT(sceneChanged()));
@@ -278,6 +278,14 @@ MainWindow::compute_persistence(int p,double threshold,int max_dim,double min_pe
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);
+}
#include "MainWindow.moc"
diff --git a/src/GudhUI/gui/MainWindow.h b/src/GudhUI/gui/MainWindow.h
index 0eef29ed..506a1f3a 100644
--- a/src/GudhUI/gui/MainWindow.h
+++ b/src/GudhUI/gui/MainWindow.h
@@ -83,7 +83,7 @@ public:
void show_euler_characteristic();
void persistence_menu();
void compute_persistence(int p,double threshold,int max_dim,double min_pers);
-
+ void critical_points_menu();
public:
diff --git a/src/GudhUI/gui/UniformNeighborsMenu.ui b/src/GudhUI/gui/UniformNeighborsMenu.ui
index 1f7cf980..f8ef7a24 100644
--- a/src/GudhUI/gui/UniformNeighborsMenu.ui
+++ b/src/GudhUI/gui/UniformNeighborsMenu.ui
@@ -34,7 +34,7 @@
<rect>
<x>30</x>
<y>10</y>
- <width>249</width>
+ <width>262</width>
<height>84</height>
</rect>
</property>
@@ -72,6 +72,9 @@
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxAlpha">
+ <property name="decimals">
+ <number>3</number>
+ </property>
<property name="maximum">
<double>100000000.000000000000000</double>
</property>
diff --git a/src/GudhUI/gui/main_window.ui b/src/GudhUI/gui/main_window.ui
index ac3caf41..8a7ad7da 100644
--- a/src/GudhUI/gui/main_window.ui
+++ b/src/GudhUI/gui/main_window.ui
@@ -89,6 +89,7 @@
<addaction name="actionEuler_characteristic"/>
<addaction name="actionShow_homology_group"/>
<addaction name="actionPersistence"/>
+ <addaction name="actionEstimate_topological_changes"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuPoints"/>
@@ -209,15 +210,32 @@
</property>
</action>
<action name="actionEuler_characteristic">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
<property name="text">
<string>Euler characteristic</string>
</property>
+ <property name="visible">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionHomology_groups">
<property name="text">
<string>Homology groups</string>
</property>
</action>
+ <action name="actionEstimate_topological_changes">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Rips critical points approximation</string>
+ </property>
+ <property name="visible">
+ <bool>false</bool>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
diff --git a/src/GudhUI/model/Model.h b/src/GudhUI/model/Model.h
index ab92d0cf..39bbd9d8 100644
--- a/src/GudhUI/model/Model.h
+++ b/src/GudhUI/model/Model.h
@@ -19,6 +19,7 @@
#include "utils/Edge_collapsor.h"
#include "utils/Edge_contractor.h"
#include "utils/Persistence_compute.h"
+#include "utils/Critical_points.h"
#include "gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h"
#include "gudhi/Skeleton_blocker_geometric_complex.h"
@@ -234,8 +235,8 @@ public:
void show_homology_group(){
-#ifndef _WIN32
- std::cout << "Works only on linux for the moment\n";
+#ifdef _WIN32
+ std::cout << "Works only on linux x64 for the moment\n";
#else
Clock clock;
run_chomp();
@@ -263,6 +264,10 @@ public:
Persistence_compute<Complex> persistence(complex_,std::cout,Persistence_params(p,threshold,max_dim,min_pers));
}
+ void show_critical_points(double max_distance){
+ Critical_points<Complex> critical_points(complex_,std::cout,max_distance);
+ }
+
private:
void run_chomp(){
diff --git a/src/GudhUI/utils/K_nearest_builder.h b/src/GudhUI/utils/K_nearest_builder.h
index f31e6c0c..b65a79e0 100644
--- a/src/GudhUI/utils/K_nearest_builder.h
+++ b/src/GudhUI/utils/K_nearest_builder.h
@@ -27,7 +27,7 @@ private:
typedef Geometry_trait Kernel;
typedef Point Point_d;
- typedef boost::tuple<Point_d, int> Point_d_with_id;
+ typedef boost::tuple<Point_d, unsigned> Point_d_with_id;
typedef CGAL::Search_traits_d<Kernel> Traits_base;
typedef CGAL::Search_traits_adapter<Point_d_with_id, CGAL::Nth_of_tuple_property_map<0, Point_d_with_id>, Traits_base> Traits;
typedef CGAL::Orthogonal_k_neighbor_search<Traits> Neighbor_search;
@@ -64,10 +64,11 @@ private:
Tree tree(points_with_id.begin(),points_with_id.end());
+ typedef typename SkBlComplex::Vertex_handle Vertex_handle;
for (auto p : complex_.vertex_range()){
Neighbor_search search(tree, complex_.point(p),k+1);
for(auto it = ++search.begin(); it != search.end(); ++it){
- auto q = boost::get<1>(it->first);
+ Vertex_handle q(boost::get<1>(it->first));
if (p != q && complex_.contains_vertex(p) && complex_.contains_vertex(q))
complex_.add_edge(p,q);
}
diff --git a/src/GudhUI/utils/Persistence_compute.h b/src/GudhUI/utils/Persistence_compute.h
index 7b310e5c..0ddc205a 100644
--- a/src/GudhUI/utils/Persistence_compute.h
+++ b/src/GudhUI/utils/Persistence_compute.h
@@ -89,6 +89,8 @@ public:
pcoh.init_coefficients( params.p ); //initilizes the coefficient field for homology
pcoh.compute_persistent_cohomology( INFINITY ); //put params.min_persistence
stream_<<"persistence: \n";
+ stream_<<"p dimension birth death: \n";
+
pcoh.output_diagram(stream_);
}