Index: ChangeLog
from Christophe Berger <christophe(a)lrde.epita.fr>
* oln/appli/astro/graphical_interface: New.
* oln/appli/astro/graphical_interface/interface.pro: New.
* oln/appli/astro/graphical_interface/image_viewer.hh: New.
* oln/appli/astro/graphical_interface/visualization_window.ui: New.
* oln/appli/astro/graphical_interface/filterinterface.hh: New.
* oln/appli/astro/graphical_interface/main.cc: New.
* oln/appli/astro/graphical_interface/qtincludes.hh: New.
* oln/appli/astro/graphical_interface/Readme: New.
* oln/appli/astro/graphical_interface/utils.hh: New.
Readme | 15 +
filterinterface.hh | 180 +++++++++++++++++++++++
image_viewer.hh | 147 ++++++++++++++++++
interface.pro | 17 ++
main.cc | 59 +++++++
qtincludes.hh | 35 ++++
utils.hh | 50 ++++++
visualization_window.ui | 375 ++++++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 878 insertions(+)
Index: oln/appli/astro/graphical_interface/main.cc
--- oln/appli/astro/graphical_interface/main.cc (revision 0)
+++ oln/appli/astro/graphical_interface/main.cc (revision 0)
@@ -0,0 +1,59 @@
+// Copyright (C) 2005 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library 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 <oln/basics2d.hh>
+#include <ntg/real/int_u.hh>
+#include <oln/fancy/iota.hh>
+#include <oln/fancy/print.hh>
+#include <oln/appli/astro/clean.hh>
+#include <oln/io/write_image.hh>
+#include <oln/io/read_image.hh>
+#include <qapplication.h>
+#include "filterinterface.hh"
+
+int main(int argc, char * argv[])
+{
+ typedef oln::image_with_nbh<oln::image2d<ntg::int_u8>, oln::neighborhood2d>
ima_type;
+
+ QApplication app(argc, argv);
+
+ if (argc < 2)
+ {
+ std::cout << "Usage: " << argv[0] << "
<image_file>" << std::endl;
+ return 1;
+ }
+
+ oln::image2d<ntg::int_u8> ima_raw;
+ ima_raw = oln::io::read(argv[1]);
+ ima_type ima(ima_raw, oln::neighb_c4());
+ oln::appli::astro::clean<ima_type> mt(ima);
+
+ FilterVisualizationWindow win(argv[1], mt);
+ app.setMainWidget(&win);
+ win.show();
+ return app.exec();
+}
Index: oln/appli/astro/graphical_interface/visualization_window.ui
--- oln/appli/astro/graphical_interface/visualization_window.ui (revision 0)
+++ oln/appli/astro/graphical_interface/visualization_window.ui (revision 0)
@@ -0,0 +1,375 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>visualisation_window</class>
+<widget class="QMainWindow">
+ <property name="name">
+ <cstring>visualisation_window</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>583</width>
+ <height>467</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Connected Filters</string>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>compute_button</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>70</y>
+ <width>120</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Compute tree</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>view_input_image_button</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>120</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Display input</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>save_result_button</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>190</y>
+ <width>120</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Save result</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>redraw_button</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>120</y>
+ <width>120</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Redraw output</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>text_intro</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>210</x>
+ <y>20</y>
+ <width>190</width>
+ <height>45</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Please choose attributes
+you want to use :</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>text_state</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>390</y>
+ <width>540</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_height</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>330</x>
+ <y>180</y>
+ <width>59</width>
+ <height>29</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>999999</number>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>active_tower</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>230</x>
+ <y>330</y>
+ <width>180</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Rectangular "towers"</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>active_center_point</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>230</x>
+ <y>280</y>
+ <width>120</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Center point</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>active_circle</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>230</x>
+ <y>230</y>
+ <width>80</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Circle</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>active_height</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>230</x>
+ <y>180</y>
+ <width>80</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Height</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>active_area</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>230</x>
+ <y>130</y>
+ <width>80</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Area</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>active_level</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>230</x>
+ <y>80</y>
+ <width>80</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Level</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_area</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>330</x>
+ <y>130</y>
+ <width>60</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>999999</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_level</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>330</x>
+ <y>80</y>
+ <width>60</width>
+ <height>29</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ </widget>
+</widget>
+<toolbars>
+</toolbars>
+<connections>
+ <connection>
+ <sender>compute_button</sender>
+ <signal>clicked()</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>ComputeTree()</slot>
+ </connection>
+ <connection>
+ <sender>redraw_button</sender>
+ <signal>clicked()</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>DisplayImage()</slot>
+ </connection>
+ <connection>
+ <sender>save_result_button</sender>
+ <signal>clicked()</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>SaveResult()</slot>
+ </connection>
+ <connection>
+ <sender>value_area</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>UpdateValues()</slot>
+ </connection>
+ <connection>
+ <sender>value_height</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>UpdateValues()</slot>
+ </connection>
+ <connection>
+ <sender>value_level</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>UpdateValues()</slot>
+ </connection>
+ <connection>
+ <sender>view_input_image_button</sender>
+ <signal>clicked()</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>DisplayInputImage()</slot>
+ </connection>
+ <connection>
+ <sender>active_area</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_area()</slot>
+ </connection>
+ <connection>
+ <sender>active_center_point</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_center_point()</slot>
+ </connection>
+ <connection>
+ <sender>active_circle</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_circle()</slot>
+ </connection>
+ <connection>
+ <sender>active_height</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_height()</slot>
+ </connection>
+ <connection>
+ <sender>active_level</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_level()</slot>
+ </connection>
+ <connection>
+ <sender>active_tower</sender>
+ <signal>stateChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>Attribute_tower()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>DisplayImage()</slot>
+ <slot>UpdateValues()</slot>
+ <slot>ComputeTree()</slot>
+ <slot>DisplayInputImage()</slot>
+ <slot>SaveResult()</slot>
+ <slot>Attribute_level()</slot>
+ <slot>Attribute_area()</slot>
+ <slot>Attribute_height()</slot>
+ <slot>Attribute_center_point()</slot>
+ <slot>Attribute_circle()</slot>
+ <slot>Attribute_tower()</slot>
+</slots>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
Index: oln/appli/astro/graphical_interface/utils.hh
--- oln/appli/astro/graphical_interface/utils.hh (revision 0)
+++ oln/appli/astro/graphical_interface/utils.hh (revision 0)
@@ -0,0 +1,50 @@
+// Copyright (C) 2005 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library 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 _UTILS_HH_
+# define _UTILS_HH_
+
+namespace Utils {
+ std::string int2string(int inum)
+ {
+ using namespace std;
+ ostringstream oss;
+ oss << inum;
+ string snum(oss.str());
+ return snum;
+ }
+ int string2int(std::string snum)
+ {
+ using namespace std;
+ istringstream iss(snum);
+ int inum;
+ iss >> inum;
+ return inum;
+ }
+}
+
+#endif // !_UTILS_HH_
Index: oln/appli/astro/graphical_interface/image_viewer.hh
--- oln/appli/astro/graphical_interface/image_viewer.hh (revision 0)
+++ oln/appli/astro/graphical_interface/image_viewer.hh (revision 0)
@@ -0,0 +1,147 @@
+// Copyright (C) 2005 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library 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 _IMAGE_VIEWER_HH_
+# define _IMAGE_VIEWER_HH_
+# include "qtincludes.hh"
+
+class image_viewer : public QWidget
+{
+
+public:
+
+ QImage img_;
+ int loaded;
+ int h_;
+ int w_;
+ double coeff_;
+
+ image_viewer()
+ {
+ loaded = 0;
+ }
+
+ ~image_viewer()
+ {
+ close();
+ }
+
+ void load(const char *fname)
+ {
+ loaded = 1;
+ if (!img_.load(fname))
+ {
+ setCaption((std::string("LOAD FAILED ") + fname).c_str());
+ resize(width(), 200);
+ resize(height(), 200);
+ loaded = 0;
+ return;
+ }
+ w_ = img_.width();
+ h_ = img_.height();
+ coeff_ = 1;
+ resize_window(w_, h_);
+ };
+
+ void reload(const char *fname)
+ {
+ if (!loaded)
+ load(fname);
+ else
+ {
+ double scoeff = coeff_;
+ QWMatrix m;
+ load(fname);
+ coeff_ = scoeff;
+ m.scale(coeff_, coeff_);
+ img_ = img_.xForm(m);
+ }
+ resize_window(img_.width(), img_.height());
+ }
+
+ void resize_window(int w, int h)
+ {
+ resize(w, h);
+ setMinimumSize(w, h);
+ setMaximumSize(w, h);
+ }
+
+ void resize_image(int scale_type)
+ {
+ QWMatrix m;
+ if (scale_type < 0)
+ {
+ m.scale(0.5, 0.5);
+ coeff_ *= 0.5;
+ }
+ else if (scale_type > 0)
+ {
+ m.scale(2, 2);
+ coeff_ *= 2;
+ }
+ else
+ {
+ m.scale(coeff_, coeff_);
+ coeff_ = 1;
+ }
+ img_ = img_.xForm(m);
+ resize_window(img_.width(), img_.height());
+ }
+
+
+protected:
+
+ void closeEvent(QCloseEvent *e)
+ {
+ hide();
+ };
+
+ void paintEvent(QPaintEvent *pe)
+ {
+ if (!loaded) return;
+ bitBlt(this, 0, 0, &img_, 0, 0, img_.width(), img_.height(), CopyROP);
+ };
+
+ void mouseReleaseEvent(QMouseEvent * e)
+ {
+ switch(e->button())
+ {
+ case LeftButton:
+ resize_image(-1);
+ break;
+ case RightButton:
+ resize_image(1);
+ break;
+ case MidButton:
+ resize_image(0);
+ break;
+ }
+ }
+
+};
+
+#endif // !_IMAGE_VIEWER_HH_
Index: oln/appli/astro/graphical_interface/qtincludes.hh
--- oln/appli/astro/graphical_interface/qtincludes.hh (revision 0)
+++ oln/appli/astro/graphical_interface/qtincludes.hh (revision 0)
@@ -0,0 +1,35 @@
+// Copyright (C) 2005 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library 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.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <qimage.h>
+#include <qwmatrix.h>
+#include <qslider.h>
+#include <qcheckbox.h>
+#include <qspinbox.h>
Index: oln/appli/astro/graphical_interface/interface.pro
--- oln/appli/astro/graphical_interface/interface.pro (revision 0)
+++ oln/appli/astro/graphical_interface/interface.pro (revision 0)
@@ -0,0 +1,17 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+INCLUDEPATH += .
+
+SOURCES += main.cc
+
+HEADERS += filterinterface.hh image_viewer.hh qtincludes.hh utils.hh
+
+FORMS = visualization_window.ui
+
+######################################################################
+# Automatically generated by qmake (1.07a) Wed May 25 10:08:50 2005
+######################################################################
+
+
+# Input
Index: oln/appli/astro/graphical_interface/Readme
--- oln/appli/astro/graphical_interface/Readme (revision 0)
+++ oln/appli/astro/graphical_interface/Readme (revision 0)
@@ -0,0 +1,15 @@
+you will need qt3 library (and headers) to compile this graphical interface.
+
+to create the Makefile just type:
+qmake
+
+You will need to edit the Makefile to insert the include paths for Olena:
+INCPATH = .... -I/path/to/olena/metalic -I/path/to/olena/integre \
+ -I/path/to/olena/olena
+
+Please also delete "-W" and "-Wall" from the following lines :
+CFLAGS = ...
+CXXFLAGS = ...
+
+You can add -DNDEBUG to these lines.
+
Index: oln/appli/astro/graphical_interface/filterinterface.hh
--- oln/appli/astro/graphical_interface/filterinterface.hh (revision 0)
+++ oln/appli/astro/graphical_interface/filterinterface.hh (revision 0)
@@ -0,0 +1,180 @@
+// Copyright (C) 2005 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library 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 _FILTERINTERFACE_HH_
+# define _FILTERINTERFACE_HH_
+# include <string>
+# include <oln/appli/astro/clean.hh>
+# include "qtincludes.hh"
+# include "visualization_window.h"
+# include "image_viewer.hh"
+# include "utils.hh"
+
+class FilterVisualizationWindow : public visualisation_window
+{
+
+public:
+
+ typedef oln::image_with_nbh<oln::image2d<ntg::int_u8>, oln::neighborhood2d>
ima_type;
+
+ FilterVisualizationWindow(const std::string& input_file_,
+ oln::appli::astro::clean<ima_type>& mt)
+ : mt_(mt), input_file_(input_file_)
+ {
+ display_in_.reload(input_file_.c_str());
+ display_in_.hide();
+ display_out_.hide();
+ sprintf(tmp_, "/tmp/olni.XXXXXX");
+ mkstemp(tmp_);
+ sprintf(tmp_ + 16, ".pgm");
+ }
+
+ ~FilterVisualizationWindow() {}
+
+ virtual void UpdateValues()
+ {
+ mt_.set_area(value_area->value());
+ mt_.set_level(value_level->value());
+ mt_.set_height(value_height->value());
+ std::string out = "attributes value changed.";// area("
+// + Utils::int2string(value_area->value())
+// + "), point_value("
+// + Utils::int2string(value_level->value())
+// + ")";
+ this->text_state->setText(out.c_str());
+ }
+
+ virtual void ComputeTree()
+ {
+ this->text_state->setText("computing tree, please wait...");
+ this->compute_button->setEnabled(false);
+
+ mt_.compute_tree();
+
+ this->redraw_button->setEnabled(true);
+ this->save_result_button->setEnabled(true);
+ this->text_state->setText("Tree computed, please choose
attributes'values to draw the result.");
+ }
+
+ virtual void DisplayImage()
+ {
+ this->text_state->setText("computing resulting image, please
wait...");
+ mt_.filter_process();
+ oln::io::write(mt_.output, tmp_);
+ this->text_state->setText("displaying result");
+ display_out_.reload(tmp_);
+ this->text_state->setText("");
+ display_out_.show();
+ }
+
+ virtual void DisplayInputImage()
+ {
+ display_in_.show();
+ }
+
+ virtual void SaveResult()
+ {
+ this->text_state->setText("saving resulting image, please wait...");
+ oln::io::write(mt_.output, "./out.pgm");
+ this->text_state->setText("image succesfully saved to ./out.pgm");
+ }
+
+ virtual void Attribute_area()
+ {
+ if (this->active_area->isChecked())
+ {
+ this->value_area->setEnabled(true);
+ mt_.area_tag_ = true;
+ }
+ else
+ {
+ this->value_area->setEnabled(false);
+ mt_.area_tag_ = false;
+ }
+ }
+
+ virtual void Attribute_level()
+ {
+ if (this->active_level->isChecked())
+ {
+ this->value_level->setEnabled(true);
+ mt_.level_tag_ = true;
+ }
+ else
+ {
+ this->value_level->setEnabled(false);
+ mt_.level_tag_ = false;
+ }
+ }
+
+ virtual void Attribute_height()
+ {
+ if (this->active_height->isChecked())
+ {
+ this->value_height->setEnabled(true);
+ mt_.height_tag_ = true;
+ }
+ else
+ {
+ this->value_height->setEnabled(false);
+ mt_.height_tag_ = false;
+ }
+ }
+
+ virtual void Attribute_circle()
+ {
+ if (this->active_circle->isChecked())
+ mt_.circle_tag_ = true;
+ else
+ mt_.circle_tag_ = false;
+ }
+
+ virtual void Attribute_center_point()
+ {
+ if (this->active_center_point->isChecked())
+ mt_.center_p_tag_ = true;
+ else
+ mt_.center_p_tag_ = false;
+ }
+
+ virtual void Attribute_tower()
+ {
+ if (this->active_tower->isChecked())
+ mt_.tour_tag_ = true;
+ else
+ mt_.tour_tag_ = false;
+ }
+
+protected:
+ oln::appli::astro::clean<ima_type>& mt_;
+ image_viewer display_in_;
+ image_viewer display_out_;
+ std::string input_file_;
+ char tmp_[21];
+};
+
+#endif // !_FILTERINTERFACE_HH_