Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
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_
3
2
05 Jul '05
Roland Levillain wrote:
> C'est pas encore gagné avec les collisions d'opérateurs entre Integre
> et Olena (voir le commentaire dans
> olena/oln/morpho/lower_completion.hh), mais ça marche mieux. Peut-être
> qu'il faudrait tous les placer dans un seul namespace ?
surtout que l'on vient de perdre une caractéristique que l'on voulait :
value_box == autre chose pas value_box...
je te propose qu'on patche ensemble une solution !
1
0
04 Jul '05
ChangeLog | 7 +++++
tests/morpho/tests/gradient | 48 --------------------------------------
tests/morpho/tests/thick_gradient | 48 ++++++++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 48 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* tests/morpho/tests/gradient: Catch up with changes on
morphological gradients.
Rename as...
* tests/morpho/tests/thick_gradient: ...this.
2005-07-04 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/tests/morpho/tests/thick_gradient
--- olena/tests/morpho/tests/thick_gradient (révision 0)
+++ olena/tests/morpho/tests/thick_gradient (révision 0)
@@ -0,0 +1,48 @@
+ // -*- C++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include <ntg/int.hh>
+#include <oln/core/2d/image2d.hh>
+#include <oln/core/gen/image_with_nbh.hh>
+#include <oln/io/read_image.hh>
+#include <oln/io/write_image.hh>
+#include <oln/morpho/thick_gradient.hh>
+
+using namespace oln;
+
+bool check()
+{
+ typedef image2d<ntg::int_u8> ima_type;
+ ima_type input;
+ input = io::read(rdata("lena-small.pgm"));
+
+ // Beucher gradient.
+ utils::key::value_type bg_data_key[16] =
+ {0x89, 0xaa, 0x5b, 0xca, 0x8, 0xec, 0xb3, 0xe7,
+ 0x86, 0xfb, 0x4b, 0x59, 0xf0, 0x8, 0xf5, 0x59};
+ utils::key bg_key(bg_data_key);
+ ima_type bg = morpho::thick_gradient_beucher(input, win_c8p());
+ if (utils::md5(bg) != bg_key)
+ return true;
+
+ // Internal gradient.
+ utils::key::value_type ig_data_key[16] =
+ {0xe7, 0xff, 0x90, 0x2a, 0x50, 0x44, 0x30, 0x65,
+ 0xeb, 0xe3, 0xf2, 0xc4, 0x6f, 0xfe, 0x65, 0x84};
+ utils::key ig_key(ig_data_key);
+ ima_type ig = morpho::thick_gradient_internal(input, win_c8p());
+ if (utils::md5(ig) != ig_key)
+ return true;
+
+ // External gradient.
+ utils::key::value_type eg_data_key[16] =
+ {0xf7, 0xb7, 0x9e, 0x74, 0xe0, 0xd1, 0xe7, 0xd8,
+ 0x5b, 0x0, 0xe8, 0x37, 0x57, 0xdc, 0x2c, 0x27};
+ utils::key eg_key(eg_data_key);
+ ima_type eg = morpho::thick_gradient_external(input, win_c8p());
+ if (utils::md5(eg) != eg_key)
+ return true;
+
+ return false;
+}
Index: olena/tests/morpho/tests/gradient
--- olena/tests/morpho/tests/gradient (révision 231)
+++ olena/tests/morpho/tests/gradient (copie de travail)
@@ -1,48 +0,0 @@
- // -*- C++ -*-
-#include "data.hh"
-#include <oln/utils/md5.hh>
-
-#include <ntg/int.hh>
-#include <oln/core/2d/image2d.hh>
-#include <oln/core/gen/image_with_nbh.hh>
-#include <oln/io/read_image.hh>
-#include <oln/io/write_image.hh>
-#include <oln/morpho/gradient.hh>
-
-using namespace oln;
-
-bool check()
-{
- typedef image2d<ntg::int_u8> ima_type;
- ima_type input;
- input = io::read(rdata("lena-small.pgm"));
-
- // Beucher gradient.
- utils::key::value_type bg_data_key[16] =
- {0x89, 0xaa, 0x5b, 0xca, 0x8, 0xec, 0xb3, 0xe7,
- 0x86, 0xfb, 0x4b, 0x59, 0xf0, 0x8, 0xf5, 0x59};
- utils::key bg_key(bg_data_key);
- ima_type bg = morpho::beucher_gradient(input, win_c8p());
- if (utils::md5(bg) != bg_key)
- return true;
-
- // Internal gradient.
- utils::key::value_type ig_data_key[16] =
- {0xe7, 0xff, 0x90, 0x2a, 0x50, 0x44, 0x30, 0x65,
- 0xeb, 0xe3, 0xf2, 0xc4, 0x6f, 0xfe, 0x65, 0x84};
- utils::key ig_key(ig_data_key);
- ima_type ig = morpho::internal_gradient(input, win_c8p());
- if (utils::md5(ig) != ig_key)
- return true;
-
- // External gradient.
- utils::key::value_type eg_data_key[16] =
- {0xf7, 0xb7, 0x9e, 0x74, 0xe0, 0xd1, 0xe7, 0xd8,
- 0x5b, 0x0, 0xe8, 0x37, 0x57, 0xdc, 0x2c, 0x27};
- utils::key eg_key(eg_data_key);
- ima_type eg = morpho::external_gradient(input, win_c8p());
- if (utils::md5(eg) != eg_key)
- return true;
-
- return false;
-}
1
0
ChangeLog | 12 ++++++++++++
oln/convert/conversion.hh | 21 +++++++++++++++++++++
oln/core/pw/image.hh | 2 +-
tests/convert/tests/force | 2 +-
tests/convert/tests/stretch | 31 +++++++++++++++++++++++++++++++
tests/convert/tests/stretch-balance | 27 +++++++++++++++++++++++++++
6 files changed, 93 insertions(+), 2 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add tests on stretch conversions.
* oln/convert/conversion.hh (apply): New.
* tests/convert/tests/stretch,
* tests/convert/tests/stretch-balance: New tests.
* oln/core/pw/image.hh
(set_props <category::image, image_from_pwf<F> >::ch_value_type):
Fix definition.
2005-07-04 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/tests/convert/tests/stretch-balance
--- olena/tests/convert/tests/stretch-balance (révision 0)
+++ olena/tests/convert/tests/stretch-balance (révision 0)
@@ -0,0 +1,27 @@
+ // -*- C++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include <ntg/int.hh>
+#include <oln/io/read_image.hh>
+#include <oln/convert/stretch.hh>
+
+using namespace oln;
+
+bool check()
+{
+ utils::key::value_type data_key[16] =
+ {0x17, 0x33, 0x35, 0x20, 0x34, 0xf, 0x21, 0x14,
+ 0xb1, 0x8f, 0xe5, 0x78, 0xee, 0x7d, 0xb5, 0x83};
+ utils::key key(data_key);
+
+ image2d<ntg::int_u8> input;
+ input = io::read(rdata("16x16.pgm"));
+ image2d<ntg::int_u8> output =
+ convert::stretch_balance<ntg::int_u8>(input);
+
+ if (utils::md5(output) != key)
+ return true;
+
+ return false;
+}
Index: olena/tests/convert/tests/stretch
--- olena/tests/convert/tests/stretch (révision 0)
+++ olena/tests/convert/tests/stretch (révision 0)
@@ -0,0 +1,31 @@
+ // -*- C++ -*-
+#include "data.hh"
+#include <oln/utils/md5.hh>
+
+#include <ntg/int.hh>
+#include <oln/io/read_image.hh>
+#include <oln/convert/conversion.hh>
+#include <oln/convert/stretch.hh>
+
+using namespace oln;
+
+bool check()
+{
+ utils::key::value_type data_key[16] =
+ {0x3d, 0xc9, 0x0, 0x7c, 0x2b, 0x92, 0x38, 0x43,
+ 0x68, 0xd7, 0x6a, 0x3c, 0xa8, 0xd7, 0x90, 0x60};
+ utils::key key(data_key);
+
+ typedef ntg::int_u8 input_value_type;
+ typedef ntg::int_u<2> output_value_type;
+
+ image2d<input_value_type> input;
+ input = io::read(rdata("16x16.pgm"));
+ convert::stretch<output_value_type> f_stretch;
+ image2d<output_value_type> output = convert::apply(f_stretch, input);
+
+ if (utils::md5(output) != key)
+ return true;
+
+ return false;
+}
Index: olena/tests/convert/tests/force
--- olena/tests/convert/tests/force (révision 231)
+++ olena/tests/convert/tests/force (copie de travail)
@@ -10,7 +10,7 @@
{
typedef ntg::int_u8 value_type;
f_::plus_<value_type, value_type> f_plus;
- oln::convert::force<value_type> f_force;
+ convert::force<value_type> f_force;
value_type a = 1;
value_type b = 2;
Index: olena/oln/convert/conversion.hh
--- olena/oln/convert/conversion.hh (révision 231)
+++ olena/oln/convert/conversion.hh (copie de travail)
@@ -34,6 +34,9 @@
# include <oln/funobj/abstract/binary.hh>
# include <oln/convert/abstract/conversion.hh>
+# include <oln/funobj/compose.hh>
+# include <oln/core/apply.hh>
+
namespace oln {
/*!
** \brief Conversion implementation (for example cast, color, or
@@ -163,6 +166,24 @@
return internal::compconv2_<C, BF>(conv.exact(), func);
}
+
+ // FIXME: Should't abstract::conversion be an Olena (or Metalic)
+ // functor, and use the standard apply() instead?
+
+ /// Apply procedure of an abstract conversion on an image.
+ template<class C, class B, class I>
+ typename ch_value_type<I, typename convoutput<C, B, oln_type_of(I, value)>::ret>::ret
+ apply(const abstract::conversion<C, B>& conv,
+ const oln::abstract::image<I>& input)
+ {
+ /* CONV can now be wrapped as an Adaptable Unary Function
+ because we know the input type. Composing CONV with the
+ identity for the input type will cause such wrapping to
+ happen. */
+ return apply(compconv1(conv, f_::identity_<oln_type_of(I, value)>()),
+ input);
+ }
+
} // end of namespace oln::convert
// Export conversion and convouput into oln:: to simplify the
Index: olena/oln/core/pw/image.hh
--- olena/oln/core/pw/image.hh (révision 231)
+++ olena/oln/core/pw/image.hh (copie de travail)
@@ -74,7 +74,7 @@
template <typename U>
struct ch_value_type
{
- typedef concrete_type<U> ret;
+ typedef image2d<U> ret;
};
};
1
0
Index: olena/ChangeLog
===================================================================
--- olena/ChangeLog (révision 230)
+++ olena/ChangeLog (copie de travail)
@@ -69,7 +69,7 @@
Add 'rawness' characteristic (ability to reference data at p)
to images. Add corresponding attribute access object mechanism.
-
+
* oln/funobj/decl_attr.hh: New file.
* oln/funobj/abstract/accessor.hh: New file.
* oln/core/abstract/image_rawness.hh: New file.
@@ -129,8 +129,8 @@
2005-06-23 Christophe Berger <christophe(a)lrde.epita.fr>
- * oln/appli/astro/graphical_interface/filterinterface.hh: Set the default
- values at the beginning.
+ * oln/appli/astro/graphical_interface/filterinterface.hh: Set the
+ default values at the beginning.
2005-06-23 Nicolas Widynski <nicolas.widynski(a)lrde.epita.fr>
@@ -1441,19 +1441,25 @@
2005-04-06 Nicolas Widynski <nicolas.widynski(a)lrde.epita.fr>
- * oln/core/abstract/niter.hh: New. Abstract neighborhood iterator class.
- * oln/core/abstract/regular_niter.hh: New. Abstract neighborhood iterator for windows.
- * oln/core/2d/fwd_regular_niter2d.hh: New. Concrete 2d neighborhood class
+ * oln/core/abstract/niter.hh: New. Abstract neighborhood iterator
+ class.
+ * oln/core/abstract/regular_niter.hh: New. Abstract neighborhood
+ iterator for windows.
+ * oln/core/2d/fwd_regular_niter2d.hh: New. Concrete 2d
+ neighborhood class
2005-04-06 Nicolas Widynski <nicolas.widynski(a)lrde.epita.fr>
- * oln/core/properties.hh: Change properties for neighborhood hierarchy.
+ * oln/core/properties.hh: Change properties for neighborhood
+ hierarchy.
* oln/core/abstract/image.hh: Add neigbh_type property.
* oln/core/abstract/image_neighbness.hh: New. Add neighborhood
hierarchy.
* oln/core/abstract/entry.hh: Add image_neighbness into hierarchy.
- * oln/core/abstract/image_with_extension.hh: New. Add image with extension hierarchy.
- * oln/core/gen/image_with_nbh.hh: New. Concrete image and neighborhood class.
+ * oln/core/abstract/image_with_extension.hh: New. Add image with
+ extension hierarchy.
+ * oln/core/gen/image_with_nbh.hh: New. Concrete image and
+ neighborhood class.
2005-04-06 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
1
0
Index: ChangeLog
from Christophe Berger <christophe(a)lrde.epita.fr>
* oln/appli/astro/tree_coherance_checks.hh: Update doc.
* oln/appli/astro/tree_statistics.hh: Add count of local root.
* oln/appli/astro/graphical_interface/interface.pro: Qmake options to compile without -w -Wall.
* oln/appli/astro/graphical_interface/visualization_window.ui: Add options in interface.
* oln/appli/astro/graphical_interface/filterinterface.hh: Handle these options.
graphical_interface/filterinterface.hh | 45 ++-
graphical_interface/interface.pro | 6
graphical_interface/visualization_window.ui | 347 ++++++++++++++++++++++------
tree_coherance_checks.hh | 22 -
tree_statistics.hh | 60 ++++
5 files changed, 375 insertions(+), 105 deletions(-)
Index: oln/appli/astro/graphical_interface/visualization_window.ui
--- oln/appli/astro/graphical_interface/visualization_window.ui (revision 214)
+++ oln/appli/astro/graphical_interface/visualization_window.ui (working copy)
@@ -118,133 +118,148 @@
<string></string>
</property>
</widget>
- <widget class="QSpinBox">
+ <widget class="QLabel">
<property name="name">
- <cstring>value_height</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
+ <cstring>area_min</cstring>
</property>
<property name="geometry">
<rect>
- <x>330</x>
- <y>180</y>
- <width>59</width>
- <height>29</height>
+ <x>310</x>
+ <y>130</y>
+ <width>30</width>
+ <height>31</height>
</rect>
</property>
- <property name="maxValue">
- <number>999999</number>
+ <property name="text">
+ <string>min</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_tower</cstring>
+ <cstring>active_level</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>330</y>
- <width>180</width>
+ <y>80</y>
+ <width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Rectangular "towers"</string>
+ <string>Level</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_center_point</cstring>
+ <cstring>active_area</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>280</y>
- <width>120</width>
+ <y>130</y>
+ <width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Center point</string>
+ <string>Area</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_circle</cstring>
+ <cstring>active_height</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>230</y>
+ <y>180</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Circle</string>
+ <string>Height</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_height</cstring>
+ <cstring>active_circle</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>180</y>
+ <y>230</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Height</string>
+ <string>Circle</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_area</cstring>
+ <cstring>active_center_point</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>130</y>
- <width>80</width>
+ <y>280</y>
+ <width>120</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Area</string>
+ <string>Center point</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
- <cstring>active_level</cstring>
+ <cstring>active_tower</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
- <y>80</y>
- <width>80</width>
+ <y>330</y>
+ <width>180</width>
<height>26</height>
</rect>
</property>
<property name="text">
- <string>Level</string>
+ <string>Rectangular "towers"</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
- <cstring>value_area</cstring>
+ <cstring>value_area_min</cstring>
</property>
<property name="enabled">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="geometry">
<rect>
- <x>330</x>
+ <x>350</x>
<y>130</y>
- <width>60</width>
+ <width>80</width>
<height>31</height>
</rect>
</property>
@@ -257,16 +272,57 @@
</widget>
<widget class="QSpinBox">
<property name="name">
+ <cstring>value_area_max</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>490</x>
+ <y>130</y>
+ <width>80</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>999999</number>
+ </property>
+ <property name="lineStep">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>999999</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>area_min_2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>450</x>
+ <y>130</y>
+ <width>30</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>max</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
<cstring>value_level</cstring>
</property>
<property name="enabled">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="geometry">
<rect>
- <x>330</x>
+ <x>350</x>
<y>80</y>
- <width>60</width>
+ <width>80</width>
<height>29</height>
</rect>
</property>
@@ -274,11 +330,174 @@
<number>255</number>
</property>
</widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_height</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>180</y>
+ <width>80</width>
+ <height>29</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>999999</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>440</x>
+ <y>230</y>
+ <width>20</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>%</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>440</x>
+ <y>280</y>
+ <width>20</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>%</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_center_point</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>280</y>
+ <width>80</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>500</x>
+ <y>330</y>
+ <width>20</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>%</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_tower</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>420</x>
+ <y>330</y>
+ <width>70</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>value_circle</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>230</y>
+ <width>80</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ </widget>
</widget>
<toolbars>
</toolbars>
<connections>
<connection>
+ <sender>value_tower</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>visualisation_window</receiver>
+ <slot>UpdateValues()</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>
+ <connection>
<sender>compute_button</sender>
<signal>clicked()</signal>
<receiver>visualisation_window</receiver>
@@ -297,64 +516,46 @@
<slot>SaveResult()</slot>
</connection>
<connection>
- <sender>value_area</sender>
+ <sender>value_area_max</sender>
<signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
<slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>value_height</sender>
+ <sender>value_area_min</sender>
<signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
<slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>value_level</sender>
+ <sender>value_center_point</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>
+ <sender>value_height</sender>
+ <signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
- <slot>Attribute_circle()</slot>
+ <slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>active_height</sender>
- <signal>stateChanged(int)</signal>
+ <sender>value_level</sender>
+ <signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
- <slot>Attribute_height()</slot>
+ <slot>UpdateValues()</slot>
</connection>
<connection>
- <sender>active_level</sender>
- <signal>stateChanged(int)</signal>
+ <sender>view_input_image_button</sender>
+ <signal>clicked()</signal>
<receiver>visualisation_window</receiver>
- <slot>Attribute_level()</slot>
+ <slot>DisplayInputImage()</slot>
</connection>
<connection>
- <sender>active_tower</sender>
- <signal>stateChanged(int)</signal>
+ <sender>value_circle</sender>
+ <signal>valueChanged(int)</signal>
<receiver>visualisation_window</receiver>
- <slot>Attribute_tower()</slot>
+ <slot>UpdateValues()</slot>
</connection>
</connections>
<slots>
Index: oln/appli/astro/tree_statistics.hh
--- oln/appli/astro/tree_statistics.hh (revision 214)
+++ oln/appli/astro/tree_statistics.hh (working copy)
@@ -112,10 +112,50 @@
template<typename I>
int node_count(oln::appli::astro::clean<I>& tree)
{
- return tree.input.width() * tree.input.height()
+ return tree.input.size().nrows() * tree.input.size().ncols()
- leaf_count(tree);
}
+
+ /**
+ ** Counts the number of local root points in the tree.
+ **
+ ** \param I Type of maxtree's image.
+ **
+ ** \arg tree Maxtree structure to check.
+ **
+ ** \warning Maxtree should have already been computed.
+ **
+ ** \code
+ ** Algorithm used :
+ **
+ ** count <- 0
+ ** for all points of input
+ ** if p is global root or if p has a different value than his parent's value in input image
+ ** then increment count (p is a local root)
+ ** at the end, return the count
+ **
+ ** \endcode
+ **
+ ** \return Number of local roots.
+ **
+ */
+ template<typename I>
+ int local_root_count(oln::appli::astro::clean<I>& tree)
+ {
+ typedef oln_type_of(I, point) point_type;
+ oln_type_of(I, fwd_piter) p(tree.input.size());
+ int count = 0;
+ for_all_p(p)
+ {
+ if (tree.parent[p] == p ||
+ tree.input[p] != tree.input[tree.parent[p]])
+ ++count;
+ }
+ return count;
+ }
+
+
/**
** Makes the children per node average.
**
Index: oln/appli/astro/graphical_interface/interface.pro
--- oln/appli/astro/graphical_interface/interface.pro (revision 214)
+++ oln/appli/astro/graphical_interface/interface.pro (working copy)
@@ -1,11 +1,13 @@
TEMPLATE = app
LANGUAGE = C++
-INCLUDEPATH += .
+CONFIG += warn_off release qt
+
+INCLUDEPATH += . ../../../../../olena ../../../../../metalic ../../../../../integre
SOURCES += main.cc
-HEADERS += filterinterface.hh image_viewer.hh qtincludes.hh utils.hh
+HEADERS += filterinterface.hh image_viewer.hh qtincludes.hh utils.hh ../../../canvas/tree.hh ../../../canvas/maxtree.hh
FORMS = visualization_window.ui
Index: oln/appli/astro/tree_coherance_checks.hh
Index: oln/appli/astro/graphical_interface/filterinterface.hh
--- oln/appli/astro/graphical_interface/filterinterface.hh (revision 214)
+++ oln/appli/astro/graphical_interface/filterinterface.hh (working copy)
@@ -57,9 +57,14 @@
virtual void UpdateValues()
{
- mt_.set_area(value_area->value());
+ mt_.set_area_min(value_area_min->value());
+ mt_.set_area_max(value_area_max->value());
mt_.set_level(value_level->value());
mt_.set_height(value_height->value());
+ mt_.set_circle(value_circle->value() / 100);
+ mt_.set_center_point(value_center_point->value() / 100);
+ mt_.set_tower(value_tower->value() / 100);
+
std::string out = "attributes value changed.";// area("
// + Utils::int2string(value_area->value())
// + "), point_value("
@@ -78,6 +83,8 @@
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.");
+
+ UpdateValues();
}
virtual void DisplayImage()
@@ -108,12 +115,14 @@
{
if (this->active_area->isChecked())
{
- this->value_area->setEnabled(true);
+ this->value_area_min->setEnabled(true);
+ this->value_area_max->setEnabled(true);
mt_.area_tag_ = true;
}
else
{
- this->value_area->setEnabled(false);
+ this->value_area_min->setEnabled(false);
+ this->value_area_max->setEnabled(false);
mt_.area_tag_ = false;
}
}
@@ -149,25 +158,43 @@
virtual void Attribute_circle()
{
if (this->active_circle->isChecked())
+ {
+ this->value_circle->setEnabled(true);
mt_.circle_tag_ = true;
+ }
else
+ {
mt_.circle_tag_ = false;
+ this->value_circle->setEnabled(false);
+ }
}
virtual void Attribute_center_point()
{
if (this->active_center_point->isChecked())
+ {
+ this->value_center_point->setEnabled(true);
mt_.center_p_tag_ = true;
+ }
else
+ {
mt_.center_p_tag_ = false;
+ this->value_center_point->setEnabled(false);
+ }
}
virtual void Attribute_tower()
{
if (this->active_tower->isChecked())
+ {
+ this->value_tower->setEnabled(true);
mt_.tour_tag_ = true;
+ }
else
+ {
mt_.tour_tag_ = false;
+ this->value_tower->setEnabled(false);
+ }
}
protected:
2
1
ChangeLog | 7 ++
oln/convert/stretch.hh | 130 +++++++++++++++++++++++++++++++++++++++++++++++++
oln/makefile.src | 1
3 files changed, 138 insertions(+)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add stretch conversions.
* oln/convert/stretch.hh: New file.
* oln/makefile.src (OLN_DEP): Add convert/stretch.hh.
2005-07-04 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/oln/convert/stretch.hh
--- olena/oln/convert/stretch.hh (révision 0)
+++ olena/oln/convert/stretch.hh (révision 0)
@@ -0,0 +1,130 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 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 OLENA_CONVERT_STRETCH_HH
+# define OLENA_CONVERT_STRETCH_HH
+
+# include <oln/core/ch_value_type.hh>
+
+# include <oln/basics.hh>
+# include <ntg/basics.hh>
+
+# include <oln/convert/abstract/conversion.hh>
+
+# include <set>
+# include <vector>
+
+namespace oln {
+
+ namespace convert {
+
+ // FIXME: Documentation (see in Olena 0.10).
+
+ /// Functor to stretch a value from a range Input to a range Output.
+ template<class Output>
+ struct stretch
+ : public abstract::conversion_to_type<Output, stretch<Output> >
+ {
+ template <class Input>
+ Output
+ doit(const Input& v) const
+ {
+ return Output(ntg::cast::rbound<Output, float>(
+ double(v - ntg_min_val(Input)) /
+ double(ntg_max_val(Input) - ntg_min_val(Input)) *
+ (ntg_max_val(Output) - ntg_min_val(Output)) +
+ ntg_min_val(Output)));
+ }
+
+ static std::string
+ name()
+ {
+ // FIXME: Exact is not an integre type !
+ // return std::string("stretch<") + ntg_name(Output) + ", " +
+ // Exact::name() + ">";
+ return std::string("stretch<") + ntg_name(Output) + ">";
+ }
+ };
+
+
+ // FIXME: Documentation (see in Olena 0.10).
+
+ /// Stretch the value of an image.
+ template<class DestValue, class I>
+ typename ch_value_type<I, DestValue>::ret
+ stretch_balance(const oln::abstract::scalar_valued_image<I>& in,
+ const oln_type_of(I, value)& min_in =
+ ntg_min_val(oln_type_of(I, value)),
+ const oln_type_of(I, value)& max_in =
+ ntg_max_val(oln_type_of(I, value)),
+ const DestValue& min_out = ntg_min_val(DestValue),
+ const DestValue& max_out = ntg_max_val(DestValue))
+ {
+ ntg_is_a(DestValue, ntg::non_vectorial)::ensure();
+
+ typename ch_value_type<I, DestValue>::ret out(in.size());
+
+ //FIXME: I would like to remove the static_cast.
+ std::vector<ntg_cumul_type(DestValue)>
+ tab(static_cast<int>(max_in - min_in + 1));
+ typedef typename std::set<oln_type_of(I, value)> set_type;
+ set_type s;
+ oln_type_of(I, piter) it(in.size());
+
+ for_all_p (it)
+ if (in[it] <= max_in && in[it] >= min_in)
+ s.insert(in[it]);
+ if (s.size() == 1)
+ {
+ for_all_p (it)
+ out[it] = ntg_zero_val(DestValue);
+ return out;
+ }
+ {
+ unsigned cpt = 0;
+ for (typename set_type::const_iterator it(s.begin());
+ it != s.end(); ++it, ++cpt)
+ tab[*it - min_in] = cpt * (max_out - min_out) / (s.size() - 1);
+ }
+ for_all_p (it)
+ if (min_in <= in[it])
+ {
+ if (in[it] <= max_in)
+ out[it] = tab[in[it].value() - min_in] + min_out;
+ else
+ out[it] = max_out;
+ }
+ else
+ out[it] = min_out;
+ return out;
+ }
+
+ } // end of namespace oln::convert.
+
+} // end of namespace oln.
+
+#endif // OLENA_CONVERT_STRETCH_HH
Index: olena/oln/makefile.src
--- olena/oln/makefile.src (révision 226)
+++ olena/oln/makefile.src (copie de travail)
@@ -27,6 +27,7 @@
convert/abstract/conversion.hh \
convert/conversion.hh \
convert/force.hh \
+ convert/stretch.hh \
convert/value_to_point.hh \
\
core/1d/array1d.hh \
1
0
proto-1.0 229: Allow the user to run the shortest path watershed transform without the lower completion step
by Roland Levillain 04 Jul '05
by Roland Levillain 04 Jul '05
04 Jul '05
ChangeLog | 10 ++++
oln/morpho/shortest_path_watershed.hh | 81 +++++++++++++++++++++++-----------
2 files changed, 66 insertions(+), 25 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Allow the user to run the shortest path watershed transform
without the lower completion step (at her own risks!).
* oln/morpho/shortest_path_watershed.hh
(morpho::shortest_path_watershed): Rename as...
(morpho::internal::shortest_path_watershed_): ...this.
(morpho::shortest_path_watershed): New facade.
2005-07-04 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/oln/morpho/shortest_path_watershed.hh
--- olena/oln/morpho/shortest_path_watershed.hh (révision 226)
+++ olena/oln/morpho/shortest_path_watershed.hh (copie de travail)
@@ -101,42 +101,38 @@
return (ls_p + ls_q) / 2;
}
- } // End of namespace internal.
-
+ /// Shortest path watershed transform implementation.
template <typename DestValue, typename I>
typename ch_value_type<I, DestValue>::ret
- shortest_path_watershed(const abstract::image_with_nbh<I>& input)
+ shortest_path_watershed_(const abstract::image_with_nbh<I>& input)
{
mlc_is_a(I, abstract::scalar_valued_image)::ensure();
const DestValue wshed = ntg_min_val(DestValue);
- // Get a lower complete image of the input.
- typename ch_value_type<I, unsigned>::ret lc =
- lower_completion<unsigned>(input);
-
// We keep a track of already processed points.
- typename ch_value_type<I, bool>::ret processed (lc.size(),
- lc.nbh_get());
+ typename ch_value_type<I, bool>::ret processed (input.size(),
+ input.nbh_get());
level::fill (processed, false);
// Initialise output with the minima components.
typename ch_value_type<I, DestValue>::ret output =
- level::minima_components<DestValue>(lc);
+ level::minima_components<DestValue>(input);
// Distance.
- typedef typename ch_value_type<I, unsigned>::ret dist_type;
- dist_type dist (lc.size(), lc.nbh_get());
+ typedef ntg_cumul_type(DestValue) cumul_type;
+ typedef typename ch_value_type<I, cumul_type>::ret dist_type;
+ dist_type dist (input.size(), input.nbh_get());
level::fill(dist, ntg_max_val(DestValue));
// Initialize distance with values of minima, and mark these
- // points as processed (remember that points of LC who have a
- // value greater than ntg_min_val(DestValue) belongs to a
+ // points as processed (remember that points of INPUT who have
+ // a value greater than ntg_min_val(DestValue) belongs to a
// minimum).
- oln_type_of(I, piter) p(lc.size());
+ oln_type_of(I, piter) p(input.size());
for_all_p (p)
- if (output[p].value() > ntg_min_val(DestValue))
- dist[p] = lc[p];
+ if (output[p] > ntg_min_val(DestValue))
+ dist[p] = input[p];
// Ordered queue.
typedef oln_type_of(I, point) point_type;
@@ -149,12 +145,13 @@
// Fill the ordered queue with the points of the border of the
// minima of the (lower complete) input.
for_all_p (p)
- if (output[p].value() > ntg_min_val(DestValue))
+ if (output[p] > ntg_min_val(DestValue))
{
bool border_p = false;
- oln_type_of(I, niter) n(lc);
+ oln_type_of(I, niter) n(input);
for_all_n_of_p (n, p)
- if (lc.hold(n) and output[n].value() == ntg_min_val(DestValue))
+ if (input.hold(n) and
+ output[n] == ntg_min_val(DestValue))
{
// P is both in a minima and adjacent to a non minima:
// it's on the border of a minima.
@@ -176,19 +173,19 @@
continue;
processed[p] = true;
- oln_type_of(I, niter) n(lc);
+ oln_type_of(I, niter) n(input);
for_all_n_of_p (n, p)
{
- if (lc.hold(n))
- if (dist[p] + internal::cost(lc, p, n) < dist[n])
+ if (input.hold(n))
+ if (dist[p] + internal::cost(input, p, n) < dist[n])
{
- dist[n] = dist[p] + internal::cost(lc, p, n);
+ dist[n] = dist[p] + internal::cost(input, p, n);
output[n] = output[p];
q.push(n);
}
else if (output[n] != wshed and
- dist[p] + internal::cost(lc, p, n) == dist[n] and
+ dist[p] + internal::cost(input, p, n) == dist[n] and
output[n] != output[p])
{
output[n] = wshed;
@@ -200,6 +197,40 @@
return output;
}
+ } // End of namespace oln::morpho::internal.
+
+
+ /*! Watershed transform w.r.t. topographical distance based on
+ image integration via the Dijkstra-Moore shortest path
+ algorithm.
+
+ This facade lets the user should whether the lower completion
+ pass shoud be done before actually computing the watershed
+ transform. Unless you really what you're doing, you probably
+ want to proceed to this lower completion.
+
+ \param input input image
+ \param lower_completion_p whether \a input should be turned into a
+ lower complete image */
+ template <typename DestValue, typename I>
+ typename ch_value_type<I, DestValue>::ret
+ shortest_path_watershed(const abstract::image_with_nbh<I>& input,
+ bool lower_completion_p = true)
+ {
+ mlc_is_a(I, abstract::scalar_valued_image)::ensure();
+
+ if (lower_completion_p)
+ {
+ // Get a lower complete image of the input.
+ typedef ntg_cumul_type(DestValue) cumul_type;
+ typename ch_value_type<I, cumul_type>::ret lc =
+ lower_completion<cumul_type>(input);
+ return internal::shortest_path_watershed_<DestValue>(lc);
+ }
+ else
+ return internal::shortest_path_watershed_<DestValue>(input);
+ }
+
} // end of namespace oln::morpho
} // end of namespace oln
1
0
C'est pas encore gagné avec les collisions d'opérateurs entre Integre
et Olena (voir le commentaire dans
olena/oln/morpho/lower_completion.hh), mais ça marche mieux. Peut-être
qu'il faudrait tous les placer dans un seul namespace ?
ChangeLog | 28 ++
oln/core/gen/internal/value_box.hh | 377 ++++++++++++++++++++++++++++---------
oln/core/pw/arith.hh | 5
oln/morpho/lower_completion.hh | 19 +
4 files changed, 333 insertions(+), 96 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix operators on oln::value_box<>.
* oln/core/gen/internal/value_box.hh (value_box<I>::operator==)
(value_box<I>::operator!=, value_box<I>::operator<)
(value_box<I>::operator>, value_box<const I>::operator==)
(value_box<const I>::operator!=, value_box<const I>::operator<):
Remove operators.
(oln_decl_comp_binop_all, oln_decl_comp_binop_with_builtin)
(oln_decl_comp_binop_builtin_vb, oln_decl_comp_binop_vb_builtin)
(oln_decl_comp_binop_with_ntgval, oln_decl_comp_binop_ntgval_vb)
(oln_decl_comp_binop_vb_ntgval, oln_decl_comp_binop_vb_vb)
(oln_decl_arith_binop_all)
(oln_decl_arith_binop_all_but_builtin_float)
(oln_decl_arith_binop_with_builtin_float)
(oln_decl_arith_binop_with_builtin_int)
(oln_decl_arith_binop_with_builtin)
(oln_decl_arith_binop_builtin_vb, oln_decl_arith_binop_vb_builtin)
(oln_decl_arith_binop_with_ntgval, oln_decl_arith_binop_ntgval_vb)
(oln_decl_arith_binop_vb_ntgval, oln_decl_arith_binop_vb_vb):
New macros. Use them to implement operators whose (at least) one
operand is an oln::value_box.
* oln/morpho/lower_completion.hh (lower_completion): Adjust.
* oln/core/pw/arith.hh: Move all operators on point-wise
functions to...
(oln): ...this namespace.
2005-07-04 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/oln/core/gen/internal/value_box.hh
--- olena/oln/core/gen/internal/value_box.hh (révision 226)
+++ olena/oln/core/gen/internal/value_box.hh (copie de travail)
@@ -31,6 +31,8 @@
# include <iostream>
# include <mlc/cmp.hh>
# include <oln/core/abstract/image.hh>
+# include <ntg/core/value.hh>
+# include <ntg/core/internal/global_ops_traits.hh>
// FIXME: not coherent cause in internal/ but not internal::
@@ -80,55 +82,6 @@
typedef oln_type_of(I, point) point_type;
- /// Operator == (rhs is a value_box).
- template <typename II>
- bool operator==(const value_box<II>& rhs) const
- {
- return this->value() == rhs.value();
- }
-
- /// Operator == (rhs is a value).
- template <typename V>
- bool operator==(const V& rhs) const
- {
- return this->value() == rhs;
- }
-
- /// Operator !=.
- template <typename V>
- bool operator!=(const V& rhs) const
- {
- return ! this->operator==(rhs);
- }
-
- /// Operator < (rhs is a value_box).
- template <typename II>
- bool operator<(const value_box<II>& rhs) const
- {
- return this->value() < rhs.value();
- }
-
- /// Operator < (rhs is a value).
- template <typename V>
- bool operator<(const V& rhs) const
- {
- return this->value() < rhs;
- }
-
- /// Operator > (rhs is a value_box).
- template <typename II>
- bool operator>(const value_box<II>& rhs) const
- {
- return this->value() > rhs.value();
- }
-
- /// Operator > (rhs is a value).
- template <typename V>
- bool operator>(const V& rhs) const
- {
- return this->value() > rhs;
- }
-
/*! \brief op=
** FIXME:...
@@ -142,7 +95,6 @@
return *this;
}
-
/*! \brief op=
** FIXME:...
**
@@ -150,7 +102,7 @@
**
** \return (*this)
*/
-
+ /// \{
template <typename II>
value_box& operator=(const value_box<II>& rhs)
{
@@ -163,6 +115,7 @@
ima_->set(p_, rhs.value()); // automatic conversion from rhs to value_type
return *this;
}
+ /// \}
/*! \brief Set
@@ -264,9 +217,6 @@
};
-
-
-
/*! \class value_box<const I>
**
** Specialization of 'value_box<I>'.
@@ -288,42 +238,6 @@
typedef oln_type_of(I, point) point_type;
- /// Operator == (rhs is a value_box).
- template <typename II>
- bool operator==(const value_box<II>& rhs) const
- {
- return this->value() == rhs.value();
- }
-
- /// Operator == (rhs is a value).
- template <typename V>
- bool operator==(const V& rhs) const
- {
- return this->value() == rhs;
- }
-
- /// Operator !=.
- template <typename V>
- bool operator!=(const V& rhs) const
- {
- return ! this->operator==(rhs);
- }
-
- /// Operator < (rhs is a value_box).
- template <typename II>
- bool operator<(const value_box<II>& rhs) const
- {
- return this->value() < rhs.value();
- }
-
- /// Operator < (rhs is a value).
- template <typename V>
- bool operator<(const V& rhs) const
- {
- return this->value() < rhs;
- }
-
-
/*! \brief Assignment (op=) is declared but undefined.
*/
@@ -431,6 +345,289 @@
} // end of namespace oln
+
+/*-----------------------.
+| Comparison operators. |
+`-----------------------*/
+
+// FIXME: Should we equip Integre to support oln::value_box<> values instead?
+
+// ------------------------- //
+// value_box and value_box. //
+// ------------------------- //
+
+// oln::value_box<I> OpSymbol oln::value_box<II>
+# define oln_decl_comp_binop_vb_vb(OpSymbol) \
+ template <typename I, typename II> \
+ bool \
+ operator OpSymbol (const oln::value_box<I>& lhs, \
+ const oln::value_box<II>& rhs) \
+ { \
+ return lhs.value() OpSymbol rhs.value(); \
+ }
+
+
+// ------------------------------ //
+// value_box and Integre values. //
+// ------------------------------ //
+
+// oln::value_box<I> OpSymbol ntg::value<V>
+# define oln_decl_comp_binop_vb_ntgval(OpSymbol) \
+ template <typename I, typename V> \
+ bool \
+ operator OpSymbol (const oln::value_box<I>& lhs, \
+ const ntg::value<V>& rhs) \
+ { \
+ return lhs.value() OpSymbol rhs.exact (); \
+ }
+
+// ntg::value<V> OpSymbol oln::value_box<I>
+# define oln_decl_comp_binop_ntgval_vb(OpSymbol) \
+ template <typename I, typename V> \
+ bool \
+ operator OpSymbol (const ntg::value<V>& lhs, \
+ const oln::value_box<I>& rhs) \
+ { \
+ return lhs.exact() OpSymbol rhs.value(); \
+ }
+
+# define oln_decl_comp_binop_with_ntgval(OpSymbol) \
+ oln_decl_comp_binop_vb_ntgval(OpSymbol) \
+ oln_decl_comp_binop_ntgval_vb(OpSymbol)
+
+
+// -------------------------------------------- //
+// value_box and C++ builtin arithmetic types. //
+// -------------------------------------------- //
+
+// oln::value_box<I> OpSymbol Builtin
+# define oln_decl_comp_binop_vb_builtin(OpSymbol, Builtin) \
+ template <typename I> \
+ bool \
+ operator OpSymbol (const oln::value_box<I>& lhs, \
+ Builtin rhs) \
+ { \
+ return lhs.value() OpSymbol rhs; \
+ }
+
+// Builtin OpSymbol oln::value_box<I>
+# define oln_decl_comp_binop_builtin_vb(OpSymbol, Builtin) \
+ template <typename I> \
+ bool \
+ operator OpSymbol (Builtin lhs, \
+ const oln::value_box<I>& rhs) \
+ { \
+ return lhs OpSymbol rhs.value(); \
+ }
+
+# define oln_decl_comp_binop_with_builtin(OpSymbol, Builtin) \
+ oln_decl_comp_binop_vb_builtin(OpSymbol, Builtin) \
+ oln_decl_comp_binop_builtin_vb(OpSymbol, Builtin)
+
+
+// ----------- //
+// Shortcuts. //
+// ----------- //
+
+# define oln_decl_comp_binop_all(OpSymbol) \
+ \
+ oln_decl_comp_binop_vb_vb(OpSymbol) \
+ \
+ oln_decl_comp_binop_with_ntgval(OpSymbol) \
+ \
+ oln_decl_comp_binop_with_builtin(OpSymbol, signed long) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, unsigned long) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, signed int) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, unsigned int) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, signed short) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, unsigned short) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, char) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, signed char) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, unsigned char) \
+ \
+ oln_decl_comp_binop_with_builtin(OpSymbol, bool) \
+ \
+ oln_decl_comp_binop_with_builtin(OpSymbol, float) \
+ oln_decl_comp_binop_with_builtin(OpSymbol, double)
+
+
+// ------------------------------------ //
+// ``Instantiation'' of the operators. //
+// ------------------------------------ //
+
+namespace oln
+{
+
+// ``Instantiation'' of the operators.
+oln_decl_comp_binop_all(==)
+oln_decl_comp_binop_all(!=)
+oln_decl_comp_binop_all(<)
+oln_decl_comp_binop_all(<=)
+oln_decl_comp_binop_all(>)
+oln_decl_comp_binop_all(>=)
+
+} // end of namespace oln
+
+
+# undef oln_decl_comp_binop_vb_vb
+# undef oln_decl_comp_binop_vb_ntgval
+# undef oln_decl_comp_binop_ntgval_vb
+# undef oln_decl_comp_binop_with_ntgval
+# undef oln_decl_comp_binop_vb_builtin
+# undef oln_decl_comp_binop_builtin_vb
+# undef oln_decl_comp_binop_with_builtin
+# undef oln_decl_comp_binop
+
+
+
+/*-------------------------.
+| Arithmetical operators. |
+`-------------------------*/
+
+// FIXME: Should we equip Integre to support oln::value_box<> values instead?
+
+// ------------------------- //
+// value_box and value_box. //
+// ------------------------- //
+
+// oln::value_box<I> OpSymbol oln::value_box<II>
+# define oln_decl_arith_binop_vb_vb(OpSymbol, OpName) \
+ template <typename I, typename II> \
+ ntg_return_type(OpName, \
+ typename oln::value_box<I>::value_type, \
+ typename oln::value_box<II>::value_type) \
+ operator OpSymbol (const oln::value_box<I>& lhs, \
+ const oln::value_box<II>& rhs) \
+ { \
+ return lhs.value() OpSymbol rhs.value(); \
+ }
+
+
+// ------------------------------ //
+// value_box and Integre values. //
+// ------------------------------ //
+
+// oln::value_box<I> OpSymbol ntg::value<V>
+# define oln_decl_arith_binop_vb_ntgval(OpSymbol, OpName) \
+ template <typename I, typename V> \
+ ntg_return_type(OpName, \
+ typename oln::value_box<I>::value_type, \
+ V) \
+ operator OpSymbol (const oln::value_box<I>& lhs, \
+ const ntg::value<V>& rhs) \
+ { \
+ return lhs.value() OpSymbol rhs.exact (); \
+ }
+
+// ntg::value<V> OpSymbol oln::value_box<I>
+# define oln_decl_arith_binop_ntgval_vb(OpSymbol, OpName) \
+ template <typename I, typename V> \
+ ntg_return_type(OpName, \
+ V, \
+ typename oln::value_box<I>::value_type) \
+ operator OpSymbol (const ntg::value<V>& lhs, \
+ const oln::value_box<I>& rhs) \
+ { \
+ return lhs.exact() OpSymbol rhs.value(); \
+ }
+
+# define oln_decl_arith_binop_with_ntgval(OpSymbol, OpName) \
+ oln_decl_arith_binop_vb_ntgval(OpSymbol, OpName) \
+ oln_decl_arith_binop_ntgval_vb(OpSymbol, OpName)
+
+
+// -------------------------------------------- //
+// value_box and C++ builtin arithmetic types. //
+// -------------------------------------------- //
+
+// oln::value_box<I> OpSymbol Builtin
+# define oln_decl_arith_binop_vb_builtin(OpSymbol, OpName, Builtin) \
+ template <typename I> \
+ ntg_return_type(OpName, \
+ typename oln::value_box<I>::value_type, \
+ Builtin) \
+ operator OpSymbol (const oln::value_box<I>& lhs, \
+ Builtin rhs) \
+ { \
+ return lhs.value() OpSymbol rhs; \
+ }
+
+// Builtin OpSymbol oln::value_box<I>
+# define oln_decl_arith_binop_builtin_vb(OpSymbol, OpName, Builtin) \
+ template <typename I> \
+ ntg_return_type(OpName, \
+ Builtin, \
+ typename oln::value_box<I>::value_type) \
+ operator OpSymbol (Builtin lhs, \
+ const oln::value_box<I>& rhs) \
+ { \
+ return lhs OpSymbol rhs.value(); \
+ }
+
+# define oln_decl_arith_binop_with_builtin(OpSymbol, OpName, Builtin) \
+ oln_decl_arith_binop_vb_builtin(OpSymbol, OpName, Builtin) \
+ oln_decl_arith_binop_builtin_vb(OpSymbol, OpName, Builtin)
+
+# define oln_decl_arith_binop_with_builtin_int(OpSymbol, OpName) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, signed long) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, unsigned long) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, signed int) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, unsigned int) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, signed short) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, unsigned short) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, char) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, signed char) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, unsigned char)
+
+# define oln_decl_arith_binop_with_builtin_float(OpSymbol, OpName) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, float) \
+ oln_decl_arith_binop_with_builtin(OpSymbol, OpName, double)
+
+
+// ----------- //
+// Shortcuts. //
+// ----------- //
+
+# define oln_decl_arith_binop_all_but_builtin_float(OpSymbol, OpName) \
+ oln_decl_arith_binop_vb_vb(OpSymbol, OpName) \
+ oln_decl_arith_binop_with_ntgval(OpSymbol, OpName) \
+ oln_decl_arith_binop_with_builtin_int(OpSymbol, OpName)
+
+# define oln_decl_arith_binop_all(OpSymbol, OpName) \
+ oln_decl_arith_binop_all_but_builtin_float(OpSymbol, OpName) \
+ oln_decl_arith_binop_with_builtin_float(OpSymbol, OpName)
+
+
+// ------------------------------------ //
+// ``Instantiation'' of the operators. //
+// ------------------------------------ //
+
+namespace oln
+{
+
+oln_decl_arith_binop_all(+, plus)
+oln_decl_arith_binop_all(-, minus)
+oln_decl_arith_binop_all(*, times)
+oln_decl_arith_binop_all(/, div)
+oln_decl_arith_binop_all_but_builtin_float(%, mod)
+
+} // end of namespace oln
+
+
+# undef oln_decl_arith_binop_vb_vb
+# undef oln_decl_arith_binop_vb_ntgval
+# undef oln_decl_arith_binop_ntgval_vb
+# undef oln_decl_arith_binop_with_ntgval
+# undef oln_decl_arith_binop_vb_builtin
+# undef oln_decl_arith_binop_builtin_vb
+# undef oln_decl_arith_binop_with_builtin
+# undef oln_decl_arith_binop_with_builtin_int
+# undef oln_decl_arith_binop_with_builtin_float
+# undef oln_decl_arith_binop_all_but_builtin_float
+# undef oln_decl_arith_binop_all
+
+
+
/// Operator <<.
template <typename I>
std::ostream& operator<<(std::ostream& ostr, const oln::value_box<I>& vb)
Index: olena/oln/morpho/lower_completion.hh
--- olena/oln/morpho/lower_completion.hh (révision 226)
+++ olena/oln/morpho/lower_completion.hh (copie de travail)
@@ -54,9 +54,10 @@
input.nbh_get ());
level::fill (processed, false);
- typename ch_value_type<I, unsigned>::ret distance(input.size(),
+ typedef ntg_cumul_type(DestValue) cumul_type;
+ typename ch_value_type<I, cumul_type>::ret distance(input.size(),
input.nbh_get());
- unsigned cur_dist = 1;
+ cumul_type cur_dist = 1;
oln_type_of(I, piter) p(input.size());
for_all_p (p)
@@ -114,9 +115,19 @@
input.nbh_get());
for_all_p (p)
if (distance[p] == ntg_zero_val(DestValue))
- output[p] = cur_dist * input[p].value();
+ output[p] = input[p] * cur_dist;
else
- output[p] = cur_dist * input[p].value() + distance[p].value() - 1;
+ /* Careful, the order of the operations matters here. If we had
+ written is as
+
+ input[p] * cur_dist + distance[p] - 1
+
+ the compiler would have complained about the expression
+ « input[p] * cur_dist » not having an Integre property. This
+ is because the resolution of operator+ would have taken place
+ inside the ntg namespace, as its first operand would be
+ an Integre value. */
+ output[p] = distance[p] - 1 + input[p] * cur_dist;
return output;
}
Index: olena/oln/core/pw/arith.hh
--- olena/oln/core/pw/arith.hh (révision 226)
+++ olena/oln/core/pw/arith.hh (copie de travail)
@@ -76,8 +76,6 @@
return tmp;
}
-} // end of namespace oln
-
oln_pw_decl_binary( plus, + );
oln_pw_decl_binary( minus, - );
@@ -104,4 +102,7 @@
oln_pw_decl_arith_lit(double);
+} // end of namespace oln
+
+
#endif // ! OLENA_CORE_PW_ARITH_HH
1
0
04 Jul '05
J'ai effectué les changements ci-dessous pour que les gradients
puissent marcher sur des images avec voisinage. Ces modifications
comprennent :
- l'ajout de ch_value_type dans les propriétés de image_from_pwf ;
- la modification de force_value_type_to (cf. infra).
ChangeLog | 22 ++++++++++++++++++++++
oln/convert/force.hh | 5 +++--
oln/core/pw/image.hh | 7 +++++++
oln/funobj/accum.hh | 2 +-
oln/level/extrema_components.hh | 5 +++--
oln/level/level_components.hh | 2 +-
oln/morpho/gradient.hh | 6 +++---
oln/morpho/temp.hh | 14 ++++++++------
oln/morpho/thick_gradient.hh | 7 ++++---
9 files changed, 52 insertions(+), 18 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Catch up with changes in morphological gradients.
* oln/morpho/temp.hh (force_value_type_to): Take the whole output
image type as first parameter, not just its value type (which is
deduced from the former).
Use ntg::cast::force<> to perform the conversion.
* oln/core/pw/image.hh
(set_props <category::image, image_from_pwf<F> >::ch_value_type):
New.
* oln/morpho/gradient.hh, oln/morpho/thick_gradient.hh: Adjust.
* oln/funobj/accum.hh (accum_with_init::fun_)
(accum_with_init::value_): Switch the order of these declarations
to match the order of their initializations in ctors.
* oln/convert/force.hh, oln/level/level_components.hh: Aesthetic
changes.
* oln/level/extrema_components.hh: Likewise.
(extrema_components): Use ntg_cumul_type(DestValue) to store the
components labels.
Index: olena/oln/morpho/temp.hh
--- olena/oln/morpho/temp.hh (révision 226)
+++ olena/oln/morpho/temp.hh (copie de travail)
@@ -31,6 +31,7 @@
# include <oln/basics.hh>
# include <oln/utils/record.hh>
# include <oln/core/ch_value_type.hh>
+# include <ntg/utils/cast.hh>
namespace oln {
@@ -39,19 +40,20 @@
// FIXME: this is definitely temporay
- template <typename T, typename I>
- typename ch_value_type<I,T>::ret
+ template <typename O, typename I>
+ O
force_value_type_to(const abstract::image<I>& input)
{
entering("force_value_type_to");
registering(input, "input");
- typedef typename ch_value_type<I,T>::ret output_type;
- output_type output(input.size(), "output");
+ typedef oln_type_of(O, value) output_value_type;
- oln_type_of(I, fwd_piter) p(input.size());
+ O output(input.size(), "output");
+
+ oln_type_of(I, piter) p(input.size());
for_all_p (p)
- output[p] = T(input[p]);
+ output[p] = ntg::cast::force<output_value_type> (input[p].value());
exiting("force_value_type_to");
return output;
Index: olena/oln/core/pw/image.hh
--- olena/oln/core/pw/image.hh (révision 226)
+++ olena/oln/core/pw/image.hh (copie de travail)
@@ -69,6 +69,13 @@
typedef fwd_piter2d fwd_piter_type;
typedef bkd_piter2d bkd_piter_type;
typedef image2d<value_type> concrete_type;
+
+ // FIXME: Is this ``cast'' right?
+ template <typename U>
+ struct ch_value_type
+ {
+ typedef concrete_type<U> ret;
+ };
};
Index: olena/oln/morpho/gradient.hh
--- olena/oln/morpho/gradient.hh (révision 226)
+++ olena/oln/morpho/gradient.hh (copie de travail)
@@ -53,7 +53,7 @@
dil = elementary_dilation(input);
ero = elementary_erosion(input);
- output = force_value_type_to<oln_type_of(I, value)>( dil - ero );
+ output = force_value_type_to<oln_type_of(I, concrete)>( dil - ero );
exiting("morpho::gradient_beucher");
return output;
@@ -72,7 +72,7 @@
oln_type_of(I, concrete) ero("ero"), output("output");
ero = elementary_erosion(input);
- output = force_value_type_to<oln_type_of(I, value)>( input - ero );
+ output = force_value_type_to<oln_type_of(I, concrete)>( input - ero );
exiting("morpho::gradient_internal");
return output;
@@ -91,7 +91,7 @@
oln_type_of(I, concrete) dil("dil"), output("output");
dil = elementary_dilation(input);
- output = force_value_type_to<oln_type_of(I, value)>( dil - input );
+ output = force_value_type_to<oln_type_of(I, concrete)>( dil - input );
exiting("morpho::gradient_external");
return output;
Index: olena/oln/morpho/thick_gradient.hh
--- olena/oln/morpho/thick_gradient.hh (révision 226)
+++ olena/oln/morpho/thick_gradient.hh (copie de travail)
@@ -31,6 +31,7 @@
# include <oln/morpho/dilation.hh>
# include <oln/morpho/erosion.hh>
# include <oln/morpho/temp.hh>
+# include <oln/ops/arith.hh>
namespace oln {
@@ -52,7 +53,7 @@
dil = dilation(input, win);
ero = erosion(input, win);
- output = force_value_type_to<oln_type_of(I, value)>( dil - ero );
+ output = force_value_type_to<oln_type_of(I, concrete)>( dil - ero );
exiting("morpho::thick_gradient_beucher");
return output;
@@ -72,7 +73,7 @@
oln_type_of(I, concrete) ero("ero"), output("output");
ero = erosion(input, win);
- output = force_value_type_to<oln_type_of(I, value)>( input - ero );
+ output = force_value_type_to<oln_type_of(I, concrete)>( input - ero );
exiting("morpho::thick_gradient_internal");
return output;
@@ -92,7 +93,7 @@
oln_type_of(I, concrete) dil("dil"), output("output");
dil = dilation(input, win);
- output = force_value_type_to<oln_type_of(I, value)>( dil - input );
+ output = force_value_type_to<oln_type_of(I, concrete)>( dil - input );
exiting("morpho::thick_gradient_external");
return output;
Index: olena/oln/funobj/accum.hh
--- olena/oln/funobj/accum.hh (révision 226)
+++ olena/oln/funobj/accum.hh (copie de travail)
@@ -64,8 +64,8 @@
private:
- T value_;
F fun_;
+ T value_;
};
Index: olena/oln/convert/force.hh
--- olena/oln/convert/force.hh (révision 226)
+++ olena/oln/convert/force.hh (copie de travail)
@@ -51,8 +51,9 @@
name()
{
// FIXME: Exact is not an integre type !
- return std::string("force<")
- + ntg_name(Output) + ">";
+ // return std::string("force<") + ntg_name(Output) + ", " +
+ // Exact::name() + ">";
+ return std::string("force<") + ntg_name(Output) + ">";
}
};
Index: olena/oln/level/level_components.hh
--- olena/oln/level/level_components.hh (révision 226)
+++ olena/oln/level/level_components.hh (copie de travail)
@@ -67,7 +67,7 @@
q.pop();
oln_type_of(I, niter) n(input);
for_all_n_of_p (n, s)
- if (input.hold(n) && !processed[n] && input[n] == input[s])
+ if (input.hold(n) and !processed[n] and input[n] == input[s])
{
labels[n] = cur_label;
processed[n] = true;
Index: olena/oln/level/extrema_components.hh
--- olena/oln/level/extrema_components.hh (révision 226)
+++ olena/oln/level/extrema_components.hh (copie de travail)
@@ -50,7 +50,8 @@
Cmp cmp;
// Compute level components.
- typedef unsigned comp_type;
+ typedef ntg_cumul_type(DestValue) cumul_type;
+ typedef cumul_type comp_type;
typename ch_value_type<I, comp_type>::ret comps =
level_components<comp_type>(input);
std::set<comp_type> extrema;
@@ -68,7 +69,7 @@
oln_type_of(I, niter) n(input);
for_all_n_of_p (n, p)
- if (input.hold(n) && cmp(input[n], input[p]))
+ if (input.hold(n) and cmp(input[n], input[p]))
{
extrema.erase(comp);
non_extrema.insert(comp);
1
0