URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-05-07 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Fix display_edge() and float01_ constructors.
* doc/ref_guide/ref_guide.tex: I/O update.
* mln/value/float01_.hh: Add constructors with literals.
* mln/world/inter_pixel/display_edge.hh: Fix image bbox.
* tests/world/inter_pixel/display_edge.cc: New test for display_edge().
---
doc/ref_guide/ref_guide.tex | 2
mln/value/float01_.hh | 39 +++++++++++
mln/world/inter_pixel/display_edge.hh | 5 -
tests/world/inter_pixel/display_edge.cc | 112 ++++++++++++++++++++++++++++++++
4 files changed, 155 insertions(+), 3 deletions(-)
Index: trunk/milena/tests/world/inter_pixel/display_edge.cc
===================================================================
--- trunk/milena/tests/world/inter_pixel/display_edge.cc (revision 0)
+++ trunk/milena/tests/world/inter_pixel/display_edge.cc (revision 3774)
@@ -0,0 +1,112 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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, 51 Franklin Street, Fifth Floor,
+// 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.
+
+/// \file tests/world/inter_pixel/display_edge.cc
+///
+/// Tests on mln::world::inter_pixel::display_edge.
+
+
+#include <mln/core/var.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/level/compare.hh>
+#include <mln/world/inter_pixel/immerse.hh>
+#include <mln/world/inter_pixel/compute.hh>
+#include <mln/world/inter_pixel/display_edge.hh>
+
+#include <mln/world/inter_pixel/neighb2d.hh>
+#include <mln/debug/println.hh>
+
+
+
+struct d_t : mln::Function_vv2v<d_t>
+{
+ typedef int result;
+
+ int operator()(int i1, int i2) const
+ {
+ return std::abs(i2 - i1);
+ }
+}
+ d;
+
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ int vals[] = { 1 } ;
+
+ typedef image2d<int> I;
+ I ima = make::image2d(vals);
+
+ using namespace world::inter_pixel;
+ typedef image_if<I, is_pixel> Ix;
+ Ix imax = immerse(ima);
+
+ mln_VAR(g, compute(imax, d));
+ std::cout << g.unmorph_().bbox() << std::endl;
+
+ mln_VAR(out1, display_edge(g.unmorph_(), 0, 1));
+ debug::println(out1);
+ mln_VAR(out2, display_edge(g.unmorph_(), 0, 2));
+ debug::println(out2);
+ mln_VAR(out3, display_edge(g.unmorph_(), 0, 3));
+ debug::println(out3);
+ mln_VAR(out4, display_edge(g.unmorph_(), 0, 4));
+ debug::println(out4);
+ mln_VAR(out5, display_edge(g.unmorph_(), 0, 5));
+ debug::println(out5);
+ }
+
+ {
+ int vals[] = { 1, 2,
+ 3, 4 } ;
+
+ typedef image2d<int> I;
+ I ima = make::image2d(vals);
+
+ using namespace world::inter_pixel;
+ typedef image_if<I, is_pixel> Ix;
+ Ix imax = immerse(ima);
+
+ mln_VAR(g, compute(imax, d));
+ std::cout << g.unmorph_().bbox() << std::endl;
+
+ mln_VAR(out1, display_edge(g.unmorph_(), 0, 1));
+ debug::println(out1);
+ mln_VAR(out2, display_edge(g.unmorph_(), 0, 2));
+ debug::println(out2);
+ mln_VAR(out3, display_edge(g.unmorph_(), 0, 3));
+ debug::println(out3);
+ mln_VAR(out4, display_edge(g.unmorph_(), 0, 4));
+ debug::println(out4);
+ mln_VAR(out5, display_edge(g.unmorph_(), 0, 5));
+ debug::println(out5);
+ }
+}
Index: trunk/milena/doc/ref_guide/ref_guide.tex
===================================================================
--- trunk/milena/doc/ref_guide/ref_guide.tex (revision 3773)
+++ trunk/milena/doc/ref_guide/ref_guide.tex (revision 3774)
@@ -1697,7 +1697,7 @@
`Magick++-config --cppflags --cxxflags --ldflags --libs`
\end{verbatim}
- \begin{verbatim}Magick++-config\end{verbatim} will automatically fill the dependencies
depending of your
+ Magick++-config will automatically fill the dependencies depending of your
installation.
\doxysection{iodcm}{GDCM}
Index: trunk/milena/mln/world/inter_pixel/display_edge.hh
===================================================================
--- trunk/milena/mln/world/inter_pixel/display_edge.hh (revision 3773)
+++ trunk/milena/mln/world/inter_pixel/display_edge.hh (revision 3774)
@@ -52,8 +52,9 @@
I display_edge(const I& ima, mln_value(I) bg, unsigned zoom)
{
box2d b = ima.bbox();
- I output(make::box2d((b.pmin()[0] / 2) * (zoom + 1) + 1, (b.pmin()[1] / 2) * (zoom + 1)
+ 1,
- (b.pmax()[0] / 2) * (zoom + 1) - 1, (b.pmax()[1] / 2) * (zoom + 1) - 1));
+ // FIXME: Create a empty box of size 'zoom*zoom' is ima is null.
+ I output(make::box2d((b.pmin()[0] / 2) * (zoom + 1), (b.pmin()[1] / 2) * (zoom + 1),
+ (b.pmax()[0] / 2 + 1) * (zoom + 1) - 2, (b.pmax()[1] / 2 + 1) * (zoom + 1) -
2));
data::fill(output, bg);
typedef image_if<const I, dim2::is_edge> edge_t;
edge_t edge = ima | dim2::is_edge();
Index: trunk/milena/mln/value/float01_.hh
===================================================================
--- trunk/milena/mln/value/float01_.hh (revision 3773)
+++ trunk/milena/mln/value/float01_.hh (revision 3774)
@@ -105,6 +105,13 @@
/// Constructor from a float.
float01_(float val);
+ /// \{ Constructors/assignments with literals.
+ float01_(const mln::literal::zero_t&);
+ float01_& operator=(const mln::literal::zero_t&);
+ float01_(const mln::literal::one_t&);
+ float01_& operator=(const mln::literal::one_t&);
+ /// \}
+
/// Assigment from a float.
float01_<n>& operator=(float val);
@@ -193,6 +200,38 @@
template <unsigned n>
inline
+ float01_<n>::float01_(const mln::literal::zero_t&)
+ {
+ this->v_ = 0;
+ }
+
+ template <unsigned n>
+ inline
+ float01_<n>&
+ float01_<n>::operator=(const mln::literal::zero_t&)
+ {
+ this->v_ = 0;
+ return *this;
+ }
+
+ template <unsigned n>
+ inline
+ float01_<n>::float01_(const mln::literal::one_t&)
+ {
+ this->v_ = 1;
+ }
+
+ template <unsigned n>
+ inline
+ float01_<n>&
+ float01_<n>::operator=(const mln::literal::one_t&)
+ {
+ this->v_ = 1;
+ return *this;
+ }
+
+ template <unsigned n>
+ inline
float01_<n>&
float01_<n>::operator=(float val)
{