* 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().
---
milena/ChangeLog | 8 ++
milena/doc/ref_guide/ref_guide.tex | 2 +-
milena/mln/value/float01_.hh | 39 ++++++++
milena/mln/world/inter_pixel/display_edge.hh | 5 +-
milena/tests/world/inter_pixel/display_edge.cc | 112 ++++++++++++++++++++++++
5 files changed, 163 insertions(+), 3 deletions(-)
create mode 100644 milena/tests/world/inter_pixel/display_edge.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 702a0dc..d8e82fc 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,11 @@
+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().
+
2009-05-07 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix fun stat mahalanobis.
diff --git a/milena/doc/ref_guide/ref_guide.tex b/milena/doc/ref_guide/ref_guide.tex
index 1464207..a0d6c6b 100644
--- a/milena/doc/ref_guide/ref_guide.tex
+++ b/milena/doc/ref_guide/ref_guide.tex
@@ -1697,7 +1697,7 @@ You can extend the range of supported files by installing
third-parties librarie
`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}
diff --git a/milena/mln/value/float01_.hh b/milena/mln/value/float01_.hh
index 4d9d34e..a466f40 100644
--- a/milena/mln/value/float01_.hh
+++ b/milena/mln/value/float01_.hh
@@ -105,6 +105,13 @@ namespace mln
/// 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 @@ namespace mln
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)
{
diff --git a/milena/mln/world/inter_pixel/display_edge.hh
b/milena/mln/world/inter_pixel/display_edge.hh
index 9cfa046..b3c21f2 100644
--- a/milena/mln/world/inter_pixel/display_edge.hh
+++ b/milena/mln/world/inter_pixel/display_edge.hh
@@ -52,8 +52,9 @@ namespace mln
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();
diff --git a/milena/tests/world/inter_pixel/display_edge.cc
b/milena/tests/world/inter_pixel/display_edge.cc
new file mode 100644
index 0000000..5e79805
--- /dev/null
+++ b/milena/tests/world/inter_pixel/display_edge.cc
@@ -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);
+ }
+}
--
1.6.1.2