
* Makefile.am, * demo.pro, * src/bak/mainwindow.cc, * src/bak/mainwindow.hh, * src/display_seg.cc, * src/display_seg.hh, * src/edit_seg.cc, * src/edit_seg.hh, * src/image_viewer.cc, * src/image_viewer.hh, * src/internal/interactive_scene.cc, * src/internal/interactive_scene.hh, * src/main.cc, * src/main_window.cc, * src/main_window.hh, * src/to_qimage.hh, * src/widgets.cc, * ui/bak/mainwindow.ui, * ui/display_seg.ui, * ui/edit_seg.ui, * ui/image_viewer.ui, * ui/main_window.ui, * ui_display_seg.h, * ui_edit_seg.h, * ui_image_viewer.h, * ui_main_window.h: New files. --- milena/sandbox/ChangeLog | 31 ++ milena/sandbox/lazzara/igr/gui/Makefile.am | 11 + milena/sandbox/lazzara/igr/gui/demo.pro | 16 + .../sandbox/lazzara/igr/gui/src/bak/mainwindow.cc | 441 ++++++++++++++++++++ .../sandbox/lazzara/igr/gui/src/bak/mainwindow.hh | 146 +++++++ milena/sandbox/lazzara/igr/gui/src/display_seg.cc | 172 ++++++++ milena/sandbox/lazzara/igr/gui/src/display_seg.hh | 96 +++++ milena/sandbox/lazzara/igr/gui/src/edit_seg.cc | 204 +++++++++ milena/sandbox/lazzara/igr/gui/src/edit_seg.hh | 82 ++++ milena/sandbox/lazzara/igr/gui/src/image_viewer.cc | 194 +++++++++ milena/sandbox/lazzara/igr/gui/src/image_viewer.hh | 102 +++++ .../igr/gui/src/internal/interactive_scene.cc | 88 ++++ .../igr/gui/src/internal/interactive_scene.hh | 73 ++++ milena/sandbox/lazzara/igr/gui/src/main.cc | 39 ++ milena/sandbox/lazzara/igr/gui/src/main_window.cc | 56 +++ milena/sandbox/lazzara/igr/gui/src/main_window.hh | 60 +++ milena/sandbox/lazzara/igr/gui/src/to_qimage.hh | 63 +++ milena/sandbox/lazzara/igr/gui/src/widgets.cc | 3 + .../sandbox/lazzara/igr/gui/ui/bak/mainwindow.ui | 277 ++++++++++++ milena/sandbox/lazzara/igr/gui/ui/display_seg.ui | 108 +++++ milena/sandbox/lazzara/igr/gui/ui/edit_seg.ui | 97 +++++ milena/sandbox/lazzara/igr/gui/ui/image_viewer.ui | 154 +++++++ milena/sandbox/lazzara/igr/gui/ui/main_window.ui | 64 +++ milena/sandbox/lazzara/igr/gui/ui_display_seg.h | 148 +++++++ milena/sandbox/lazzara/igr/gui/ui_edit_seg.h | 130 ++++++ milena/sandbox/lazzara/igr/gui/ui_image_viewer.h | 167 ++++++++ milena/sandbox/lazzara/igr/gui/ui_main_window.h | 92 ++++ 27 files changed, 3114 insertions(+), 0 deletions(-) create mode 100644 milena/sandbox/lazzara/igr/gui/Makefile.am create mode 100644 milena/sandbox/lazzara/igr/gui/demo.pro create mode 100644 milena/sandbox/lazzara/igr/gui/src/bak/mainwindow.cc create mode 100644 milena/sandbox/lazzara/igr/gui/src/bak/mainwindow.hh create mode 100644 milena/sandbox/lazzara/igr/gui/src/display_seg.cc create mode 100644 milena/sandbox/lazzara/igr/gui/src/display_seg.hh create mode 100644 milena/sandbox/lazzara/igr/gui/src/edit_seg.cc create mode 100644 milena/sandbox/lazzara/igr/gui/src/edit_seg.hh create mode 100644 milena/sandbox/lazzara/igr/gui/src/image_viewer.cc create mode 100644 milena/sandbox/lazzara/igr/gui/src/image_viewer.hh create mode 100644 milena/sandbox/lazzara/igr/gui/src/internal/interactive_scene.cc create mode 100644 milena/sandbox/lazzara/igr/gui/src/internal/interactive_scene.hh create mode 100644 milena/sandbox/lazzara/igr/gui/src/main.cc create mode 100644 milena/sandbox/lazzara/igr/gui/src/main_window.cc create mode 100644 milena/sandbox/lazzara/igr/gui/src/main_window.hh create mode 100644 milena/sandbox/lazzara/igr/gui/src/to_qimage.hh create mode 100644 milena/sandbox/lazzara/igr/gui/src/widgets.cc create mode 100644 milena/sandbox/lazzara/igr/gui/ui/bak/mainwindow.ui create mode 100644 milena/sandbox/lazzara/igr/gui/ui/display_seg.ui create mode 100644 milena/sandbox/lazzara/igr/gui/ui/edit_seg.ui create mode 100644 milena/sandbox/lazzara/igr/gui/ui/image_viewer.ui create mode 100644 milena/sandbox/lazzara/igr/gui/ui/main_window.ui create mode 100644 milena/sandbox/lazzara/igr/gui/ui_display_seg.h create mode 100644 milena/sandbox/lazzara/igr/gui/ui_edit_seg.h create mode 100644 milena/sandbox/lazzara/igr/gui/ui_image_viewer.h create mode 100644 milena/sandbox/lazzara/igr/gui/ui_main_window.h diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog index 9580b1b..53f1bda 100644 --- a/milena/sandbox/ChangeLog +++ b/milena/sandbox/ChangeLog @@ -1,3 +1,34 @@ +2009-10-28 Guillaume Lazzara <z@lrde.epita.fr> + + Add a GUI for IGR. + + * Makefile.am, + * demo.pro, + * src/bak/mainwindow.cc, + * src/bak/mainwindow.hh, + * src/display_seg.cc, + * src/display_seg.hh, + * src/edit_seg.cc, + * src/edit_seg.hh, + * src/image_viewer.cc, + * src/image_viewer.hh, + * src/internal/interactive_scene.cc, + * src/internal/interactive_scene.hh, + * src/main.cc, + * src/main_window.cc, + * src/main_window.hh, + * src/to_qimage.hh, + * src/widgets.cc, + * ui/bak/mainwindow.ui, + * ui/display_seg.ui, + * ui/edit_seg.ui, + * ui/image_viewer.ui, + * ui/main_window.ui, + * ui_display_seg.h, + * ui_edit_seg.h, + * ui_image_viewer.h, + * ui_main_window.h: New files. + 2009-10-14 Guillaume Lazzara <z@lrde.epita.fr> * lazzara/fonctionnalites_milena.ods: Add a document listing diff --git a/milena/sandbox/lazzara/igr/gui/Makefile.am b/milena/sandbox/lazzara/igr/gui/Makefile.am new file mode 100644 index 0000000..b51084e --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/Makefile.am @@ -0,0 +1,11 @@ +## Process this file through Automake to create Makefile.in. + +include $(top_srcdir)/scribo/scribo.mk + +.PHONY : demo + +Makefile.demo: + qmake-qt4 $(srcdir)/demo/demo.pro -o Makefile.demo + +demo: Makefile.demo + make -f Makefile.demo all diff --git a/milena/sandbox/lazzara/igr/gui/demo.pro b/milena/sandbox/lazzara/igr/gui/demo.pro new file mode 100644 index 0000000..5d1b3b0 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/demo.pro @@ -0,0 +1,16 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Mon Jun 1 10:28:31 2009 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . src ui +INCLUDEPATH += . src $(OLN)/milena /lrde/dev/linux-x86/stable/gdcm/include +DEFINES += NDEBUG +LIBS += -L/lrde/dev/linux-x86/stable/gdcm/lib -lgdcmCommon -lgdcmDICT -lgdcmDSED -lgdcmIOD -lgdcmMSFF -lgdcmexpat -lgdcmjpeg12 -lgdcmjpeg16 -lgdcmjpeg8 -lgdcmopenjpeg -lgdcmuuid -lgdcmzlib +#CONFIG += debug + +# Input +HEADERS += src/main_window.hh src/image_viewer.hh src/display_seg.hh src/edit_seg.hh src/internal/interactive_scene.hh +FORMS += ui/main_window.ui ui/image_viewer.ui ui/display_seg.ui ui/edit_seg.ui +SOURCES += src/main.cc src/main_window.cc src/image_viewer.cc src/widgets.cc src/internal/interactive_scene.cc diff --git a/milena/sandbox/lazzara/igr/gui/src/bak/mainwindow.cc b/milena/sandbox/lazzara/igr/gui/src/bak/mainwindow.cc new file mode 100644 index 0000000..673a01a --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/bak/mainwindow.cc @@ -0,0 +1,441 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#include <QApplication> +#include <QtCore> +#include <QtGui> + +# define INCLUDE_MLN_FILES +#include <src/mainwindow.hh> + +#include <src/image_viewer.hh> + +#include <mln/core/image/dmorph/slice_image.hh> +#include <mln/core/image/image3d.hh> +#include <mln/border/resize.hh> +#include <mln/logical/not.hh> +#include <mln/value/rgb8.hh> +#include <mln/value/int_u12.hh> +#include <mln/value/int_u8.hh> +#include <mln/data/convert.hh> +#include <mln/data/stretch.hh> +#include <mln/io/dicom/all.hh> +#include <mln/io/dump/all.hh> + + +#include <mln/io/ppm/save.hh> + + +const char * modes[][4] = { +// { "Text in pictures", "pics", "../src/text_in_photo_ppm", "image-x-generic.png" }, + { "Segmentation 3d", "seg", "../watershed3d", 0 }, + { 0, 0, 0 } // Empty line, do NOT delete. +}; + + +// Allow to set up to 3 extra arguments to the binaries. +// +// A program will be launched as follow: +// +// ./my_program input.pbm <arg1> <arg2> <arg3> output.ppm +// +// Unused arguments are set to 0. +// Each line must be mapped to the related on in the previous +// array "modes". So DO preserve the order. +// +const char *args_list[][3] = { + { "51", 0, 0 } + // Not empty line needed. +}; + + + +namespace mln +{ + + namespace demo + { + + MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + { + setupUi(this); + + viewer_ = new image_viewer(); + gridLayout_2->addWidget(viewer_, 0, 0); + + unsigned nmodes = 0; + for (unsigned i = 0; modes[i][0] != 0; ++i) + ++nmodes; + + cached_result_.resize(nmodes); + exec_prefix_ = ""; + base_img_dir_ = "/lrde/stockholm/lazzara/svn/olena/git/oln/milena/sandbox/lazzara/igr/gui"; +// QCoreApplication::applicationDirPath(); + + pdialog_.setRange(0,0); + pdialog_.setLabelText(tr("Please wait while computing...")); + pdialog_.setWindowModality(Qt::WindowModal); + + exec_.setReadChannel(QProcess::StandardOutput); + + qDebug() << "Cache located in " << QDir::tempPath(); + + connect(&pdialog_, SIGNAL(canceled()), this, SLOT(compute_canceled())); + + connect(viewer_, SIGNAL(slider_valueChanged(int)), + this, SLOT(compute_image(int))); + + connect_compute_process(); + + // No status bar. + setStatusBar(0); + + initToolBar(); + } + + MainWindow::~MainWindow() + { + for (int i = 0; i < cached_result_.size(); ++i) + foreach(QString value, cached_result_[i]) + { + QFile f(value); + f.remove(); + } + } + + + void MainWindow::set_base_img_dir(const QString& dir) + { + QDir d(dir); + base_img_dir_ = d.absolutePath(); + } + + + void MainWindow::initToolBar() + { + QToolBar *tbar = new QToolBar("Tools"); + tbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); + + for (unsigned i = 0; modes[i][0]; ++i) + { + QListWidgetItem *item = new QListWidgetItem(modes[i][0], listWidget); + item->setData(Qt::UserRole, i); + } + + listWidget->setCurrentItem(listWidget->item(0)); + } + + + + void MainWindow::on_browseBtn_clicked(bool) + { + QString + current_dir = mode_ + QString("/"); + + qDebug() << (base_img_dir_ + "/" + current_dir); + QString + filename = QFileDialog::getOpenFileName(this, + tr("Open Image."), + base_img_dir_ + "/" + current_dir, + tr("Images (*.dcm)")); + + prepare_for_run(filename); + } + + void MainWindow::prepare_for_run(const QString& filename) + { + if (!filename.isEmpty()) + { + filepath->setText(filename); + + load_dicom(filename); + + } + } + + void MainWindow::load_dicom(const QString& filename) + { + image3d<value::int_u12> tmp; + io::dicom::load(tmp, filename.toStdString().c_str()); + dcm_ima = to_rgb8(tmp); + + viewer_->set_image_size(geom::nrows(dcm_ima), geom::ncols(dcm_ima), + geom::nslis(dcm_ima)); + } + + + void MainWindow::compute_image(int sli) + { + QImage ima = this->convert(duplicate(slice(dcm_ima, sli))); + viewer_->updated_image(ima); + } + + + template <typename I> + mln_ch_value(I, value::rgb8) MainWindow::to_rgb8(const Image<I>& ima_) + { + const I& ima = exact(ima_); + mln_precondition(ima.is_valid()); + + mln_ch_value(I, value::rgb8) + tmp = data::convert(value::rgb8(), + data::stretch(value::int_u8(), ima)); + + return tmp; + } + + + template <typename I> + QImage MainWindow::convert(const Image<I>& ima_) + { + const I& ima = exact(ima_); + mln_precondition(ima.is_valid()); + + const int + nrows = geom::nrows(ima), + ncols = geom::ncols(ima); + + // Required by a one-shot data copy: + mln::border::resize(ima, 0); + + QImage qima(ncols, nrows, QImage::Format_RGB888); + std::memcpy(qima.scanLine(0), + ima.buffer(), + ima.nelements() * 3); + return qima; + } + + + void MainWindow::on_runBtn_clicked() + { +// if (useCache->isChecked() +// && cached_result_[mode_].contains(filepath->text())) +// { +// last_output_ = cached_result_[mode_][filepath->text()]; +// exec_finished(0, QProcess::NormalExit); +// return; +// } + + wait_for_result(); + + QStringList args; + + QString input = filepath->text(); + + args << input; + for (int i = 0; i < args_values_.size(); ++i) + args << QString::number(args_values_[i]->value()); + + QTemporaryFile f; + f.open(); + args << f.fileName(); + last_output_ = f.fileName(); + qDebug() << last_output_; + + + qDebug() << exec_prefix_ + modes[mode_][2] + << " - " + << args; + exec_.start(exec_prefix_ + modes[mode_][2], args); + } + + + void MainWindow::on_listWidget_currentItemChanged(QListWidgetItem *current, + QListWidgetItem *previous) + { + (void) previous; + mode_ = current->data(Qt::UserRole).toInt(); + update_options(current); + } + + + void MainWindow::update_options(QListWidgetItem */*current*/) + { + QFormLayout *formLayout = new QFormLayout; + + QProcess process; + process.start(modes[mode_][2]); + process.waitForFinished(); + + QByteArray usage = process.readAllStandardOutput(); + QList<QByteArray> list = usage.split('<'); + + delete frame->layout(); + args_values_.clear(); + + for (int i = 2; i < list.size() - 1; ++i) + { + args_values_.append(new QSpinBox()); + args_values_.last()->setValue(atoi(args_list[mode_][i - 2])); + formLayout->addRow(list[i].replace('>', ' '), args_values_.last()); + } + + frame->setLayout(formLayout); + } + + + void MainWindow::on_displayBtn_clicked(bool) + { + load_dicom(filepath->text()); + } + + + void MainWindow::on_filepath_textChanged() + { + bool b = !filepath->text().isEmpty(); + + runBtn->setEnabled(b); + displayBtn->setEnabled(b); + } + + + void MainWindow::exec_finished(int rvalue, QProcess::ExitStatus status) + { + pdialog_.hide(); + if (rvalue == 0) + { + if (status != QProcess::CrashExit) + { + if (useCache->isChecked()) + cached_result_[mode_][filepath->text()] = last_output_; + setEnabled(true); + prepare_and_send_result(last_output_); + } + // Else : canceled. + } + else + exec_error(tr("Error during last run.")); + + if (autoDemo->isChecked()) + timer_.start(timeoutDelay->text().toInt() * 1000); + } + + + void MainWindow::prepare_and_send_result(const QString& output) + { + QImage ima(output); + viewer_->updated_image(ima); + } + + void MainWindow::wait_for_result() + { + reset_progress_dialog(); + + pdialog_.show(); + setEnabled(false); + } + + void MainWindow::exec_error(const QString& msg) + { + setEnabled(true); + QMessageBox::critical(0, tr("Error!"), + tr("The result cannot be computed!")); + qDebug() << "exec_error : " << msg; + qDebug() << exec_.readAllStandardOutput(); + } + + void MainWindow::exec_error(QProcess::ProcessError error) + { + if (error == QProcess::FailedToStart) + exec_error(tr("This program does not exist: ") + + exec_prefix_ + modes[mode_][2]); + else + exec_error(tr("The computation stopped.") + + exec_prefix_ + modes[mode_][2]); + } + + + + void MainWindow::compute_canceled() + { + setEnabled(true); + + exec_.disconnect(); + exec_.kill(); + connect_compute_process(); + + } + + + void MainWindow::on_autoDemo_clicked(bool checked) + { + if (checked) + timer_.start(100); + else + timer_.stop(); + } + + + void MainWindow::timer_timeout() + { + update_auto_demo_dir(); + timer_.stop(); + prepare_for_run(demoDir_.absolutePath() + "/" + + demo_files_[demo_index_]); + demo_index_ = (demo_index_ + 1) % demo_files_.size(); + } + + void MainWindow::update_auto_demo_dir() + { +// QString tmp_path = base_img_dir_ + "/" + current_mode(); +// if (demoDir_.path() != tmp_path) +// { +// demoDir_.setPath(tmp_path); +// demo_index_ = 0; +// demo_files_ = demoDir_.entryList(QDir::NoDotAndDotDot | QDir::Files); +// } + } + + + void MainWindow::update_process_status() + { + pdialog_.setLabelText(tr(exec_.readAllStandardOutput())); + } + + + void MainWindow::reset_progress_dialog() + { + pdialog_.reset(); + pdialog_.setLabelText(tr("Please wait while computing...")); + } + + + void MainWindow::connect_compute_process() + { + connect(&exec_, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(exec_finished(int, QProcess::ExitStatus))); + connect(&exec_, SIGNAL(error(QProcess::ProcessError)), + this, SLOT(exec_error(QProcess::ProcessError))); + connect(&exec_, SIGNAL(readyReadStandardOutput()), + this, SLOT(update_process_status())); + } + + + } // end of namespace scribo::demo + +} // end of namespace scribo + + diff --git a/milena/sandbox/lazzara/igr/gui/src/bak/mainwindow.hh b/milena/sandbox/lazzara/igr/gui/src/bak/mainwindow.hh new file mode 100644 index 0000000..17948e1 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/bak/mainwindow.hh @@ -0,0 +1,146 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef MLN_DEMO_SRC_MAINWINDOW_HH + +# include <QDir> +# include <QTimer> +# include <QStringList> +# include <QProcess> +# include <QtGui> +# include <QProgressDialog> +# include <ui_mainwindow.h> + +# ifndef INCLUDE_MLN_FILES +# define MLN_INCLUDE_ONLY +# endif + +# include <mln/core/image/image3d.hh> +# include <mln/value/rgb8.hh> + +namespace mln +{ + + namespace demo + { + + // Forward declaration. + class image_viewer; + + + class MainWindow : public QMainWindow, private Ui::MainWindow + { + Q_OBJECT + + + public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + + void set_base_img_dir(const QString& dir); + + private slots: + void initToolBar(); + + void on_browseBtn_clicked(bool b); + void on_runBtn_clicked(); + void on_displayBtn_clicked(bool b); + void on_filepath_textChanged(); + void on_autoDemo_clicked(bool checked); + + void exec_finished(int rvalue, QProcess::ExitStatus status); + void exec_error(QProcess::ProcessError error); + + void compute_canceled(); + + void timer_timeout(); + + void update_process_status(); + + void on_listWidget_currentItemChanged(QListWidgetItem *current, + QListWidgetItem *previous); + + void compute_image(int sli); + + private: // Members + + void update_pixmap(QGraphicsView* view, const QString& name = QString()); + + void load_dicom(const QString& filename); + + template <typename I> + mln_ch_value(I, value::rgb8) to_rgb8(const Image<I>& ima_); + + template <typename I> + QImage convert(const Image<I>& ima_); + + void prepare_and_send_result(const QString& output); + + void exec_error(const QString& msg); + + void wait_for_result(); + + void prepare_for_run(const QString& filename); + + void update_auto_demo_dir(); + + void reset_progress_dialog(); + + void connect_compute_process(); + + void update_options(QListWidgetItem *item); + + private: // Attributes + image_viewer *viewer_; + + QString exec_prefix_; + + QString last_output_; + QProcess exec_; + + QProgressDialog pdialog_; + + QString base_img_dir_; + + int mode_; + image3d<value::rgb8> dcm_ima; + QList<QSpinBox*> args_values_; + + + QVector<QHash<QString, QString> > cached_result_; + + /// Related to auto demo. + QTimer timer_; + QDir demoDir_; + unsigned demo_index_; + QStringList demo_files_; + }; + + + } // end of namespace mln::demo + +} // end of namespace mln + +#endif // ! MLN_DEMO_SRC_MAINWINDOW_HH diff --git a/milena/sandbox/lazzara/igr/gui/src/display_seg.cc b/milena/sandbox/lazzara/igr/gui/src/display_seg.cc new file mode 100644 index 0000000..eae64a9 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/display_seg.cc @@ -0,0 +1,172 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#include <QApplication> +#include <QtCore> +#include <QtGui> + +# define INCLUDE_MLN_FILES +#include <src/display_seg.hh> +#include <src/image_viewer.hh> + +#include <src/to_qimage.hh> + +#include <mln/accu/count_value.hh> +#include <mln/core/image/dmorph/slice_image.hh> +#include <mln/core/image/image3d.hh> +#include <mln/border/resize.hh> +#include <mln/data/compute.hh> +#include <mln/logical/not.hh> +#include <mln/value/hsl.hh> +#include <mln/value/rgb8.hh> +#include <mln/value/int_u12.hh> +#include <mln/value/int_u8.hh> +#include <mln/value/int_u32.hh> +#include <mln/value/int_u8.hh> +#include <mln/data/convert.hh> +#include <mln/data/stretch.hh> +#include <mln/io/dicom/all.hh> +#include <mln/io/dump/all.hh> + + +#include <mln/io/ppm/save.hh> + + + +namespace mln +{ + + namespace demo + { + + display_seg::display_seg(QWidget *parent) + : QWidget(parent) + { + setupUi(this); + + connect(viewer, SIGNAL(slider_valueChanged(int)), + this, SLOT(compute_image(int))); + } + + display_seg::~display_seg() + { + } + + + // Private slots + + void display_seg::on_browseBtn_clicked(bool) + { + QString + filename = QFileDialog::getOpenFileName(this, + tr("Open Image."), + QString(), + tr("Images (*.dcm)")); + + if (!filename.isEmpty()) + filepath->setText(filename); + } + + + void display_seg::on_browseSegBtn_clicked(bool) + { + QString + filename = QFileDialog::getOpenFileName(this, + tr("Open Image."), + QString(), + tr("Images (*.dump)")); + + if (!filename.isEmpty()) + segfilepath->setText(filename); + } + + + void display_seg::compute_image(int sli) + { + slice_image<dcm_ima_t> sl_ima = slice(dcm_ima, sli); + + mln_piter_(result_t) p(result.domain()); + for_all(p) + result(p).lum() = (sl_ima(p) / static_cast<float>(mln_max(value::int_u8))) / 2.0; + + QImage ima = to_qimage(data::convert(value::rgb8(), result)); + + viewer->update_image(ima); + } + + + void display_seg::on_loadBtn_clicked(bool) + { + load_dicom(filepath->text()); + load_seg(segfilepath->text()); + setup_result(); + + viewer->set_image_layer_count(geom::nslis(dcm_ima)); + } + + + + // Private members + + void display_seg::setup_result() + { + initialize(result, seg_ima); + mln_piter_(result_t) p(result.domain()); + for_all(p) + { + result(p).hue() = ((seg_ima(p) * 10) % 359) + 1; + result(p).sat() = 1; + } + } + + void display_seg::load_seg(const QString& filename) + { + io::dump::load(seg_ima, filename.toStdString()); + } + + + void display_seg::load_dicom(const QString& filename) + { + image3d<value::int_u12> tmp; + io::dicom::load(tmp, filename.toStdString()); + dcm_ima = to_int_u8(tmp); + } + + + template <typename I> + mln_ch_value(I, value::int_u8) display_seg::to_int_u8(const Image<I>& ima_) + { + const I& ima = exact(ima_); + mln_precondition(ima.is_valid()); + + mln_ch_value(I, value::int_u8) + tmp = data::stretch(value::int_u8(), ima); + + return tmp; + } + + } // end of namespace scribo::demo + +} // end of namespace scribo diff --git a/milena/sandbox/lazzara/igr/gui/src/display_seg.hh b/milena/sandbox/lazzara/igr/gui/src/display_seg.hh new file mode 100644 index 0000000..c559b0d --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/display_seg.hh @@ -0,0 +1,96 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef MLN_DEMO_SRC_DISPLAY_SEG_HH + +# include <QDir> +# include <QTimer> +# include <QStringList> +# include <QProcess> +# include <QtGui> +# include <QProgressDialog> +# include <ui_display_seg.h> + +# ifndef INCLUDE_MLN_FILES +# define MLN_INCLUDE_ONLY +# endif + +# include <mln/core/image/image3d.hh> +# include <mln/core/image/image2d.hh> +# include <mln/value/int_u8.hh> +# include <mln/value/int_u16.hh> +# include <mln/value/rgb8.hh> +# include <mln/value/hsl.hh> + +namespace mln +{ + + namespace demo + { + + class display_seg : public QWidget, private Ui::DisplaySeg + { + Q_OBJECT + + typedef image3d<value::int_u8> dcm_ima_t; + typedef image2d<value::int_u16> seg_ima_t; + typedef image2d<value::hsl_f> result_t; + + public: + display_seg(QWidget *parent = 0); + ~display_seg(); + + + private slots: + void on_browseBtn_clicked(bool); + void on_browseSegBtn_clicked(bool); + void compute_image(int sli); + void on_loadBtn_clicked(bool); + + private: // Members + + void setup_result(); + void load_seg(const QString& filename); + void load_dicom(const QString& filename); + + template <typename I> + mln_ch_value(I, value::int_u8) to_int_u8(const Image<I>& ima_); + + void prepare_and_send_result(const QString& output); + + private: // Attributes + dcm_ima_t dcm_ima; + seg_ima_t seg_ima; + value::int_u8 nlabels_; + result_t result; + + }; + + + } // end of namespace mln::demo + +} // end of namespace mln + +#endif // ! MLN_DEMO_SRC_DISPLAY_SEG_HH diff --git a/milena/sandbox/lazzara/igr/gui/src/edit_seg.cc b/milena/sandbox/lazzara/igr/gui/src/edit_seg.cc new file mode 100644 index 0000000..14e58b5 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/edit_seg.cc @@ -0,0 +1,204 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + + +#include <QtGui> + +# define INCLUDE_MLN_FILES +#include <src/edit_seg.hh> +#include <src/to_qimage.hh> + +#include <mln/core/image/image3d.hh> +#include <mln/core/image/imorph/labeled_image.hh> +#include <mln/core/concept/function.hh> + +#include <mln/data/wrap.hh> +#include <mln/data/transform_inplace.hh> + +#include <mln/value/int_u16.hh> +#include <mln/value/int_u8.hh> + +#include <mln/io/ppm/save.hh> +#include <mln/io/dump/load.hh> + +#include <mln/literal/colors.hh> + +#include <mln/labeling/colorize.hh> + +#include <mln/fun/v2v/wrap.hh> + +namespace mln +{ + +// namespace internal +// { + +// struct merge_component : Function_v2v<merge_component> +// { +// typedef value::int_u16 result; + +// merge_component(const value::int_u16& replaced, +// const value::int_u16& by) +// : replaced_(replaced), by_(by) +// { +// } + +// value::int_u16 operator()(const value::int_u16& v) const +// { +// if (v == replaced_) +// return by_; +// return v; +// } + +// value::int_u16 replaced_; +// value::int_u16 by_; +// }; + +// } // end of namespace mln::internal + + + + + namespace demo + { + + + edit_seg::edit_seg(QWidget *parent) + : QWidget(parent) + { + setupUi(this); + + connect(viewer, SIGNAL(slider_valueChanged(int)), + this, SLOT(compute_image())); + + connect(viewer, SIGNAL(mouse_draw_line(const QPointF&, const QPointF&)), + this, SLOT(join_components(const QPointF&, const QPointF&))); + + connect(viewer, SIGNAL(mouse_click(const QPointF&)), + this, SLOT(select_component(const QPointF&))); + } + + edit_seg::~edit_seg() + { + + } + + + void edit_seg::on_browseBtn_clicked(bool) + { + QString + filename = QFileDialog::getOpenFileName(this, + tr("Open Image."), + QString(), + tr("Images (*.dump)")); + + if (!filename.isEmpty()) + filepath->setText(filename); + + // Initial load. + image2d<value::int_u16> tmp; + io::dump::load(tmp, filepath->text().toStdString()); + seg_ = labeled_image<image2d<value::int_u16> >(tmp); + + selected_.resize(seg_.nlabels(), false); + + image2d<value::int_u8> tmp2 = data::wrap(value::int_u8(), seg_); + seg_rgb8_ = data::convert(value::rgb8(), tmp2); + + viewer->set_image_layer_count(1); + } + + + void edit_seg::compute_image() + { + QImage ima = to_qimage(seg_rgb8_); + viewer->update_image(ima); + } + + + void edit_seg::join_components(const QPointF& p1, const QPointF& p2) + { +// point2d +// mln_p1 = point2d(p1.y(), p1.x()), +// mln_p2 = point2d(p2.y(), p2.x()); +// if (seg_.domain().has(mln_p1) && seg_.domain().has(mln_p2) && // in domain +// seg_(mln_p1) != seg_(mln_p2) // different components +// && seg_(mln_p1) != 0 && seg_(mln_p2) != 0) // Not the wsl +// { +// std::cout << "Merging " << seg_(mln_p1) +// << " and " << seg_(mln_p2) << std::endl; +// std::cout << "mln_p1 = " << mln_p1 << " - mln_p2 = " << mln_p2 << std::endl; + +// internal::merge_component f(seg_(mln_p1), seg_(mln_p2)); +// data::transform_inplace(seg_, f); +// compute_image(); +// } + } + + void edit_seg::on_saveBtn_clicked(bool) + { + QString + filename = QFileDialog::getOpenFileName(this, + tr("Save Image."), + QString(), + tr("Images (*.dump)")); + + + image2d<value::int_u16> + out = data::transform(seg_.unmorph_(), selected_); + + io::dump::save(out, filename.toStdString()); + } + + + void edit_seg::select_component(const QPointF& p) + { + point2d + mln_p = point2d(p.y(), p.x()); + + if (seg_.domain().has(mln_p) + && !selected_(seg_(mln_p)) + && seg_(mln_p) != 0) // Not the wsl + { + selected_(seg_(mln_p)) = true; + data::fill((seg_rgb8_ | seg_.subdomain(seg_(mln_p))).rw(), + literal::red); + } + else + { + selected_(seg_(mln_p)) = false; + value::rgb8 + v = convert::to<value::rgb8>(fun::v2v:wrap<value::int_u8>(seg_(mln_p))); + + value::rgb8 v(seg_(mln_p), seg_(mln_p), seg_(mln_p)); + data::fill((seg_rgb8_ | seg_.subdomain(seg_(mln_p))).rw(), v); + } + compute_image(); + } + + + } // end of namespace mln::demo + +} // end of namespace mln diff --git a/milena/sandbox/lazzara/igr/gui/src/edit_seg.hh b/milena/sandbox/lazzara/igr/gui/src/edit_seg.hh new file mode 100644 index 0000000..0d22db5 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/edit_seg.hh @@ -0,0 +1,82 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef MLN_DEMO_SRC_EDIT_SEG_HH + +# include <QDir> +# include <QTimer> +# include <QStringList> +# include <QProcess> +# include <QtGui> +# include <QProgressDialog> +# include <ui_edit_seg.h> + +# ifndef INCLUDE_MLN_FILES +# define MLN_INCLUDE_ONLY +# endif + +# include <mln/core/image/image2d.hh> +# include <mln/core/image/imorph/labeled_image.hh> +# include <mln/value/int_u16.hh> +# include <mln/value/rgb8.hh> +# include <mln/util/array.hh> + +namespace mln +{ + + namespace demo + { + + class edit_seg : public QWidget, private Ui::EditSeg + { + Q_OBJECT + + public: + edit_seg(QWidget *parent = 0); + ~edit_seg(); + + + private slots: + void on_browseBtn_clicked(bool); + void on_saveBtn_clicked(bool); + void compute_image(); + void join_components(const QPointF& p1, const QPointF& p2); + void select_component(const QPointF& p); + + private: // Members + + + private: // Attributes + labeled_image<image2d<value::int_u16> > seg_; + image2d<value::rgb8> seg_rgb8_; + mln::util::array<bool> selected_; + }; + + + } // end of namespace mln::demo + +} // end of namespace mln + +#endif // ! MLN_DEMO_SRC_EDIT_SEG_HH diff --git a/milena/sandbox/lazzara/igr/gui/src/image_viewer.cc b/milena/sandbox/lazzara/igr/gui/src/image_viewer.cc new file mode 100644 index 0000000..4354aed --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/image_viewer.cc @@ -0,0 +1,194 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +# include <src/image_viewer.hh> +# include <src/internal/interactive_scene.hh> + +namespace mln +{ + + namespace demo + { + + image_viewer::image_viewer(QWidget *parent) + : QWidget(parent), item_(0) + { + setupUi(this); + + connect(image->verticalScrollBar(), SIGNAL(valueChanged(int)), + this, SLOT(move_vertical_sliders(int))); + connect(image->horizontalScrollBar(), SIGNAL(valueChanged(int)), + this, SLOT(move_horizontal_sliders(int))); + + setup_scene(); + + slider->setMinimum(0); + visible_slider(false); + } + + + + image_viewer::~image_viewer() + { + + } + + + // Private members + + void image_viewer::setup_scene() + { + QGraphicsScene *scene = new internal::interactiveScene(); + image->setScene(scene); + + connect(scene, SIGNAL(mouse_draw_line(const QPointF&,const QPointF&)), + this, SIGNAL(mouse_draw_line(const QPointF&,const QPointF&))); + connect(scene, SIGNAL(mouse_click(const QPointF&)), + this, SIGNAL(mouse_click(const QPointF&))); + + image->show(); + } + + void image_viewer::draw_image(const QImage& ima) + { + QPixmap pixmap = QPixmap::fromImage(ima); + + if (item_ != 0) + { + image->scene()->removeItem(item_); + delete item_; + } + + item_ = image->scene()->addPixmap(pixmap); + image->scene()->setSceneRect(item_->boundingRect()); + if (pixmap.width() > image->maximumViewportSize().width()) + image->fitInView(item_->boundingRect(), Qt::KeepAspectRatio); + + zoomLabel->setEnabled(true); + zoomIn->setEnabled(true); + zoomOut->setEnabled(true); + zoomFixed->setEnabled(true); + zoomOriginal->setEnabled(true); + } + + void image_viewer::resize_image(const QRectF& rect) + { + if (item_ != 0) + image->fitInView(rect, Qt::KeepAspectRatio); + } + + void image_viewer::resizeEvent(QResizeEvent * event) + { + if (item_ != 0) + resize_image(item_->boundingRect()); + event->ignore(); + } + + + void image_viewer::keyPressEvent(QKeyEvent *event) + { + if (event->text() == QString("+")) + { + on_zoomIn_clicked(); + event->accept(); + } + else if (event->text() == QString("-")) + { + on_zoomOut_clicked(); + event->accept(); + } + else + event->ignore(); + } + + + // Private slots + + void image_viewer::visible_slider(bool b) + { + slider->setVisible(b); + label_2->setVisible(b); + frame_nb->setVisible(b); + } + + void image_viewer::move_vertical_sliders(int value) + { + image->verticalScrollBar()->setValue(value); + } + + + void image_viewer::move_horizontal_sliders(int value) + { + image->horizontalScrollBar()->setValue(value); + } + + + void image_viewer::on_slider_valueChanged(int sli) + { + frame_nb->setText(QString::number(sli)); + emit slider_valueChanged(sli); + } + + void image_viewer::update_image(const QImage& ima) + { + draw_image(ima); + } + + + void image_viewer::on_zoomIn_clicked() + { + image->scale(1.2, 1.2); + } + + void image_viewer::on_zoomOut_clicked() + { + image->scale(1 / 1.2, 1 / 1.2); + } + + void image_viewer::on_zoomFixed_clicked() + { + resize_image(item_->boundingRect()); + } + + void image_viewer::on_zoomOriginal_clicked() + { + resize_image(image->viewport()->geometry()); + } + + + // Public slots + + void image_viewer::set_image_layer_count(unsigned nslis) + { + visible_slider(nslis > 1); + + slider->setMaximum(nslis - 1); + on_slider_valueChanged(0); + } + + + } // end of namespace mln::demo + +} // end of namespace mln diff --git a/milena/sandbox/lazzara/igr/gui/src/image_viewer.hh b/milena/sandbox/lazzara/igr/gui/src/image_viewer.hh new file mode 100644 index 0000000..137cbc2 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/image_viewer.hh @@ -0,0 +1,102 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef MLN_DEMO_SRC_IMAGE_VIEWER_HH +# define MLN_DEMO_SRC_IMAGE_VIEWER_HH + +# include <QApplication> +# include <QtCore> +# include <QtGui> + +# include <ui_image_viewer.h> + +namespace mln +{ + + namespace demo + { + + + class image_viewer + : public QWidget, private Ui::ImageViewer + { + Q_OBJECT; + + public: + image_viewer(QWidget *parent = 0); + ~image_viewer(); + + + private: // members + void setup_scene(); + + void draw_image(const QImage& ima); + + void resize_image(const QRectF& rect); + + void keyPressEvent(QKeyEvent *event); + void resizeEvent(QResizeEvent * event); +// void mouseMoveEvent(QMouseEvent *e); +// void mousePressEvent(QMouseEvent *e); +// void mouseReleasedEvent(QMouseEvent *e); + + private slots: + void visible_slider(bool b); + + void move_vertical_sliders(int value); + void move_horizontal_sliders(int value); + + void on_slider_valueChanged(int sli); + + void on_zoomIn_clicked(); + void on_zoomOut_clicked(); + void on_zoomFixed_clicked(); + void on_zoomOriginal_clicked(); + + + public slots: + void set_image_layer_count(unsigned nslis); + void update_image(const QImage& ima); + + + signals: + void slider_valueChanged(int sli); + void mouse_draw_line(const QPointF& p1, const QPointF& p2); + void mouse_click(const QPointF& p); + + + private: // attributes + QGraphicsItem *item_; + bool mouse_moving_; + QPoint p_start_; + }; + + + } // end of namespace mln::demo + +} // end of namespace mln + + +#endif // ! MLN_DEMO_SRC_IMAGE_VIEWER_HH diff --git a/milena/sandbox/lazzara/igr/gui/src/internal/interactive_scene.cc b/milena/sandbox/lazzara/igr/gui/src/internal/interactive_scene.cc new file mode 100644 index 0000000..b763cc3 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/internal/interactive_scene.cc @@ -0,0 +1,88 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +# include <src/internal/interactive_scene.hh> + +namespace mln +{ + + namespace demo + { + + namespace internal + { + + interactiveScene::interactiveScene(QObject * parent) + : QGraphicsScene(parent) + { + line_.setZValue(1); + + QPen pen; + pen.setColor(QColor(Qt::red)); + pen.setStyle(Qt::SolidLine); + pen.setWidth(1); + + line_.setPen(pen); + } + + + void interactiveScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) + { + line_.setLine(QLineF(p_start_, e->scenePos())); + mouse_moved_ = true; + + e->accept(); + } + + void interactiveScene::mousePressEvent(QGraphicsSceneMouseEvent *e) + { + p_start_ = e->scenePos(); + mouse_moved_ = false; + + line_.setLine(QLineF(e->scenePos(), e->scenePos())); + addItem(&line_); + + e->accept(); + } + + void interactiveScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) + { + if (line_.scene() == this) + removeItem(&line_); + + if (mouse_moved_) + emit mouse_draw_line(p_start_, e->scenePos()); + else + emit mouse_click(e->scenePos()); + + e->ignore(); + } + + + } // end of namespace mln::demo::internal + + } // end of namespace mln::demo + +} // end of namespace mln diff --git a/milena/sandbox/lazzara/igr/gui/src/internal/interactive_scene.hh b/milena/sandbox/lazzara/igr/gui/src/internal/interactive_scene.hh new file mode 100644 index 0000000..81f4068 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/internal/interactive_scene.hh @@ -0,0 +1,73 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef MLN_DEMO_SRC_INTERNAL_INTERACTIVE_SCENE_HH +# define MLN_DEMO_SRC_INTERNAL_INTERACTIVE_SCENE_HH + +# include <QtGui/QGraphicsScene> +# include <QtGui/QGraphicsSceneMouseEvent> +# include <QtGui/QGraphicsLineItem> +# include <QtCore/QPoint> +# include <QtCore/QDebug> + +namespace mln +{ + + namespace demo + { + + namespace internal + { + + class interactiveScene : public QGraphicsScene + { + Q_OBJECT + + public: + + interactiveScene(QObject * parent = 0); + + void mouseMoveEvent(QGraphicsSceneMouseEvent *e); + void mousePressEvent(QGraphicsSceneMouseEvent *e); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *e); + + signals: + void mouse_draw_line(const QPointF& p1, const QPointF& p2); + void mouse_click(const QPointF& p); + + private: + QGraphicsLineItem line_; + bool mouse_moved_; + QPointF p_start_; + }; + + + } // end of namespace mln::demo::internal + + } // end of namespace mln::demo + +} // end of namespace mln + +#endif // ! MLN_DEMO_SRC_INTERNAL_INTERACTIVE_SCENE_HH diff --git a/milena/sandbox/lazzara/igr/gui/src/main.cc b/milena/sandbox/lazzara/igr/gui/src/main.cc new file mode 100644 index 0000000..cbb4ec1 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/main.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#include <QApplication> +#include <QtGui> + +#include <src/main_window.hh> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + mln::demo::main_window win; + + win.show(); + return app.exec(); +} diff --git a/milena/sandbox/lazzara/igr/gui/src/main_window.cc b/milena/sandbox/lazzara/igr/gui/src/main_window.cc new file mode 100644 index 0000000..bdae998 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/main_window.cc @@ -0,0 +1,56 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + + +#include <QtCore> +#include <QtGui> +#include <src/main_window.hh> + +namespace mln +{ + + namespace demo + { + + main_window::main_window(QWidget *parent) + : QMainWindow(parent) + { + setupUi(this); + + // No status bar. + setStatusBar(0); + + } + + main_window::~main_window() + { + } + + + } // end of namespace scribo::demo + +} // end of namespace scribo + + diff --git a/milena/sandbox/lazzara/igr/gui/src/main_window.hh b/milena/sandbox/lazzara/igr/gui/src/main_window.hh new file mode 100644 index 0000000..502a514 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/main_window.hh @@ -0,0 +1,60 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef MLN_DEMO_SRC_MAIN_WINDOW_HH + +# include <QtGui> +# include <ui_main_window.h> + +namespace mln +{ + + namespace demo + { + + + class main_window : public QMainWindow, private Ui::MainWindow + { + Q_OBJECT + + public: + main_window(QWidget *parent = 0); + ~main_window(); + + + private slots: + + private: // Members + + private: // Attributes + + }; + + + } // end of namespace mln::demo + +} // end of namespace mln + +#endif // ! MLN_DEMO_SRC_MAIN_WINDOW_HH diff --git a/milena/sandbox/lazzara/igr/gui/src/to_qimage.hh b/milena/sandbox/lazzara/igr/gui/src/to_qimage.hh new file mode 100644 index 0000000..75c9756 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/to_qimage.hh @@ -0,0 +1,63 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + + +#ifndef MLN_DEMO_SRC_TO_QIMAGE_HH +# define MLN_DEMO_SRC_TO_QIMAGE_HH + +# include <QtGui/QImage> + +# include <mln/core/concept/image.hh> +# include <mln/geom/nrows.hh> +# include <mln/geom/ncols.hh> +# include <mln/border/resize.hh> + +namespace mln +{ + + template <typename I> + inline + QImage to_qimage(const Image<I>& ima_) + { + const I& ima = exact(ima_); + mln_precondition(ima.is_valid()); + + const int + nrows = geom::nrows(ima), + ncols = geom::ncols(ima); + + // Required by a one-shot data copy: + mln::border::resize(ima, 0); + + QImage qima(ncols, nrows, QImage::Format_RGB888); + std::memcpy(qima.scanLine(0), + ima.buffer(), + ima.nelements() * 3); + return qima; + } + +} // end of namespace mln + +#endif // ! MLN_DEMO_SRC_TO_QIMAGE_HH diff --git a/milena/sandbox/lazzara/igr/gui/src/widgets.cc b/milena/sandbox/lazzara/igr/gui/src/widgets.cc new file mode 100644 index 0000000..5968dc4 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/src/widgets.cc @@ -0,0 +1,3 @@ +// FIXME: UGLY!!! Avoir multiple definition of Milena's code. +# include "src/display_seg.cc" +# include "src/edit_seg.cc" diff --git a/milena/sandbox/lazzara/igr/gui/ui/bak/mainwindow.ui b/milena/sandbox/lazzara/igr/gui/ui/bak/mainwindow.ui new file mode 100644 index 0000000..59c88b7 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui/bak/mainwindow.ui @@ -0,0 +1,277 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>729</width> + <height>455</height> + </rect> + </property> + <property name="windowTitle" > + <string/> + </property> + <property name="dockOptions" > + <set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set> + </property> + <property name="unifiedTitleAndToolBarOnMac" > + <bool>false</bool> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QGridLayout" name="gridLayout_3" > + <item row="0" column="0" > + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <layout class="QGridLayout" name="gridLayout" > + <item row="0" column="0" > + <widget class="QLineEdit" name="filepath" /> + </item> + <item row="0" column="1" > + <widget class="QPushButton" name="browseBtn" > + <property name="text" > + <string>&Browse</string> + </property> + <property name="icon" > + <iconset resource="../demo.qrc" > + <normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset> + </property> + <property name="shortcut" > + <string>Ctrl+B</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout" > + <property name="bottomMargin" > + <number>0</number> + </property> + <item> + <spacer name="horizontalSpacer_2" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="displayBtn" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>Refresh</string> + </property> + <property name="icon" > + <iconset resource="../demo.qrc" > + <normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_2" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="useCache" > + <property name="text" > + <string>Enable cache</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="autoDemo" > + <property name="text" > + <string>Auto demo</string> + </property> + <property name="shortcut" > + <string>Ctrl+D</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="timeoutDelay" > + <property name="maximumSize" > + <size> + <width>30</width> + <height>16777215</height> + </size> + </property> + <property name="inputMask" > + <string/> + </property> + <property name="text" > + <string>5</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label" > + <property name="text" > + <string>s.</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_3" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="runBtn" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>Run</string> + </property> + <property name="icon" > + <iconset resource="../demo.qrc" > + <normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="autoRun" > + <property name="text" > + <string>Auto Run</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item row="1" column="0" > + <widget class="QSplitter" name="splitter" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <widget class="QWidget" name="" > + <layout class="QVBoxLayout" name="verticalLayout_2" > + <property name="sizeConstraint" > + <enum>QLayout::SetMaximumSize</enum> + </property> + <item> + <widget class="QListWidget" name="listWidget" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Maximum" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="frame" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Maximum" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="imginfo" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Maximum" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="" > + <layout class="QGridLayout" name="gridLayout_2" > + <property name="sizeConstraint" > + <enum>QLayout::SetNoConstraint</enum> + </property> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>729</width> + <height>31</height> + </rect> + </property> + </widget> + <widget class="QStatusBar" name="statusbar" /> + </widget> + <resources> + <include location="../demo.qrc" /> + </resources> + <connections> + <connection> + <sender>filepath</sender> + <signal>returnPressed()</signal> + <receiver>displayBtn</receiver> + <slot>click()</slot> + <hints> + <hint type="sourcelabel" > + <x>213</x> + <y>62</y> + </hint> + <hint type="destinationlabel" > + <x>564</x> + <y>64</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/milena/sandbox/lazzara/igr/gui/ui/display_seg.ui b/milena/sandbox/lazzara/igr/gui/ui/display_seg.ui new file mode 100644 index 0000000..f005511 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui/display_seg.ui @@ -0,0 +1,108 @@ +<ui version="4.0" > + <class>DisplaySeg</class> + <widget class="QWidget" name="DisplaySeg" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout" > + <item row="0" column="0" > + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <layout class="QHBoxLayout" name="horizontalLayout" > + <item> + <widget class="QLabel" name="label" > + <property name="text" > + <string>Image</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="filepath" /> + </item> + <item> + <widget class="QPushButton" name="browseBtn" > + <property name="text" > + <string>&Browse</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2" > + <item> + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Segmentation</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="segfilepath" /> + </item> + <item> + <widget class="QPushButton" name="browseSegBtn" > + <property name="text" > + <string>&Browse</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3" > + <item> + <spacer name="horizontalSpacer" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>48</width> + <height>17</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="loadBtn" > + <property name="text" > + <string>&Load</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="mln::demo::image_viewer" native="1" name="viewer" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>mln::demo::image_viewer</class> + <extends>QWidget</extends> + <header>src/image_viewer.hh</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/milena/sandbox/lazzara/igr/gui/ui/edit_seg.ui b/milena/sandbox/lazzara/igr/gui/ui/edit_seg.ui new file mode 100644 index 0000000..f79026d --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui/edit_seg.ui @@ -0,0 +1,97 @@ +<ui version="4.0" > + <class>EditSeg</class> + <widget class="QWidget" name="EditSeg" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout" > + <item row="0" column="0" > + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2" > + <item> + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Segmentation</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="filepath" /> + </item> + <item> + <widget class="QPushButton" name="browseBtn" > + <property name="text" > + <string>&Browse</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3" > + <item> + <spacer name="horizontalSpacer" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>48</width> + <height>17</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="reloadBtn" > + <property name="text" > + <string>&Reload</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="saveBtn" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>&Save changes</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="mln::demo::image_viewer" native="1" name="viewer" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>mln::demo::image_viewer</class> + <extends>QWidget</extends> + <header>src/image_viewer.hh</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/milena/sandbox/lazzara/igr/gui/ui/image_viewer.ui b/milena/sandbox/lazzara/igr/gui/ui/image_viewer.ui new file mode 100644 index 0000000..450f982 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui/image_viewer.ui @@ -0,0 +1,154 @@ +<ui version="4.0" > + <class>ImageViewer</class> + <widget class="QWidget" name="ImageViewer" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>464</width> + <height>350</height> + </rect> + </property> + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2" > + <item> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2" > + <item> + <spacer name="horizontalSpacer" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="zoomLabel" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>Zoom:</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="zoomIn" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>+</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="zoomOut" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>-</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="zoomFixed" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>Fixed width</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="zoomOriginal" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>Original size</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QGraphicsView" name="image" > + <property name="interactive" > + <bool>true</bool> + </property> + <property name="renderHints" > + <set>QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="sliderLayout" > + <item> + <widget class="QSlider" name="slider" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition" > + <enum>QSlider::TicksAbove</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Current Frame :</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="frame_nb" > + <property name="font" > + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text" > + <string>0</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/milena/sandbox/lazzara/igr/gui/ui/main_window.ui b/milena/sandbox/lazzara/igr/gui/ui/main_window.ui new file mode 100644 index 0000000..75f3327 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui/main_window.ui @@ -0,0 +1,64 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>487</width> + <height>335</height> + </rect> + </property> + <property name="windowTitle" > + <string>Segmentation tools</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QGridLayout" name="gridLayout" > + <item row="0" column="0" > + <widget class="QTabWidget" name="tabWidget" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="mln::demo::display_seg" name="Visualization" > + <attribute name="title" > + <string>Visualization</string> + </attribute> + </widget> + <widget class="mln::demo::edit_seg" name="Edition" > + <attribute name="title" > + <string>Edition</string> + </attribute> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>487</width> + <height>31</height> + </rect> + </property> + </widget> + <widget class="QStatusBar" name="statusbar" /> + </widget> + <customwidgets> + <customwidget> + <class>mln::demo::display_seg</class> + <extends>QWidget</extends> + <header>src/display_seg.hh</header> + <container>1</container> + </customwidget> + <customwidget> + <class>mln::demo::edit_seg</class> + <extends>QWidget</extends> + <header>src/edit_seg.hh</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/milena/sandbox/lazzara/igr/gui/ui_display_seg.h b/milena/sandbox/lazzara/igr/gui/ui_display_seg.h new file mode 100644 index 0000000..5875534 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui_display_seg.h @@ -0,0 +1,148 @@ +/******************************************************************************** +** Form generated from reading ui file 'display_seg.ui' +** +** Created: Wed Oct 28 12:45:22 2009 +** by: Qt User Interface Compiler version 4.4.3 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + +#ifndef UI_DISPLAY_SEG_H +#define UI_DISPLAY_SEG_H + +#include <QtCore/QVariant> +#include <QtGui/QAction> +#include <QtGui/QApplication> +#include <QtGui/QButtonGroup> +#include <QtGui/QGridLayout> +#include <QtGui/QHBoxLayout> +#include <QtGui/QLabel> +#include <QtGui/QLineEdit> +#include <QtGui/QPushButton> +#include <QtGui/QSpacerItem> +#include <QtGui/QVBoxLayout> +#include <QtGui/QWidget> +#include "src/image_viewer.hh" + +QT_BEGIN_NAMESPACE + +class Ui_DisplaySeg +{ +public: + QGridLayout *gridLayout; + QVBoxLayout *verticalLayout; + QHBoxLayout *horizontalLayout; + QLabel *label; + QLineEdit *filepath; + QPushButton *browseBtn; + QHBoxLayout *horizontalLayout_2; + QLabel *label_2; + QLineEdit *segfilepath; + QPushButton *browseSegBtn; + QHBoxLayout *horizontalLayout_3; + QSpacerItem *horizontalSpacer; + QPushButton *loadBtn; + mln::demo::image_viewer *viewer; + + void setupUi(QWidget *DisplaySeg) + { + if (DisplaySeg->objectName().isEmpty()) + DisplaySeg->setObjectName(QString::fromUtf8("DisplaySeg")); + DisplaySeg->resize(400, 300); + gridLayout = new QGridLayout(DisplaySeg); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + verticalLayout = new QVBoxLayout(); + verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); + horizontalLayout = new QHBoxLayout(); + horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); + label = new QLabel(DisplaySeg); + label->setObjectName(QString::fromUtf8("label")); + + horizontalLayout->addWidget(label); + + filepath = new QLineEdit(DisplaySeg); + filepath->setObjectName(QString::fromUtf8("filepath")); + + horizontalLayout->addWidget(filepath); + + browseBtn = new QPushButton(DisplaySeg); + browseBtn->setObjectName(QString::fromUtf8("browseBtn")); + + horizontalLayout->addWidget(browseBtn); + + + verticalLayout->addLayout(horizontalLayout); + + horizontalLayout_2 = new QHBoxLayout(); + horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); + label_2 = new QLabel(DisplaySeg); + label_2->setObjectName(QString::fromUtf8("label_2")); + + horizontalLayout_2->addWidget(label_2); + + segfilepath = new QLineEdit(DisplaySeg); + segfilepath->setObjectName(QString::fromUtf8("segfilepath")); + + horizontalLayout_2->addWidget(segfilepath); + + browseSegBtn = new QPushButton(DisplaySeg); + browseSegBtn->setObjectName(QString::fromUtf8("browseSegBtn")); + + horizontalLayout_2->addWidget(browseSegBtn); + + + verticalLayout->addLayout(horizontalLayout_2); + + horizontalLayout_3 = new QHBoxLayout(); + horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); + horizontalSpacer = new QSpacerItem(48, 17, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer); + + loadBtn = new QPushButton(DisplaySeg); + loadBtn->setObjectName(QString::fromUtf8("loadBtn")); + + horizontalLayout_3->addWidget(loadBtn); + + + verticalLayout->addLayout(horizontalLayout_3); + + viewer = new mln::demo::image_viewer(DisplaySeg); + viewer->setObjectName(QString::fromUtf8("viewer")); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(viewer->sizePolicy().hasHeightForWidth()); + viewer->setSizePolicy(sizePolicy); + + verticalLayout->addWidget(viewer); + + + gridLayout->addLayout(verticalLayout, 0, 0, 1, 1); + + + retranslateUi(DisplaySeg); + + QMetaObject::connectSlotsByName(DisplaySeg); + } // setupUi + + void retranslateUi(QWidget *DisplaySeg) + { + DisplaySeg->setWindowTitle(QApplication::translate("DisplaySeg", "Form", 0, QApplication::UnicodeUTF8)); + label->setText(QApplication::translate("DisplaySeg", "Image", 0, QApplication::UnicodeUTF8)); + browseBtn->setText(QApplication::translate("DisplaySeg", "&Browse", 0, QApplication::UnicodeUTF8)); + label_2->setText(QApplication::translate("DisplaySeg", "Segmentation", 0, QApplication::UnicodeUTF8)); + browseSegBtn->setText(QApplication::translate("DisplaySeg", "&Browse", 0, QApplication::UnicodeUTF8)); + loadBtn->setText(QApplication::translate("DisplaySeg", "&Load", 0, QApplication::UnicodeUTF8)); + Q_UNUSED(DisplaySeg); + } // retranslateUi + +}; + +namespace Ui { + class DisplaySeg: public Ui_DisplaySeg {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_DISPLAY_SEG_H diff --git a/milena/sandbox/lazzara/igr/gui/ui_edit_seg.h b/milena/sandbox/lazzara/igr/gui/ui_edit_seg.h new file mode 100644 index 0000000..9d8e07e --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui_edit_seg.h @@ -0,0 +1,130 @@ +/******************************************************************************** +** Form generated from reading ui file 'edit_seg.ui' +** +** Created: Wed Oct 28 12:45:22 2009 +** by: Qt User Interface Compiler version 4.4.3 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + +#ifndef UI_EDIT_SEG_H +#define UI_EDIT_SEG_H + +#include <QtCore/QVariant> +#include <QtGui/QAction> +#include <QtGui/QApplication> +#include <QtGui/QButtonGroup> +#include <QtGui/QGridLayout> +#include <QtGui/QHBoxLayout> +#include <QtGui/QLabel> +#include <QtGui/QLineEdit> +#include <QtGui/QPushButton> +#include <QtGui/QSpacerItem> +#include <QtGui/QVBoxLayout> +#include <QtGui/QWidget> +#include "src/image_viewer.hh" + +QT_BEGIN_NAMESPACE + +class Ui_EditSeg +{ +public: + QGridLayout *gridLayout; + QVBoxLayout *verticalLayout; + QHBoxLayout *horizontalLayout_2; + QLabel *label_2; + QLineEdit *filepath; + QPushButton *browseBtn; + QHBoxLayout *horizontalLayout_3; + QSpacerItem *horizontalSpacer; + QPushButton *reloadBtn; + QPushButton *saveBtn; + mln::demo::image_viewer *viewer; + + void setupUi(QWidget *EditSeg) + { + if (EditSeg->objectName().isEmpty()) + EditSeg->setObjectName(QString::fromUtf8("EditSeg")); + EditSeg->resize(400, 300); + gridLayout = new QGridLayout(EditSeg); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + verticalLayout = new QVBoxLayout(); + verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); + horizontalLayout_2 = new QHBoxLayout(); + horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); + label_2 = new QLabel(EditSeg); + label_2->setObjectName(QString::fromUtf8("label_2")); + + horizontalLayout_2->addWidget(label_2); + + filepath = new QLineEdit(EditSeg); + filepath->setObjectName(QString::fromUtf8("filepath")); + + horizontalLayout_2->addWidget(filepath); + + browseBtn = new QPushButton(EditSeg); + browseBtn->setObjectName(QString::fromUtf8("browseBtn")); + + horizontalLayout_2->addWidget(browseBtn); + + + verticalLayout->addLayout(horizontalLayout_2); + + horizontalLayout_3 = new QHBoxLayout(); + horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); + horizontalSpacer = new QSpacerItem(48, 17, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer); + + reloadBtn = new QPushButton(EditSeg); + reloadBtn->setObjectName(QString::fromUtf8("reloadBtn")); + + horizontalLayout_3->addWidget(reloadBtn); + + saveBtn = new QPushButton(EditSeg); + saveBtn->setObjectName(QString::fromUtf8("saveBtn")); + saveBtn->setEnabled(false); + + horizontalLayout_3->addWidget(saveBtn); + + + verticalLayout->addLayout(horizontalLayout_3); + + viewer = new mln::demo::image_viewer(EditSeg); + viewer->setObjectName(QString::fromUtf8("viewer")); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(viewer->sizePolicy().hasHeightForWidth()); + viewer->setSizePolicy(sizePolicy); + + verticalLayout->addWidget(viewer); + + + gridLayout->addLayout(verticalLayout, 0, 0, 1, 1); + + + retranslateUi(EditSeg); + + QMetaObject::connectSlotsByName(EditSeg); + } // setupUi + + void retranslateUi(QWidget *EditSeg) + { + EditSeg->setWindowTitle(QApplication::translate("EditSeg", "Form", 0, QApplication::UnicodeUTF8)); + label_2->setText(QApplication::translate("EditSeg", "Segmentation", 0, QApplication::UnicodeUTF8)); + browseBtn->setText(QApplication::translate("EditSeg", "&Browse", 0, QApplication::UnicodeUTF8)); + reloadBtn->setText(QApplication::translate("EditSeg", "&Reload", 0, QApplication::UnicodeUTF8)); + saveBtn->setText(QApplication::translate("EditSeg", "&Save changes", 0, QApplication::UnicodeUTF8)); + Q_UNUSED(EditSeg); + } // retranslateUi + +}; + +namespace Ui { + class EditSeg: public Ui_EditSeg {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_EDIT_SEG_H diff --git a/milena/sandbox/lazzara/igr/gui/ui_image_viewer.h b/milena/sandbox/lazzara/igr/gui/ui_image_viewer.h new file mode 100644 index 0000000..01cc5df --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui_image_viewer.h @@ -0,0 +1,167 @@ +/******************************************************************************** +** Form generated from reading ui file 'image_viewer.ui' +** +** Created: Wed Oct 28 12:45:22 2009 +** by: Qt User Interface Compiler version 4.4.3 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + +#ifndef UI_IMAGE_VIEWER_H +#define UI_IMAGE_VIEWER_H + +#include <QtCore/QVariant> +#include <QtGui/QAction> +#include <QtGui/QApplication> +#include <QtGui/QButtonGroup> +#include <QtGui/QGraphicsView> +#include <QtGui/QHBoxLayout> +#include <QtGui/QLabel> +#include <QtGui/QPushButton> +#include <QtGui/QSlider> +#include <QtGui/QSpacerItem> +#include <QtGui/QVBoxLayout> +#include <QtGui/QWidget> + +QT_BEGIN_NAMESPACE + +class Ui_ImageViewer +{ +public: + QVBoxLayout *verticalLayout_2; + QVBoxLayout *verticalLayout; + QHBoxLayout *horizontalLayout_2; + QSpacerItem *horizontalSpacer; + QLabel *zoomLabel; + QPushButton *zoomIn; + QPushButton *zoomOut; + QPushButton *zoomFixed; + QPushButton *zoomOriginal; + QSpacerItem *horizontalSpacer_2; + QGraphicsView *image; + QHBoxLayout *sliderLayout; + QSlider *slider; + QLabel *label_2; + QLabel *frame_nb; + + void setupUi(QWidget *ImageViewer) + { + if (ImageViewer->objectName().isEmpty()) + ImageViewer->setObjectName(QString::fromUtf8("ImageViewer")); + ImageViewer->resize(464, 350); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(ImageViewer->sizePolicy().hasHeightForWidth()); + ImageViewer->setSizePolicy(sizePolicy); + verticalLayout_2 = new QVBoxLayout(ImageViewer); + verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); + verticalLayout = new QVBoxLayout(); + verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); + horizontalLayout_2 = new QHBoxLayout(); + horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_2->addItem(horizontalSpacer); + + zoomLabel = new QLabel(ImageViewer); + zoomLabel->setObjectName(QString::fromUtf8("zoomLabel")); + zoomLabel->setEnabled(false); + + horizontalLayout_2->addWidget(zoomLabel); + + zoomIn = new QPushButton(ImageViewer); + zoomIn->setObjectName(QString::fromUtf8("zoomIn")); + zoomIn->setEnabled(false); + + horizontalLayout_2->addWidget(zoomIn); + + zoomOut = new QPushButton(ImageViewer); + zoomOut->setObjectName(QString::fromUtf8("zoomOut")); + zoomOut->setEnabled(false); + + horizontalLayout_2->addWidget(zoomOut); + + zoomFixed = new QPushButton(ImageViewer); + zoomFixed->setObjectName(QString::fromUtf8("zoomFixed")); + zoomFixed->setEnabled(false); + + horizontalLayout_2->addWidget(zoomFixed); + + zoomOriginal = new QPushButton(ImageViewer); + zoomOriginal->setObjectName(QString::fromUtf8("zoomOriginal")); + zoomOriginal->setEnabled(false); + + horizontalLayout_2->addWidget(zoomOriginal); + + horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_2->addItem(horizontalSpacer_2); + + + verticalLayout->addLayout(horizontalLayout_2); + + image = new QGraphicsView(ImageViewer); + image->setObjectName(QString::fromUtf8("image")); + image->setInteractive(true); + image->setRenderHints(QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing); + + verticalLayout->addWidget(image); + + sliderLayout = new QHBoxLayout(); + sliderLayout->setObjectName(QString::fromUtf8("sliderLayout")); + slider = new QSlider(ImageViewer); + slider->setObjectName(QString::fromUtf8("slider")); + slider->setOrientation(Qt::Horizontal); + slider->setTickPosition(QSlider::TicksAbove); + + sliderLayout->addWidget(slider); + + label_2 = new QLabel(ImageViewer); + label_2->setObjectName(QString::fromUtf8("label_2")); + + sliderLayout->addWidget(label_2); + + frame_nb = new QLabel(ImageViewer); + frame_nb->setObjectName(QString::fromUtf8("frame_nb")); + QFont font; + font.setBold(true); + font.setWeight(75); + frame_nb->setFont(font); + + sliderLayout->addWidget(frame_nb); + + + verticalLayout->addLayout(sliderLayout); + + + verticalLayout_2->addLayout(verticalLayout); + + + retranslateUi(ImageViewer); + + QMetaObject::connectSlotsByName(ImageViewer); + } // setupUi + + void retranslateUi(QWidget *ImageViewer) + { + ImageViewer->setWindowTitle(QApplication::translate("ImageViewer", "Form", 0, QApplication::UnicodeUTF8)); + zoomLabel->setText(QApplication::translate("ImageViewer", "Zoom:", 0, QApplication::UnicodeUTF8)); + zoomIn->setText(QApplication::translate("ImageViewer", "+", 0, QApplication::UnicodeUTF8)); + zoomOut->setText(QApplication::translate("ImageViewer", "-", 0, QApplication::UnicodeUTF8)); + zoomFixed->setText(QApplication::translate("ImageViewer", "Fixed width", 0, QApplication::UnicodeUTF8)); + zoomOriginal->setText(QApplication::translate("ImageViewer", "Original size", 0, QApplication::UnicodeUTF8)); + label_2->setText(QApplication::translate("ImageViewer", "Current Frame :", 0, QApplication::UnicodeUTF8)); + frame_nb->setText(QApplication::translate("ImageViewer", "0", 0, QApplication::UnicodeUTF8)); + Q_UNUSED(ImageViewer); + } // retranslateUi + +}; + +namespace Ui { + class ImageViewer: public Ui_ImageViewer {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_IMAGE_VIEWER_H diff --git a/milena/sandbox/lazzara/igr/gui/ui_main_window.h b/milena/sandbox/lazzara/igr/gui/ui_main_window.h new file mode 100644 index 0000000..0f1ce23 --- /dev/null +++ b/milena/sandbox/lazzara/igr/gui/ui_main_window.h @@ -0,0 +1,92 @@ +/******************************************************************************** +** Form generated from reading ui file 'main_window.ui' +** +** Created: Wed Oct 28 13:14:49 2009 +** by: Qt User Interface Compiler version 4.4.3 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + +#ifndef UI_MAIN_WINDOW_H +#define UI_MAIN_WINDOW_H + +#include <QtCore/QVariant> +#include <QtGui/QAction> +#include <QtGui/QApplication> +#include <QtGui/QButtonGroup> +#include <QtGui/QGridLayout> +#include <QtGui/QMainWindow> +#include <QtGui/QMenuBar> +#include <QtGui/QStatusBar> +#include <QtGui/QTabWidget> +#include <QtGui/QWidget> +#include "src/display_seg.hh" +#include "src/edit_seg.hh" + +QT_BEGIN_NAMESPACE + +class Ui_MainWindow +{ +public: + QWidget *centralwidget; + QGridLayout *gridLayout; + QTabWidget *tabWidget; + mln::demo::display_seg *Visualization; + mln::demo::edit_seg *Edition; + QMenuBar *menubar; + QStatusBar *statusbar; + + void setupUi(QMainWindow *MainWindow) + { + if (MainWindow->objectName().isEmpty()) + MainWindow->setObjectName(QString::fromUtf8("MainWindow")); + MainWindow->resize(487, 335); + centralwidget = new QWidget(MainWindow); + centralwidget->setObjectName(QString::fromUtf8("centralwidget")); + gridLayout = new QGridLayout(centralwidget); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + tabWidget = new QTabWidget(centralwidget); + tabWidget->setObjectName(QString::fromUtf8("tabWidget")); + Visualization = new mln::demo::display_seg(); + Visualization->setObjectName(QString::fromUtf8("Visualization")); + tabWidget->addTab(Visualization, QString()); + Edition = new mln::demo::edit_seg(); + Edition->setObjectName(QString::fromUtf8("Edition")); + tabWidget->addTab(Edition, QString()); + + gridLayout->addWidget(tabWidget, 0, 0, 1, 1); + + MainWindow->setCentralWidget(centralwidget); + menubar = new QMenuBar(MainWindow); + menubar->setObjectName(QString::fromUtf8("menubar")); + menubar->setGeometry(QRect(0, 0, 487, 31)); + MainWindow->setMenuBar(menubar); + statusbar = new QStatusBar(MainWindow); + statusbar->setObjectName(QString::fromUtf8("statusbar")); + MainWindow->setStatusBar(statusbar); + + retranslateUi(MainWindow); + + tabWidget->setCurrentIndex(0); + + + QMetaObject::connectSlotsByName(MainWindow); + } // setupUi + + void retranslateUi(QMainWindow *MainWindow) + { + MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Segmentation tools", 0, QApplication::UnicodeUTF8)); + tabWidget->setTabText(tabWidget->indexOf(Visualization), QApplication::translate("MainWindow", "Visualization", 0, QApplication::UnicodeUTF8)); + tabWidget->setTabText(tabWidget->indexOf(Edition), QApplication::translate("MainWindow", "Edition", 0, QApplication::UnicodeUTF8)); + Q_UNUSED(MainWindow); + } // retranslateUi + +}; + +namespace Ui { + class MainWindow: public Ui_MainWindow {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_MAIN_WINDOW_H -- 1.5.6.5