This is an automated email from the git hooks/post-receive script. sebastic-guest pushed a commit to branch upstream-master in repository pktools.
commit 85f5c0c2ef113f6fe2003785058a93b8908b432b Author: Pieter Kempeneers <pieter.kempene...@vito.be> Date: Tue Apr 1 11:32:35 2014 +0200 added pksvm_gui --- qt/pkclassify_svm/main.cpp | 11 - qt/pkclassify_svm/mainwindow.h | 51 --- qt/pkclassify_svm/pkclassify_svm.pro | 20 - qt/pkextract/mainwindow.cc | 34 -- qt/pkextract/mainwindow.h | 58 ++- qt/pkextract/mainwindow.ui | 528 +++++++++++++++++++++++- qt/pkextract/pkextract.pro | 32 +- qt/{pkextract/main.cc => pksvm_gui/main.cpp} | 5 +- qt/{pkclassify_svm => pksvm_gui}/mainwindow.cpp | 85 +++- qt/{pkextract => pksvm_gui}/mainwindow.h | 39 +- qt/{pkclassify_svm => pksvm_gui}/mainwindow.ui | 55 ++- qt/pksvm_gui/pksvm_gui.pro | 41 ++ 12 files changed, 775 insertions(+), 184 deletions(-) diff --git a/qt/pkclassify_svm/main.cpp b/qt/pkclassify_svm/main.cpp deleted file mode 100644 index b48f94e..0000000 --- a/qt/pkclassify_svm/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "mainwindow.h" -#include <QApplication> - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - - return a.exec(); -} diff --git a/qt/pkclassify_svm/mainwindow.h b/qt/pkclassify_svm/mainwindow.h deleted file mode 100644 index e7d7dd2..0000000 --- a/qt/pkclassify_svm/mainwindow.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include <QMainWindow> - -namespace Ui { -class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -private slots: - void on_actionInput_triggered(); - - void on_actionTraining_triggered(); - - void on_actionMask_triggered(); - - void on_actionOutput_triggered(); - - void on_toolButton_input_clicked(); - - void on_toolButton_mask_clicked(); - - void on_toolButton_output_clicked(); - - void on_toolButton_training_clicked(); - - void on_training_returnPressed(); - - void on_pushButton_run_clicked(); - - void on_lineEdit_2_returnPressed(); - -private: - void setClassTable(const QStringList &labels); - - Ui::MainWindow *ui; - QString m_input; - QString m_training; - QString m_mask; - QString m_output; -}; - -#endif // MAINWINDOW_H diff --git a/qt/pkclassify_svm/pkclassify_svm.pro b/qt/pkclassify_svm/pkclassify_svm.pro deleted file mode 100644 index 002f3d8..0000000 --- a/qt/pkclassify_svm/pkclassify_svm.pro +++ /dev/null @@ -1,20 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2014-03-21T13:16:29 -# -#------------------------------------------------- - -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = pkclassify_svm -TEMPLATE = app - - -SOURCES += main.cpp\ - mainwindow.cpp - -HEADERS += mainwindow.h - -FORMS += mainwindow.ui diff --git a/qt/pkextract/mainwindow.cc b/qt/pkextract/mainwindow.cc deleted file mode 100644 index 791bb0c..0000000 --- a/qt/pkextract/mainwindow.cc +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************************** -mainwindow.cc -Copyright (C) 2008-2014 Pieter Kempeneers - -This file is part of pktools - -pktools 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. - -pktools 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 pktools. If not, see <http://www.gnu.org/licenses/>. -***********************************************************************/ - -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); -} - -MainWindow::~MainWindow() -{ - delete ui; -} diff --git a/qt/pkextract/mainwindow.h b/qt/pkextract/mainwindow.h index c4006c4..de398a7 100644 --- a/qt/pkextract/mainwindow.h +++ b/qt/pkextract/mainwindow.h @@ -1,23 +1,3 @@ -/********************************************************************** -mainwindow.h -Copyright (C) 2008-2014 Pieter Kempeneers - -This file is part of pktools - -pktools 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. - -pktools 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 pktools. If not, see <http://www.gnu.org/licenses/>. -***********************************************************************/ - #ifndef MAINWINDOW_H #define MAINWINDOW_H @@ -30,13 +10,47 @@ class MainWindow; class MainWindow : public QMainWindow { Q_OBJECT - + public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); - + +private slots: + void on_actionInput_triggered(); + + void on_actionTraining_triggered(); + + void on_actionMask_triggered(); + + void on_actionOutput_triggered(); + + void on_toolButton_input_clicked(); + + void on_toolButton_mask_clicked(); + + void on_toolButton_output_clicked(); + + void on_toolButton_training_clicked(); + + void on_training_returnPressed(); + + void on_pushButton_run_clicked(); + + void on_lineEdit_2_returnPressed(); + + void on_toolButton_createTable_clicked(); + + void on_pushButton_restore_clicked(); + private: + void setClassTable(const QStringList &labels); + void setDefaults(); + Ui::MainWindow *ui; + QString m_input; + QString m_training; + QString m_mask; + QString m_output; }; #endif // MAINWINDOW_H diff --git a/qt/pkextract/mainwindow.ui b/qt/pkextract/mainwindow.ui index 6050363..5eb6f74 100644 --- a/qt/pkextract/mainwindow.ui +++ b/qt/pkextract/mainwindow.ui @@ -1,24 +1,528 @@ +<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="geometry" > + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>400</width> - <height>300</height> + <width>423</width> + <height>458</height> </rect> </property> - <property name="windowTitle" > - <string>MainWindow</string> + <property name="windowTitle"> + <string>pksvm</string> </property> - <widget class="QMenuBar" name="menuBar" /> - <widget class="QToolBar" name="mainToolBar" /> - <widget class="QWidget" name="centralWidget" /> - <widget class="QStatusBar" name="statusBar" /> + <widget class="QWidget" name="centralWidget"> + <widget class="QTabWidget" name="tabWidget"> + <property name="geometry"> + <rect> + <x>10</x> + <y>30</y> + <width>391</width> + <height>341</height> + </rect> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Input/Output</string> + </attribute> + <widget class="QLabel" name="label_3"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Input image (raster or vector) containing band information</p></body></html></string> + </property> + <property name="text"> + <string>Input data</string> + </property> + </widget> + <widget class="QLineEdit" name="input"> + <property name="geometry"> + <rect> + <x>80</x> + <y>10</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_input"> + <property name="geometry"> + <rect> + <x>200</x> + <y>10</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLabel" name="label_13"> + <property name="geometry"> + <rect> + <x>10</x> + <y>40</y> + <width>61</width> + <height>16</height> + </rect> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Pixels in input image where mask image has msknodata will not be classified, but obtain a constant value (=nodata)</p></body></html></string> + </property> + <property name="text"> + <string>Mask image</string> + </property> + </widget> + <widget class="QLineEdit" name="mask"> + <property name="geometry"> + <rect> + <x>80</x> + <y>40</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_mask"> + <property name="geometry"> + <rect> + <x>200</x> + <y>40</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLabel" name="label_14"> + <property name="geometry"> + <rect> + <x>230</x> + <y>40</y> + <width>61</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>msknodata</string> + </property> + </widget> + <widget class="QLineEdit" name="msknodata"> + <property name="geometry"> + <rect> + <x>290</x> + <y>40</y> + <width>41</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_15"> + <property name="geometry"> + <rect> + <x>10</x> + <y>100</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Classified map (raster or vector according to input image).</p></body></html></string> + </property> + <property name="text"> + <string>Output data</string> + </property> + </widget> + <widget class="QLineEdit" name="output"> + <property name="geometry"> + <rect> + <x>80</x> + <y>100</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_output"> + <property name="geometry"> + <rect> + <x>200</x> + <y>100</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLineEdit" name="sample"> + <property name="geometry"> + <rect> + <x>80</x> + <y>70</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_sample"> + <property name="geometry"> + <rect> + <x>200</x> + <y>70</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLabel" name="label_23"> + <property name="geometry"> + <rect> + <x>10</x> + <y>70</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Pixels in input image where mask image has msknodata will not be classified, but obtain a constant value (=nodata)</p></body></html></string> + </property> + <property name="text"> + <string>Sample image</string> + </property> + </widget> + <widget class="QLabel" name="label_16"> + <property name="geometry"> + <rect> + <x>230</x> + <y>100</y> + <width>41</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>format</string> + </property> + </widget> + <widget class="QComboBox" name="f"> + <property name="geometry"> + <rect> + <x>270</x> + <y>100</y> + <width>69</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QCheckBox" name="polygon"> + <property name="geometry"> + <rect> + <x>230</x> + <y>130</y> + <width>71</width> + <height>17</height> + </rect> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Keep output features as polygons (only if input vector are polygons as well)</p></body></html></string> + </property> + <property name="text"> + <string>polygons</string> + </property> + </widget> + </widget> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Extract</string> + </attribute> + <widget class="QLineEdit" name="bname"> + <property name="geometry"> + <rect> + <x>200</x> + <y>80</y> + <width>41</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_2"> + <property name="geometry"> + <rect> + <x>10</x> + <y>80</y> + <width>191</width> + <height>16</height> + </rect> + </property> + <property name="toolTip"> + <string><html><head/><body><p>name of the attribute in your training vector file that corresponds to the class labels </p></body></html></string> + </property> + <property name="text"> + <string>attribute (prefix) name for raster info</string> + </property> + </widget> + <widget class="QTableView" name="tableView_classes"> + <property name="geometry"> + <rect> + <x>160</x> + <y>130</y> + <width>221</width> + <height>181</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_17"> + <property name="geometry"> + <rect> + <x>190</x> + <y>110</y> + <width>161</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>class name-threshold (%) pairs</string> + </property> + </widget> + <widget class="QLabel" name="label_20"> + <property name="geometry"> + <rect> + <x>10</x> + <y>150</y> + <width>91</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string>prepare table for</string> + </property> + </widget> + <widget class="QLineEdit" name="nclass"> + <property name="geometry"> + <rect> + <x>94</x> + <y>155</y> + <width>31</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_createTable"> + <property name="geometry"> + <rect> + <x>130</x> + <y>156</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>-></string> + </property> + </widget> + <widget class="QLabel" name="label_21"> + <property name="geometry"> + <rect> + <x>90</x> + <y>130</y> + <width>51</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string># classes</string> + </property> + </widget> + <widget class="QLabel" name="label_22"> + <property name="geometry"> + <rect> + <x>20</x> + <y>200</y> + <width>131</width> + <height>61</height> + </rect> + </property> + <property name="text"> + <string>replace label names with + the labels in your training + vector file</string> + </property> + </widget> + <widget class="QComboBox" name="rule"> + <property name="geometry"> + <rect> + <x>90</x> + <y>10</y> + <width>69</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_4"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="toolTip"> + <string><html><head/><body><p>name of the attribute in your training vector file that corresponds to the class labels </p></body></html></string> + </property> + <property name="text"> + <string>extraction rule</string> + </property> + </widget> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Command line</string> + </attribute> + <widget class="QLabel" name="label_18"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Command line</string> + </property> + </widget> + <widget class="QLineEdit" name="commandLineEdit"> + <property name="geometry"> + <rect> + <x>10</x> + <y>40</y> + <width>361</width> + <height>61</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_19"> + <property name="geometry"> + <rect> + <x>10</x> + <y>120</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Console output</string> + </property> + </widget> + <widget class="QPlainTextEdit" name="consoleEdit"> + <property name="geometry"> + <rect> + <x>10</x> + <y>140</y> + <width>361</width> + <height>171</height> + </rect> + </property> + </widget> + </widget> + </widget> + <widget class="QPushButton" name="pushButton_run"> + <property name="geometry"> + <rect> + <x>10</x> + <y>380</y> + <width>75</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Run</string> + </property> + </widget> + <widget class="QPushButton" name="pushButton_restore"> + <property name="geometry"> + <rect> + <x>320</x> + <y>10</y> + <width>91</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Restore defaults</string> + </property> + </widget> + </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>423</width> + <height>21</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>File</string> + </property> + <addaction name="actionInput"/> + <addaction name="actionMask"/> + <addaction name="actionTraining"/> + <addaction name="actionOutput"/> + </widget> + <addaction name="menuFile"/> + </widget> + <widget class="QToolBar" name="mainToolBar"> + <attribute name="toolBarArea"> + <enum>TopToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + </widget> + <widget class="QStatusBar" name="statusBar"/> + <action name="actionInput"> + <property name="text"> + <string>Input</string> + </property> + </action> + <action name="actionTraining"> + <property name="text"> + <string>Sample</string> + </property> + </action> + <action name="actionMask"> + <property name="text"> + <string>Mask</string> + </property> + </action> + <action name="actionOutput"> + <property name="text"> + <string>Output</string> + </property> + </action> </widget> - <layoutDefault spacing="6" margin="11" /> - <pixmapfunction></pixmapfunction> + <layoutdefault spacing="6" margin="11"/> <resources/> <connections/> </ui> diff --git a/qt/pkextract/pkextract.pro b/qt/pkextract/pkextract.pro index 75252b3..3f6203f 100644 --- a/qt/pkextract/pkextract.pro +++ b/qt/pkextract/pkextract.pro @@ -1,6 +1,6 @@ #------------------------------------------------- # -# Project created by QtCreator 2014-03-20T17:53:10 +# Project created by QtCreator 2014-03-21T13:16:29 # #------------------------------------------------- @@ -8,13 +8,35 @@ QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -TARGET = pkextract +TARGET = pksvm TEMPLATE = app -SOURCES += main.cc\ - mainwindow.cc +SOURCES += main.cpp\ + mainwindow.cpp -HEADERS += mainwindow.h +HEADERS += mainwindow.h \ + ../../src/imageclasses/ImgReaderOgr.h FORMS += mainwindow.ui + +#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../vis_studio/release/ -limageclasses +#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../vis_studio/debug/ -limageclasses +#else:unix: LIBS += -L$$PWD/../../vis_studio/ -limageclasses + +#INCLUDEPATH += $$PWD/../../src/imageclasses +#DEPENDPATH += $$PWD/../../src/imageclasses + +#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../vis_studio/install/lib/ -lgdal_i +#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../vis_studio/install/lib/ -lgdal_i +#else:unix: LIBS += -L$$PWD/../../../../vis_studio/install/lib/ -lgdal_i + +#INCLUDEPATH += $$PWD/../../../../vis_studio/install/include +#DEPENDPATH += $$PWD/../../../../vis_studio/install/include + +#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../vis_studio/release/ -lbase +#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../vis_studio/debug/ -lbase +#else:unix: LIBS += -L$$PWD/../../vis_studio/ -lbase + +#INCLUDEPATH += $$PWD/../../src +#DEPENDPATH += $$PWD/../../src/base diff --git a/qt/pkextract/main.cc b/qt/pksvm_gui/main.cpp similarity index 97% rename from qt/pkextract/main.cc rename to qt/pksvm_gui/main.cpp index b53cf84..f07fc9f 100644 --- a/qt/pkextract/main.cc +++ b/qt/pksvm_gui/main.cpp @@ -1,5 +1,5 @@ /********************************************************************** -main.cc +main.cpp: GUI for pktools Copyright (C) 2008-2014 Pieter Kempeneers This file is part of pktools @@ -17,7 +17,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with pktools. If not, see <http://www.gnu.org/licenses/>. ***********************************************************************/ - #include "mainwindow.h" #include <QApplication> @@ -26,6 +25,6 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); MainWindow w; w.show(); - + return a.exec(); } diff --git a/qt/pkclassify_svm/mainwindow.cpp b/qt/pksvm_gui/mainwindow.cpp similarity index 65% rename from qt/pkclassify_svm/mainwindow.cpp rename to qt/pksvm_gui/mainwindow.cpp index f600493..10b389b 100644 --- a/qt/pkclassify_svm/mainwindow.cpp +++ b/qt/pksvm_gui/mainwindow.cpp @@ -1,3 +1,22 @@ +/********************************************************************** +mainwindow.cpp: GUI for pktools +Copyright (C) 2008-2014 Pieter Kempeneers + +This file is part of pktools + +pktools 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. + +pktools 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 pktools. If not, see <http://www.gnu.org/licenses/>. +***********************************************************************/ #include "mainwindow.h" #include "ui_mainwindow.h" #include <QFileDialog> @@ -16,13 +35,7 @@ MainWindow::MainWindow(QWidget *parent) : QStringList kernellist; kernellist << "radial" << "linear" << "polynomial" << "sigmoid"; ui->kerneltype->addItems(kernellist); - ui->coef0->setText("0"); - ui->ccost->setText("1"); - ui->gamma->setText("0"); - ui->nu->setText("0.5"); - //test - m_training="d:\\osgeo\\course\\openstreetmap\\training2.sqlite"; - ui->training->setText(m_training); + setDefaults(); } MainWindow::~MainWindow() @@ -30,6 +43,26 @@ MainWindow::~MainWindow() delete ui; } +void MainWindow::setDefaults() +{ + //tab training + //m_training="d:\\osgeo\\course\\openstreetmap\\training2.sqlite"; +// ui->training->setText(m_training); + ui->label->setText("label"); + ui->cv->setText("0"); + //tab input/output + ui->msknodata->setText("0"); + ui->nodata->setText("0"); + //tab classifier + ui->coef0->setText("0"); + ui->nu->setText("0.5"); + ui->kd->setText("3"); + ui->label->setText("label"); + ui->cv->setText("0"); + ui->gamma->setText("0"); + ui->ccost->setText("1"); +} + void MainWindow::on_actionTraining_triggered() { m_training = QFileDialog::getOpenFileName(this, "Training"); @@ -52,6 +85,7 @@ void MainWindow::on_actionOutput_triggered() void MainWindow::on_actionInput_triggered() { m_input = QFileDialog::getOpenFileName(this, "Input"); + ui->input->setText(m_input); } void MainWindow::on_toolButton_input_clicked() @@ -76,20 +110,22 @@ void MainWindow::on_toolButton_training_clicked() void MainWindow::on_training_returnPressed() { - m_training=ui->training->text(); - QStringList labels; - labels << "forest" << "non-forest"; - setClassTable(labels); + //eventually read classes from vector file to fill in table... } void MainWindow::setClassTable(const QStringList &labels) { - QStandardItemModel *model = new QStandardItemModel(labels.size(),2,this); //2 Rows and 3 Columns + QStandardItemModel *model = new QStandardItemModel(labels.size(),3,this); //nlabel rows and 3 columns model->setHorizontalHeaderItem(0, new QStandardItem(QString("label name"))); - model->setHorizontalHeaderItem(1, new QStandardItem(QString("class number"))); + model->setHorizontalHeaderItem(1, new QStandardItem(QString("class nr"))); + model->setHorizontalHeaderItem(2, new QStandardItem(QString("prior prob"))); for(int ilabel=0;ilabel<labels.size();++ilabel){ - QStandardItem *firstRow = new QStandardItem(QString(labels[ilabel])); - model->setItem(ilabel,0,firstRow); + QStandardItem *firstCol = new QStandardItem(QString(labels[ilabel])); + model->setItem(ilabel,0,firstCol); + QStandardItem *secondCol = new QStandardItem(QString::number(ilabel+1)); + model->setItem(ilabel,1,secondCol); + QStandardItem *thirdCol = new QStandardItem(QString::number(1.0/labels.size())); + model->setItem(ilabel,2,thirdCol); } ui->tableView_labels->setModel(model); } @@ -125,7 +161,7 @@ void MainWindow::on_pushButton_run_clicked() qsOption+=(*qcbit)->objectName(); program+=qsOption; program+=" "; - program+=QString::number((*qcbit)->currentIndex()); + program+=(*qcbit)->currentText(); } QList<QLineEdit*> qlineEditList = this->findChildren<QLineEdit *>(); @@ -145,7 +181,6 @@ void MainWindow::on_pushButton_run_clicked() // QProcess *myProcess = new QProcess(parent); QProcess *myProcess = new QProcess(this); - myProcess->start(program); myProcess->waitForFinished(-1); QString p_stdout = myProcess->readAll(); @@ -160,7 +195,19 @@ void MainWindow::on_pushButton_run_clicked() } } -void MainWindow::on_lineEdit_2_returnPressed() +void MainWindow::on_toolButton_createTable_clicked() +{ + int nclass=ui->nclass->text().toInt(); + QStringList labels; + for(int iclass=1;iclass<=nclass;++iclass){ + QString lstring="label"; + lstring+=QString::number(iclass); + labels << lstring; + } + setClassTable(labels); +} + +void MainWindow::on_pushButton_restore_clicked() { - //run + setDefaults(); } diff --git a/qt/pkextract/mainwindow.h b/qt/pksvm_gui/mainwindow.h similarity index 61% copy from qt/pkextract/mainwindow.h copy to qt/pksvm_gui/mainwindow.h index c4006c4..27fa254 100644 --- a/qt/pkextract/mainwindow.h +++ b/qt/pksvm_gui/mainwindow.h @@ -1,5 +1,5 @@ /********************************************************************** -mainwindow.h +mainwindow.h: GUI for pktools Copyright (C) 2008-2014 Pieter Kempeneers This file is part of pktools @@ -17,7 +17,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with pktools. If not, see <http://www.gnu.org/licenses/>. ***********************************************************************/ - #ifndef MAINWINDOW_H #define MAINWINDOW_H @@ -30,13 +29,45 @@ class MainWindow; class MainWindow : public QMainWindow { Q_OBJECT - + public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); - + +private slots: + void on_actionInput_triggered(); + + void on_actionTraining_triggered(); + + void on_actionMask_triggered(); + + void on_actionOutput_triggered(); + + void on_toolButton_input_clicked(); + + void on_toolButton_mask_clicked(); + + void on_toolButton_output_clicked(); + + void on_toolButton_training_clicked(); + + void on_training_returnPressed(); + + void on_pushButton_run_clicked(); + + void on_toolButton_createTable_clicked(); + + void on_pushButton_restore_clicked(); + private: + void setClassTable(const QStringList &labels); + void setDefaults(); + Ui::MainWindow *ui; + QString m_input; + QString m_training; + QString m_mask; + QString m_output; }; #endif // MAINWINDOW_H diff --git a/qt/pkclassify_svm/mainwindow.ui b/qt/pksvm_gui/mainwindow.ui similarity index 91% rename from qt/pkclassify_svm/mainwindow.ui rename to qt/pksvm_gui/mainwindow.ui index 4c549e8..19cdd63 100644 --- a/qt/pkclassify_svm/mainwindow.ui +++ b/qt/pksvm_gui/mainwindow.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>MainWindow</string> + <string>pksvm_gui</string> </property> <widget class="QWidget" name="centralWidget"> <widget class="QTabWidget" name="tabWidget"> @@ -24,7 +24,7 @@ </rect> </property> <property name="currentIndex"> - <number>3</number> + <number>2</number> </property> <widget class="QWidget" name="tab"> <attribute name="title"> @@ -135,6 +135,55 @@ <string>class name-value pairs</string> </property> </widget> + <widget class="QLabel" name="label_20"> + <property name="geometry"> + <rect> + <x>10</x> + <y>150</y> + <width>91</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string>prepare table for</string> + </property> + </widget> + <widget class="QLineEdit" name="nclass"> + <property name="geometry"> + <rect> + <x>94</x> + <y>155</y> + <width>31</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_createTable"> + <property name="geometry"> + <rect> + <x>130</x> + <y>156</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>-></string> + </property> + </widget> + <widget class="QLabel" name="label_21"> + <property name="geometry"> + <rect> + <x>90</x> + <y>130</y> + <width>51</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string># classes</string> + </property> + </widget> </widget> <widget class="QWidget" name="tab_2"> <attribute name="title"> @@ -358,7 +407,7 @@ <string>Kernel degree</string> </property> </widget> - <widget class="QLineEdit" name="lineEdit"> + <widget class="QLineEdit" name="kd"> <property name="geometry"> <rect> <x>270</x> diff --git a/qt/pksvm_gui/pksvm_gui.pro b/qt/pksvm_gui/pksvm_gui.pro new file mode 100644 index 0000000..26ce07c --- /dev/null +++ b/qt/pksvm_gui/pksvm_gui.pro @@ -0,0 +1,41 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2014-03-21T13:16:29 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = pksvm_gui +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp + +HEADERS += mainwindow.h + +FORMS += mainwindow.ui + +#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../vis_studio/release/ -limageclasses +#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../vis_studio/debug/ -limageclasses +#else:unix: LIBS += -L$$PWD/../../vis_studio/ -limageclasses + +#INCLUDEPATH += $$PWD/../../src/imageclasses +#DEPENDPATH += $$PWD/../../src/imageclasses + +#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../vis_studio/install/lib/ -lgdal_i +#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../vis_studio/install/lib/ -lgdal_i +#else:unix: LIBS += -L$$PWD/../../../../vis_studio/install/lib/ -lgdal_i + +#INCLUDEPATH += $$PWD/../../../../vis_studio/install/include +#DEPENDPATH += $$PWD/../../../../vis_studio/install/include + +#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../vis_studio/release/ -lbase +#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../vis_studio/debug/ -lbase +#else:unix: LIBS += -L$$PWD/../../vis_studio/ -lbase + +#INCLUDEPATH += $$PWD/../../src +#DEPENDPATH += $$PWD/../../src/base -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel