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
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-08 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update test for color.
* color_sub.cc: Upadte.
---
color_sub.cc | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
Index: trunk/milena/sandbox/duhamel/color_sub.cc
===================================================================
--- trunk/milena/sandbox/duhamel/color_sub.cc (revision 1266)
+++ trunk/milena/sandbox/duhamel/color_sub.cc (revision 1267)
@@ -48,16 +48,33 @@
#include <mln/core/image_if_value.hh>
#include <mln/debug/iota.hh>
+
+#include <mln/core/image2d_b.hh>
+#include <mln/core/sub_image.hh>
+#include <mln/core/image_if_value.hh>
+#include <mln/core/inplace.hh>
+
+#include <mln/level/fill.hh>
+# include <mln/debug/println.hh>
+# include <mln/core/w_window2d_int.hh>
+# include <mln/core/w_window2d_float.hh>
+# include <mln/core/image_if_interval.hh>
+
+# include <mln/make/win_chamfer.hh>
+# include <mln/geom/chamfer.hh>
+# include <mln/io/pbm/load.hh>
+
#include "color_sub.hh"
int main()
{
using namespace mln;
-
- image2d_b<value::int_u8> ima(10,10);
- debug::iota (ima);
- image2d_b<value::rgb8> out = color(inplace (ima | 50));
+ unsigned max = 51;
+ image2d_b<bool> input = io::pbm::load("../../img/toto.pbm");
+ const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 0> ();
+ image2d_b<unsigned> tmp = geom::chamfer(input, w_win, max);
+ image2d_b<value::rgb8> out = color(inplace (tmp | 4));
io::ppm::save(out, "out.ppm");
- // debug::println(out);
+ std::cout << "out.ppm generate" << std::endl;
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-08 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update color for image_if and subimage.
* color_sub.cc,
* color_sub.hh: Update, uncomment FIXME when level::paste ready.
Update chamfer.
* canvas_chamfer.hh: New.
* chamfer.cc,
* chamfer.hh: Update.
---
canvas_chamfer.hh | 98 ++++++++++++++++++++++++++
chamfer.cc | 27 +------
chamfer.hh | 197 ++++++++++++++++++++++++------------------------------
color_sub.cc | 8 +-
color_sub.hh | 19 ++---
5 files changed, 207 insertions(+), 142 deletions(-)
Index: trunk/milena/sandbox/duhamel/color_sub.cc
===================================================================
--- trunk/milena/sandbox/duhamel/color_sub.cc (revision 1265)
+++ trunk/milena/sandbox/duhamel/color_sub.cc (revision 1266)
@@ -54,10 +54,10 @@
{
using namespace mln;
- image2d_b<value::int_u8> ima(3,3);
+
+ image2d_b<value::int_u8> ima(10,10);
debug::iota(ima);
- std::cout << ima.domain() << std::endl;
- image2d_b<value::rgb8> out = color(inplace (ima | 6));
+ image2d_b<value::rgb8> out = color(inplace (ima | 50));
io::ppm::save(out, "out.ppm");
- debug::println(out);
+ // debug::println(out);
}
Index: trunk/milena/sandbox/duhamel/chamfer.cc
===================================================================
--- trunk/milena/sandbox/duhamel/chamfer.cc (revision 1265)
+++ trunk/milena/sandbox/duhamel/chamfer.cc (revision 1266)
@@ -1,34 +1,17 @@
#include <mln/core/image2d_b.hh>
#include <mln/core/sub_image.hh>
#include <mln/core/image_if_value.hh>
-#include <mln/core/neighb2d.hh>
#include <mln/core/inplace.hh>
-#include <mln/value/int_u8.hh>
#include <mln/level/fill.hh>
-#include <mln/level/stretch.hh>
-#include <mln/io/pbm/load.hh>
-#include <mln/io/pgm/save.hh>
-#include <mln/io/pgm/save.hh>
-#include <mln/io/pgm/save.hh>
-#include <mln/core/mesh_image.hh>
-# include <mln/labeling/base.hh>
# include <mln/debug/println.hh>
-# include <mln/core/window2d.hh>
# include <mln/core/w_window2d_int.hh>
-# include <mln/convert/to_window.hh>
-# include <mln/core/concept/dpoint.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/window.hh>
-# include <mln/pw/image.hh>
-# include <mln/pw/cst.hh>
-# include <mln/metal/is_a.hh>
-
+# include <mln/core/w_window2d_float.hh>
# include <mln/core/image_if_interval.hh>
+# include "win_chamfer.hh"
#include "chamfer.hh"
-
int main()
{
using namespace mln;
@@ -40,7 +23,7 @@
level::fill(ima, false);
ima.at(4,4) = true;
const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 0> ();
- image2d_b<unsigned> out = chamfer(ima, w_win, max);
+ image2d_b<unsigned> out = geom::chamfer(ima, w_win, max);
debug::println(out | value::interval(0, 8));
}
@@ -48,7 +31,7 @@
level::fill(ima, false);
ima.at(4,4) = true;
const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 3> ();
- image2d_b<unsigned> out = chamfer(ima, w_win, max);
+ image2d_b<unsigned> out = geom::chamfer(ima, w_win, max);
debug::println(out | value::interval(0, 8));
}
@@ -56,7 +39,7 @@
level::fill(ima, false);
ima.at(4,4) = true;
const w_window2d_int& w_win = win_chamfer::mk_chamfer_5x5_int<4, 6, 9> ();
- image2d_b<unsigned> out = chamfer(ima, w_win, max);
+ image2d_b<unsigned> out = geom::chamfer(ima, w_win, max);
image2d_b<unsigned>::fwd_piter p(out.domain());
for_all(p)
out(p) = out(p) / 2;
Index: trunk/milena/sandbox/duhamel/canvas_chamfer.hh
===================================================================
--- trunk/milena/sandbox/duhamel/canvas_chamfer.hh (revision 0)
+++ trunk/milena/sandbox/duhamel/canvas_chamfer.hh (revision 1266)
@@ -0,0 +1,98 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_CANVAS_CHAMFER_HH
+# define MLN_CANVAS_CHAMFER_HH
+
+/*! \file mln/canvas/chamfer.hh
+ *
+ * \brief Connected component chamfer of the object part in a binary
+ * image.
+ */
+
+namespace mln
+{
+ namespace canvas
+ {
+
+ template <typename F>
+ struct chamfer
+ {
+ F& f;
+
+ typedef typename F::I I;
+ typedef typename F::W W;
+ typedef mln_point(I) point;
+
+ chamfer(F& f)
+ : f(f)
+ {
+ run();
+ }
+
+ void run()
+ {
+ /// Init.
+ {
+ f.init();
+ }
+
+ /// Fwd pass.
+ {
+ mln_fwd_piter(I) p(f.input.domain());
+ mln_qiter(W) q(f.win, p);
+
+ for_all(p) if (f.handles (p))
+ for_all(q) if (f.input.has(q))
+ if (f.output(q) != f.max
+ && f.output(q) + q.w() < f.output(p))
+ f.output(p) = f.output(q) + q.w();
+ }
+
+ /// Bkd pass.
+ {
+ W w_win_b = geom::sym(f.win);
+
+ mln_bkd_piter(I) p(f.input.domain());
+ mln_qiter(W) q(w_win_b, p);
+
+ for_all(p) if (f.handles (p))
+ for_all(q) if (f.input.has(q))
+ if (f.output(q) != f.max
+ && f.output(q) + q.w() < f.output(p))
+ f.output(p) = f.output(q) + q.w();
+ f.status = true;
+ }
+
+ }
+ };
+
+ } // end of mln::canvas
+
+} // end of mln
+
+#endif // ! MLN_CANVAS_CHAMFER_HH
Index: trunk/milena/sandbox/duhamel/color_sub.hh
===================================================================
--- trunk/milena/sandbox/duhamel/color_sub.hh (revision 1265)
+++ trunk/milena/sandbox/duhamel/color_sub.hh (revision 1266)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/sub_image.hh
+/*! \file ?/sub_image.hh
*
* \brief .
*/
@@ -34,30 +34,31 @@
#include <mln/core/image2d_b.hh>
#include <mln/value/rgb8.hh>
#include <mln/level/fill.hh>
+#include <mln/level/paste.hh>
+
+
+#include <mln/trait/image_from_mesh.hh>
namespace mln
{
+
template <typename I>
- mln_ch_value (I, value::rgb8)
+ typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret
color (const Image<I>& input_)
{
const I& input = exact (input_);
- mln_ch_value(I, value::rgb8) output;
- initialize(output, input);
-
- // image2d_b<value::rgb8> output(ima.domain ().bbox ());
-
+ image2d_b<value::rgb8> output(input.domain().bbox());
level::fill (output, value::rgb8(255, 0, 0));
+// /// FIXME by :
+// level::paste(input, output);
{
mln_piter(I) p (input.domain ());
for_all (p)
- {
output(p) = value::rgb8(input(p));
}
- }
return output;
}
}
Index: trunk/milena/sandbox/duhamel/chamfer.hh
===================================================================
--- trunk/milena/sandbox/duhamel/chamfer.hh (revision 1265)
+++ trunk/milena/sandbox/duhamel/chamfer.hh (revision 1266)
@@ -1,143 +1,126 @@
-# include <mln/core/image2d_b.hh>
-# include <mln/core/sub_image.hh>
-# include <mln/core/image_if_value.hh>
-# include <mln/core/neighb2d.hh>
-# include <mln/core/inplace.hh>
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_GEOM_CHAMFER_HH
+# define MLN_GEOM_CHAMFER_HH
+
+/*! \file mln/geom/chamfer.hh
+ *
+ * \brief Connected component chamfer of the image objects.
+ */
-# include <mln/value/int_u8.hh>
# include <mln/level/fill.hh>
-# include <mln/level/stretch.hh>
-# include <mln/io/pbm/load.hh>
-# include <mln/io/pgm/save.hh>
-# include <mln/io/pgm/save.hh>
-# include <mln/io/pgm/save.hh>
-# include <mln/core/mesh_image.hh>
-# include <mln/labeling/base.hh>
-# include <mln/debug/println.hh>
-# include <mln/core/window2d.hh>
# include <mln/core/w_window2d_int.hh>
# include <mln/core/w_window2d_float.hh>
-# include <mln/convert/to_window.hh>
-# include <mln/core/concept/dpoint.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/window.hh>
-# include <mln/pw/image.hh>
-# include <mln/pw/cst.hh>
-# include <mln/metal/is_a.hh>
-
-# include <mln/core/image_if_interval.hh>
-# include <mln/core/dpoint2d.hh>
-# include <math.h>
+
+# include "canvas_chamfer.hh"
namespace mln
{
- namespace win_chamfer
- {
- template<int d10, int d11>
- const w_window2d_int
- mk_chamfer_3x3_int()
+ namespace geom
{
- int ws[] = { d11, d10, d11,
- d10, 0, 0,
- 0, 0, 0 };
- return (make::w_window2d(ws));
- }
- template<int d10, int d11, int d21>
- const w_window2d_int
- mk_chamfer_5x5_int()
- {
- int ws[] = { 0, d21, 0, d21, 0,
- d21, d11, d10, d11, d21,
- 0, d10, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0 };
+ template <typename I, typename W>
+ mln_ch_value( I, unsigned )
+ chamfer(const Image<I>& input_, const W& w_win_,
+ unsigned max = mln_max(unsigned));
+
- return (make::w_window2d(ws));
- }
+# ifndef MLN_INCLUDE_ONLY
- const w_window2d_float
- mk_chamfer_3x3_float(float d10, float d11)
+ namespace impl
{
- float ws[] = { d11, d10, d11,
- d10, 0, 0,
- 0, 0, 0 };
- return (make::w_window2d(ws));
- }
+ // Functors.
- const w_window2d_float
- mk_chamfer_5x5_float(float d10, float d11, float d21)
+ template <typename I_, typename W_>
+ struct chamfer_t
{
- float ws[] = { 0, d21, 0, d21, 0,
- d21, d11, d10, d11, d21,
- 0, d10, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0 };
+ typedef I_ I;
+ typedef W_ W;
+ typedef mln_point(I_) P;
- return (make::w_window2d(ws));
- }
+ // requirements from mln::canvas::chamfer:
- const w_window2d_float
- mk_chamfer_exact()
- {
- float r2 = sqrt(2);
- float ws[] = { r2, 1, r2,
- 1, 0, 0,
- 0, 0, 0 };
+ const I& input;
+ const W& win;
- return (make::w_window2d(ws));
- }
+ mln_ch_value(I_, unsigned) output;
+ bool status;
+ unsigned max;
+
+ void init() { initialize(output, exact(input));
+ level::fill(inplace(output | (input | true).domain()), 0);
+ level::fill(inplace(output | (input | false).domain()), max); }
+ bool handles(const P& p) const { return input(p) == false; }
+
+ // end of requirements
+
+ chamfer_t(const I_& input, const W_& win, unsigned max)
+ : input (input),
+ win (win),
+ max (max)
+ {}
+ };
- } // end of mln::win_chamfer
+ // Routines.
template <typename I, typename W>
mln_ch_value(I, unsigned)
- chamfer(const Image<I>& input_, const Weighted_Window<W>& w_win_,
+ chamfer_(const Image<I>& input_, const W& w_win_,
unsigned max = mln_max(unsigned))
{
- const I& input = exact(input_);
- const W& w_win = exact(w_win_);
+ typedef chamfer_t<I, W> F;
- mln_ch_value(I, unsigned) output;
- initialize(output, input);
-
- /// Init.
- {
- level::fill(inplace(output | (input | true).domain()), 0);
- level::fill(inplace(output | (input | false).domain()), max);
+ F f(exact(input_), exact(w_win_), max);
+ canvas::chamfer<F> run(f);
+ return f.output;
}
- /// Fwd pass.
- {
- mln_fwd_piter(I) p(input.domain());
- mln_qiter(W) q(w_win, p);
+ } // end of namespace mln::geom::impl
- for_all(p) if (input(p) == false)
- for_all(q) if (input.has(q))
- if (output(q) != max
- && output(q) + q.w() < output(p))
- output(p) = output(q) + q.w();
- }
-
- /// Bkd pass.
- {
+#endif // !MLN_INCLUDE_ONLY
- W w_win_b = geom::sym(w_win);
- mln_bkd_piter(I) p(input.domain());
- mln_qiter(W) q(w_win_b, p);
+ // Facade.
- for_all(p) if (input(p) == false)
- for_all(q) if (input.has(q))
- if (output(q) != max
- && output(q) + q.w() < output(p))
- output(p) = output(q) + q.w();
+ template <typename I, typename W>
+ mln_ch_value(I, unsigned)
+ chamfer(const Image<I>& input_, const W& w_win_,
+ unsigned max = mln_max(unsigned))
+ {
+ return impl::chamfer_(exact (input_), exact(w_win_), max);
}
- return output;
- }
-} // end of mln
+ } // end of namespace mln::geom
+
+} // end of namespace mln
+
+#endif // !MLN_GEOM_CHAMFER_HH
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-08 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Fix line for -O3 -DNDEBUG compilation.
* mln/core/win/line.hh: Fix.
* sandbox/nivault/dyn_line.hh: Line with dynamic direction.
* sandbox/nivault/tests/pouet.cc: Test for the file above.
---
mln/core/win/line.hh | 9 +-
sandbox/nivault/dyn_line.hh | 183 +++++++++++++++++++++++++++++++++++++++++
sandbox/nivault/tests/pouet.cc | 49 ++++++++++
3 files changed, 237 insertions(+), 4 deletions(-)
Index: trunk/milena/mln/core/win/line.hh
===================================================================
--- trunk/milena/mln/core/win/line.hh (revision 1264)
+++ trunk/milena/mln/core/win/line.hh (revision 1265)
@@ -125,12 +125,13 @@
{
mln_precondition(i < M::dim);
mln_precondition(length % 2 == 1);
- const int dcol = length / 2;
- for (int col = - dcol; col <= dcol; ++col)
+ const int dc = length / 2;
+ for (int c = - dc; c <= dc; ++c)
{
dpoint n;
- n[i] = col;
- insert(n);
+ n.set_all(0);
+ n[i] = c;
+ this->insert(n);
}
}
Index: trunk/milena/sandbox/nivault/dyn_line.hh
===================================================================
--- trunk/milena/sandbox/nivault/dyn_line.hh (revision 0)
+++ trunk/milena/sandbox/nivault/dyn_line.hh (revision 1265)
@@ -0,0 +1,183 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_CORE_WIN_DYN_LINE_HH
+# define MLN_CORE_WIN_DYN_LINE_HH
+
+/*! \file mln/core/win/dyn_line.hh
+ *
+ * \brief Definition of the mln::win::dyn_line window.
+ */
+
+# include <mln/core/concept/window.hh>
+# include <mln/core/internal/dpoints_base.hh>
+# include <mln/core/dpoint.hh>
+# include <mln/core/dpoints_piter.hh>
+
+
+namespace mln
+{
+
+ namespace win
+ {
+
+ template <typename M, typename C>
+ struct dyn_line : public Window< dyn_line<M,C> >,
+ public internal::dpoints_base_<dpoint_<M, C>, point_<M, C> >
+ {
+ /// Point associated type.
+ typedef point_<M, int> point;
+
+ /// Dpoint associated type.
+ typedef dpoint_<M, int> dpoint;
+
+ /// Point_Iterator type to browse a dyn_line forward
+ typedef dpoints_fwd_piter<dpoint> fwd_qiter;
+
+ /// Point_Iterator type to browse a dyn_line backward
+ typedef dpoints_bkd_piter<dpoint> bkd_qiter;
+
+ /// Same as fwd_qiter
+ typedef fwd_qiter qiter;
+
+ /*! \brief Constructor.
+ *
+ * \param[in] length Length of the dyn_line.
+ *
+ * \pre \p length is odd.
+ */
+ dyn_line(unsigned length, unsigned direction);
+
+ /*! \brief Test if the window is centered.
+ *
+ * \return True.
+ */
+ bool is_centered() const;
+
+ /*! \brief Test if the window is symmetric.
+ *
+ * \return true.
+ */
+ bool is_symmetric() const;
+
+ /*! \brief Give the dyn_line length, that is, its width.
+ */
+ unsigned length() const;
+
+ /*! \brief Give the maximum coordinate gap between the window
+ * center and a window point.
+ */
+ unsigned delta() const;
+
+ /// Apply a central symmetry to the target window.
+ dyn_line<M,C>& sym();
+
+ protected:
+ unsigned length_;
+ };
+
+
+ /*! \brief Print an dyn_line window \p win into the output
+ * stream \p ostr.
+ *
+ * \param[in,out] ostr An output stream.
+ * \param[in] win An dyn_line window.
+ *
+ * \return The modified output stream \p ostr.
+ *
+ * \relates mln::win::dyn_line
+ */
+ template <typename M, typename C>
+ std::ostream& operator<<(std::ostream& ostr, const dyn_line<M,C>& win);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename M, typename C>
+ dyn_line<M,C>::dyn_line(unsigned length, unsigned i)
+ : length_(length)
+ {
+ mln_precondition(i < M::dim);
+ mln_precondition(length % 2 == 1);
+ const int dc = length / 2;
+ for (int c = - dc; c <= dc; ++c)
+ {
+ dpoint n;
+ n.set_all(0);
+ n[i] = c;
+ this->insert(n);
+ }
+ }
+
+ template <typename M, typename C>
+ bool dyn_line<M,C>::is_centered() const
+ {
+ return true;
+ }
+
+ template <typename M, typename C>
+ bool dyn_line<M,C>::is_symmetric() const
+ {
+ return true;
+ }
+
+ template <typename M, typename C>
+ unsigned dyn_line<M,C>::length() const
+ {
+ return length_;
+ }
+
+ template <typename M, typename C>
+ unsigned dyn_line<M,C>::delta() const
+ {
+ return length_ / 2;
+ }
+
+ template <typename M, typename C>
+ dyn_line<M,C>& dyn_line<M,C>::sym()
+ {
+ return *this;
+ }
+
+ template <typename M, typename C>
+ std::ostream& operator<<(std::ostream& ostr, const dyn_line<M,C>& win)
+ {
+ ostr << "[dyn_line: length=" << win.length() << ']';
+ return ostr;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::win
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_CORE_WIN_DYN_LINE_HH
Index: trunk/milena/sandbox/nivault/tests/pouet.cc
===================================================================
--- trunk/milena/sandbox/nivault/tests/pouet.cc (revision 0)
+++ trunk/milena/sandbox/nivault/tests/pouet.cc (revision 1265)
@@ -0,0 +1,49 @@
+#include <mln/morpho/includes.hh>
+
+#include <mln/core/win/dyn_line.hh>
+#include <mln/core/win/hline2d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/core/image2d_b.hh>
+
+#include <mln/level/paste.hh>
+
+#include <iostream>
+
+using namespace mln;
+
+
+template <typename W>
+void erosion_on_function(const image2d_b<value::int_u8>& input, const Window<W>& win_, image2d_b<value::int_u8>& output)
+{
+ const W& win = exact(win_);
+
+ accu::min_<value::int_u8> min;
+
+ mln_piter(image2d_b<value::int_u8>) p(input.domain());
+ mln_qiter(W) q(win, p);
+ for_all(p)
+ {
+ min.init();
+ for_all(q) if (input.has(q))
+ min.take(input(q));
+ output(p) = min.to_result();
+ }
+}
+
+
+int main()
+{
+// win::dyn_line<grid::square, int> h(17, 1);
+ win::hline2d h(17);
+
+ image2d_b<value::int_u8> lena = io::pgm::load("../../../img/lena.pgm");
+ image2d_b<value::int_u8> out(lena.domain());
+
+ erosion_on_function(lena, h, out);
+ //level::paste(lena, out);
+ io::pgm::save(out, "out.pgm");
+}
1
0
tegucigalpa% cat value_int_u8.cc
// Copyright (C) 2007 EPITA Research and Development Laboratory
//...
/*! \file tests/value_int_u8.cc
*
* \brief Tests on mln::value::int_u8.
*/
#include <mln/value/int_u8.hh>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tegucigalpa% cat value_gray.cc
// Copyright (C) 2007 EPITA Research and Development Laboratory
//...
#include <mln/value/graylevel.hh>
=> no file doc
filename does not match include :-(
1
0
08 Oct '07
Matthieu Garrigues wrote:
> URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
>
> ChangeLog:
> 2007-10-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
>
> Add scalar() to "scalarise" values.
are you sure?
tegucigalpa% grep "scalar(" mln/**/*hh
tegucigalpa%
> ...
> ===================================================================
> --- trunk/milena/mln/value/concept/floating.hh (revision 1255)
> +++ trunk/milena/mln/value/concept/floating.hh (revision 1256)
> @@ -25,8 +25,8 @@
> // reasons why the executable file might be covered by the GNU General
> // Public License.
>
> -#ifndef MLN_VALUE_FLOATING_HH
> -# define MLN_VALUE_FLOATING_HH
> +#ifndef MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
> +# define MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
trunk/milena/mln/value/concept/floating.hh
MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
^^^^^^^
do not match; try again...
>
> /*! \file mln/value/floating.hh
^^^^^
same comment as above...
> ...
> -# include <mln/core/concept/value.hh>
> -
> namespace mln
> {
>
> @@ -69,5 +67,6 @@
>
> } // end of namespace mln
>
> +# include <mln/core/concept/value.hh>
> ...
never do that! instead, try to solve the actual inclusion problem.
> ...
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make trait naming and directories coherent.
* mln/trait/image_from_mesh.hh: .
* mln/trait/image: New directory.
* mln/trait/images.hh: Split contents into...
* mln/trait/image/props.hh,
* mln/trait/image/print.hh,
* mln/trait/undef.hh: these new files.
* mln/trait/kind.hh: Rename as...
* mln/trait/value/kind.hh: ...this.
Layout.
* mln/trait/value_.hh: New.
* mln/trait/value: New.
* mln/trait/value/print.hh: New.
* mln/trait/value/nature.hh: New.
* mln/value/int_u.hh (value_): Add trait.
* mln/histo/compute.hh,
* mln/debug/iota.hh,
* mln/debug/println_with_border.hh,
* mln/core/internal/image_if_base.hh,
* mln/core/internal/check/image_all.hh,
* mln/core/image2d_b.hh,
* mln/core/sub_image.hh,
* mln/core/concept/value.hh,
* mln/core/image1d_b.hh,
* mln/core/image3d_b.hh,
* mln/metal/mat.hh,
* mln/metal/vec.hh,
* mln/arith/plus.hh,
* mln/arith/min.hh,
* mln/arith/revert.hh,
* mln/arith/minus.hh,
* mln/level/take.hh,
* mln/level/assign.hh,
* mln/level/apply.hh,
* mln/level/fill.hh,
* mln/level/memset_.hh,
* mln/level/median.hh,
* mln/level/paste.spe.hh,
* mln/level/paste.hh,
* mln/linear/convolve.hh,
* mln/linear/local/convolve.hh,
* mln/value/graylevel.hh,
* mln/value/float01_.hh,
* mln/value/int_s.hh,
* mln/value/int_u_sat.hh,
* mln/value/props.hh,
* mln/value/rgb.hh,
* mln/value/rgb8_non_templated.hh,
* mln/value/float01_f.hh,
* mln/value/label.hh,
* mln/border/resize.hh,
* mln/border/fill.hh,
* mln/border/duplicate.hh,
* mln/border/mirror.hh,
* mln/border/get.hh,
* mln/test/predicate.hh,
* mln/pw/image.hh,
* mln/morpho/min.hh,
* mln/morpho/plus.hh,
* mln/morpho/minus.hh,
* mln/morpho/complementation.hh,
* mln/morpho/dilation.hh,
* mln/morpho/erosion.hh,
* mln/morpho/hit_or_miss.hh,
* mln/io/internal/pnm/save.hh,
* mln/logical/and.hh,
* mln/logical/and_not.hh,
* mln/logical/or.hh,
* mln/logical/not.hh,
* mln/labeling/level.hh: Update trait naming.
Misc.
* mln/trait/ch_value.hh,
* mln/trait/concrete.hh,
* tests/trait_images.cc: Fix doc text.
* tests/linear_sobel.cc: Rename as...
* tests/linear_sobel._cc: ...this; so deactivate for tests.
Update.
* tests/trait_value.cc: New.
mln/arith/min.hh | 20 +-
mln/arith/minus.hh | 20 +-
mln/arith/plus.hh | 26 +--
mln/arith/revert.hh | 8 -
mln/border/duplicate.hh | 2
mln/border/fill.hh | 2
mln/border/get.hh | 4
mln/border/mirror.hh | 2
mln/border/resize.hh | 2
mln/core/concept/value.hh | 1
mln/core/image1d_b.hh | 20 +-
mln/core/image2d_b.hh | 20 +-
mln/core/image3d_b.hh | 20 +-
mln/core/internal/check/image_all.hh | 2
mln/core/internal/image_if_base.hh | 8 -
mln/core/sub_image.hh | 4
mln/debug/iota.hh | 4
mln/debug/println_with_border.hh | 2
mln/histo/compute.hh | 4
mln/io/internal/pnm/save.hh | 4
mln/labeling/level.hh | 8 -
mln/level/apply.hh | 4
mln/level/assign.hh | 8 -
mln/level/fill.hh | 6
mln/level/median.hh | 4
mln/level/memset_.hh | 2
mln/level/paste.hh | 2
mln/level/paste.spe.hh | 8 -
mln/level/take.hh | 4
mln/linear/convolve.hh | 8 -
mln/linear/local/convolve.hh | 4
mln/logical/and.hh | 12 -
mln/logical/and_not.hh | 12 -
mln/logical/not.hh | 8 -
mln/logical/or.hh | 12 -
mln/metal/mat.hh | 2
mln/metal/vec.hh | 2
mln/morpho/complementation.hh | 2
mln/morpho/dilation.hh | 2
mln/morpho/erosion.hh | 2
mln/morpho/hit_or_miss.hh | 2
mln/morpho/min.hh | 4
mln/morpho/minus.hh | 2
mln/morpho/plus.hh | 2
mln/pw/image.hh | 20 +-
mln/test/predicate.hh | 4
mln/trait/ch_value.hh | 2
mln/trait/concrete.hh | 2
mln/trait/image/print.hh | 90 ++++++++++++
mln/trait/image/props.hh | 261 +++++++++--------------------------
mln/trait/image_from_mesh.hh | 2
mln/trait/images.hh | 158 +--------------------
mln/trait/undef.hh | 52 ++++++
mln/trait/value/kind.hh | 32 ++--
mln/trait/value/nature.hh | 68 +++++++++
mln/trait/value/print.hh | 80 ++++++++++
mln/trait/value_.hh | 80 ++++++++++
mln/value/float01_.hh | 2
mln/value/float01_f.hh | 2
mln/value/graylevel.hh | 2
mln/value/int_s.hh | 2
mln/value/int_u.hh | 9 +
mln/value/int_u_sat.hh | 2
mln/value/label.hh | 2
mln/value/props.hh | 26 +--
mln/value/rgb.hh | 2
mln/value/rgb8_non_templated.hh | 2
tests/trait_images.cc | 10 -
tests/trait_value.cc | 42 +++++
69 files changed, 717 insertions(+), 534 deletions(-)
Index: tests/trait_images.cc
--- tests/trait_images.cc (revision 1263)
+++ tests/trait_images.cc (working copy)
@@ -25,9 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/trait_ch_value.cc
+/*! \file tests/trait_images.cc
*
- * \brief Tests on mln::trait::ch_value.
+ * \brief Tests on mln::trait::images.
*/
#include <mln/core/image2d_b.hh>
@@ -44,13 +44,13 @@
typedef image2d_b<int> I;
std::cout << "image2d_b: ";
- mln::trait::print<I>(std::cout);
+ mln::trait::image::print<I>(std::cout);
std::cout << std::endl
<< "sub_image< image2d_b >: ";
- mln::trait::print< sub_image<I, box2d> >(std::cout);
+ mln::trait::image::print< sub_image<I, box2d> >(std::cout);
std::cout << std::endl
<< "image_if< image2d_b >: ";
- mln::trait::print< image_if<I, fun::p2b::chess_t> >(std::cout);
+ mln::trait::image::print< image_if<I, fun::p2b::chess_t> >(std::cout);
}
Index: tests/trait_value.cc
--- tests/trait_value.cc (revision 0)
+++ tests/trait_value.cc (revision 0)
@@ -0,0 +1,42 @@
+// Copyright (C) 2007 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, 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/trait_value.cc
+ *
+ * \brief Tests on mln::trait::ch_value.
+ */
+
+#include <mln/value/int_u8.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ std::cout << "value::int_u8: ";
+ mln::trait::value::print< value::int_u8 >(std::cout);
+}
Index: mln/trait/image_from_mesh.hh
--- mln/trait/image_from_mesh.hh (revision 1263)
+++ mln/trait/image_from_mesh.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_TRAIT_IMAGE_FROM_MESH_HH
# define MLN_TRAIT_IMAGE_FROM_MESH_HH
-/*! \file mln/core/trait/image_from_mesh.hh
+/*! \file mln/trait/image_from_mesh.hh
*
* \brief Definition of the "image from mesh" trait.
*/
Index: mln/trait/image/props.hh
--- mln/trait/image/props.hh (revision 0)
+++ mln/trait/image/props.hh (working copy)
@@ -25,206 +25,149 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_TRAIT_IMAGES_HH
-# define MLN_TRAIT_IMAGES_HH
+#ifndef MLN_TRAIT_IMAGE_PROPS_HH
+# define MLN_TRAIT_IMAGE_PROPS_HH
-/*! \file mln/core/trait/images.hh
+/*! \file mln/trait/image/props.hh
*
- * \brief Forward declarations of all image types.
- *
- * \todo Split this file into many.
+ * \brief Properties of image classes.
*/
-# include <iostream>
# include <string>
-
-# include <mln/value/props.hh>
-
-# include <mln/metal/bexpr.hh>
-# include <mln/metal/equal.hh>
-# include <mln/metal/if.hh>
-# include <mln/metal/is_const.hh>
-
-
-# define mln_trait_image_category(I) typename mln::trait::image_< I >::category
-
-# define mln_trait_image_kind(I) typename mln::trait::image_< I >::kind
-# define mln_trait_image_quant(I) typename mln::trait::image_< I >::quant
-# define mln_trait_image_value(I) typename mln::trait::image_< I >::value
-
-# define mln_trait_image_access(I) typename mln::trait::image_< I >::access
-# define mln_trait_image_space(I) typename mln::trait::image_< I >::space
-# define mln_trait_image_size(I) typename mln::trait::image_< I >::size
-# define mln_trait_image_support(I) typename mln::trait::image_< I >::support
-
-# define mln_trait_image_border(I) typename mln::trait::image_< I >::border
-# define mln_trait_image_data(I) typename mln::trait::image_< I >::data
-# define mln_trait_image_io(I) typename mln::trait::image_< I >::io
-# define mln_trait_image_speed(I) typename mln::trait::image_< I >::speed
-
-
-// for io: I const => read_only, otherwise like I
-# define mln_trait_image_io_from_(I) \
-mlc_if( mlc_is_const(I), mln::trait::io::read_only, mln_trait_image_io(I) )
-
-// for data: if raw or linear => stored, otherwise like I (i.e., either stored or computed)
-#define mln_trait_image_data_from_(I) typename \
-mln::metal::if_< mln::metal::or_< mlc_equal( mln_trait_image_data(I), \
- mln::trait::data::raw), \
- mlc_equal( mln_trait_image_data(I), \
- mln::trait::data::linear) >, \
- mln::trait::data::stored, \
- mln_trait_image_data(I) >::ret
+# include <mln/trait/value/kind.hh>
namespace mln
{
- // Primitive types.
- template <typename T> struct image1d_b;
- template <typename T> struct image2d_b;
- template <typename T> struct image3d_b;
- namespace pw { template <typename F, typename S> struct image; }
- template <typename P, typename T> class rle_image;
- template <typename P, typename T> class sparse_image;
-
- // Morphers.
- template <typename I, typename F> struct image_if_base;
- template <typename I, typename D> class decorated_image;
- template <typename I, typename S> class sub_image;
- template <typename I> struct t_image;
- template <typename I> class safe_image;
- template <typename T, typename I> class cast_image_;
- namespace value { template <unsigned n, typename I> struct stack_image; }
-
-
-
namespace trait
{
- struct undef { std::string str() const { return "undef"; } };
-
-
- template <typename I>
- struct undefined_image_
+ namespace image
{
- typedef undef category; // primary, domain_morpher, value_morpher,
- // or identity_morpher < morpher
- // related to I::value
- typedef undef kind; // color, gray, binary < logic < label, data
- typedef undef quant; // low or high
- typedef undef value; // scalar, vectorial, structed, pointer
- // FIXME: Make the difference between homogeneous and heterogeneous vectors...
+ // FIXME: For the record:
- // related to I::pset
- typedef undef access; // random, browsing
- typedef undef space; // one_d, two_d, three_d
- typedef undef size; // huge or regular
- typedef undef support; // irregular, aligned < regular
+ // template <typename I>
+ // struct undefined_image_
+ // {
+ // typedef undef category; // primary, domain_morpher, value_morpher,
+ // // or identity_morpher < morpher
+
+ // // related to I::value
+ // typedef undef kind; // color, gray, binary < logic < label, data
+ // typedef undef quant; // low or high
+ // typedef undef value; // scalar, vectorial, structed, pointer
+ // // FIXME: Make the difference between homogeneous and heterogeneous vectors...
+
+ // // related to I::pset
+ // typedef undef access; // random, browsing
+ // typedef undef space; // one_d, two_d, three_d
+ // typedef undef size; // huge or regular
+ // typedef undef support; // irregular, aligned < regular
+
+ // // global
+ // typedef undef border; // none, stored, computed
+ // typedef undef data; // raw < linear < stored, computed
+ // typedef undef io; // read_only < read, write_only < write, read_write < both read'n write
+ // typedef undef speed; // slow, fast, or fastest
+ // };
- // global
- typedef undef border; // none, stored, computed
- typedef undef data; // raw < linear < stored, computed
- typedef undef io; // read_only < read, write_only < write, read_write < both read'n write
- typedef undef speed; // slow, fast, or fastest
- };
-
-
- template <typename I>
- struct image_ : undefined_image_<I>
- {
- };
+ // FIXME: Add nice pictures of those hierarchies.
struct category
{
struct any {};
- struct primary : any { std::string str() const { return "category::primary"; } };
+ struct primary : any { std::string name() const { return "category::primary"; } };
struct morpher : any {};
struct domain_morpher
- : morpher { std::string str() const { return "category::domain_morpher"; } };
+ : morpher { std::string name() const { return "category::domain_morpher"; } };
struct value_morpher
- : morpher { std::string str() const { return "category::value_morpher"; } };
+ : morpher { std::string name() const { return "category::value_morpher"; } };
struct identity_morpher
- : morpher { std::string str() const { return "category::identity_morpher"; } };
+ : morpher { std::string name() const { return "category::identity_morpher"; } };
};
+
+ typedef mln::trait::value::kind kind; // Fetch the 'kind' structure from value traits.
+
+
struct data
{
struct any {};
- struct computed : any { std::string str() const { return "data::computed"; } };
- struct stored : any { std::string str() const { return "data::stored"; } };
+ struct computed : any { std::string name() const { return "data::computed"; } };
+ struct stored : any { std::string name() const { return "data::stored"; } };
struct linear
- : stored { std::string str() const { return "data::linear"; } };
+ : stored { std::string name() const { return "data::linear"; } };
struct raw
- : linear { std::string str() const { return "data::raw"; } };
+ : linear { std::string name() const { return "data::raw"; } };
};
struct quant
{
struct any {};
- struct low : any { std::string str() const { return "quant::low"; } };
- struct high : any { std::string str() const { return "quant::high"; } };
+ struct low : any { std::string name() const { return "quant::low"; } };
+ struct high : any { std::string name() const { return "quant::high"; } };
};
struct value
{
struct any {};
- struct scalar : any { std::string str() const { return "value::scalar"; } };
- struct vectorial : any { std::string str() const { return "value::vectorial"; } };
- struct structed : any { std::string str() const { return "value::structed"; } };
- struct pointer : any { std::string str() const { return "value::pointer"; } };
+ struct scalar : any { std::string name() const { return "value::scalar"; } };
+ struct vectorial : any { std::string name() const { return "value::vectorial"; } };
+ struct structed : any { std::string name() const { return "value::structed"; } };
+ struct pointer : any { std::string name() const { return "value::pointer"; } };
struct fixme // So FIXME!
- : any { std::string str() const { return "space::fixme"; } };
+ : any { std::string name() const { return "space::fixme"; } };
};
struct access
{
struct any {};
- struct random : any { std::string str() const { return "access::random"; } };
- struct browsing : any { std::string str() const { return "access::browsing"; } };
+ struct random : any { std::string name() const { return "access::random"; } };
+ struct browsing : any { std::string name() const { return "access::browsing"; } };
};
struct space
{
struct any {};
- struct one_d : any { std::string str() const { return "space::one_d"; } };
- struct two_d : any { std::string str() const { return "space::two_d"; } };
- struct three_d : any { std::string str() const { return "space::three_d"; } };
+ struct one_d : any { std::string name() const { return "space::one_d"; } };
+ struct two_d : any { std::string name() const { return "space::two_d"; } };
+ struct three_d : any { std::string name() const { return "space::three_d"; } };
struct fixme_ // So FIXME!
- : any { std::string str() const { return "space::fixme_"; } };
+ : any { std::string name() const { return "space::fixme_"; } };
};
struct size
{
struct any {};
- struct huge : any { std::string str() const { return "size::huge"; } };
- struct regular : any { std::string str() const { return "size::regular"; } };
+ struct huge : any { std::string name() const { return "size::huge"; } };
+ struct regular : any { std::string name() const { return "size::regular"; } };
};
struct support
{
struct any {};
- struct irregular : any { std::string str() const { return "support::irregular"; } };
- struct regular : any { std::string str() const { return "support::regular"; } };
+ struct irregular : any { std::string name() const { return "support::irregular"; } };
+ struct regular : any { std::string name() const { return "support::regular"; } };
struct aligned
- : regular { std::string str() const { return "support::aligned"; } };
+ : regular { std::string name() const { return "support::aligned"; } };
struct fixme_ // So FIXME!
- : any { std::string str() const { return "support::fixme_"; } };
+ : any { std::string name() const { return "support::fixme_"; } };
};
struct border
{
struct any {};
- struct none : any { std::string str() const { return "border::none"; } };
- struct stored : any { std::string str() const { return "border::stored"; } };
- struct computed : any { std::string str() const { return "border::computed"; } };
+ struct none : any { std::string name() const { return "border::none"; } };
+ struct stored : any { std::string name() const { return "border::stored"; } };
+ struct computed : any { std::string name() const { return "border::computed"; } };
};
struct io
@@ -233,84 +176,28 @@
struct read : virtual any {};
struct write : virtual any {};
struct read_only
- : read { std::string str() const { return "io::read_only"; } };
+ : read { std::string name() const { return "io::read_only"; } };
struct write_only
- : write { std::string str() const { return "io::write_only"; } };
+ : write { std::string name() const { return "io::write_only"; } };
struct read_write
- : read, write { std::string str() const { return "io::read_write"; } };
+ : read, write { std::string name() const { return "io::read_write"; } };
};
struct speed
{
struct any {};
- struct slow : any { std::string str() const { return "speed::slow"; } };
- struct fast : any { std::string str() const { return "speed::fast"; } };
+ struct slow : any { std::string name() const { return "speed::slow"; } };
+ struct fast : any { std::string name() const { return "speed::fast"; } };
struct fastest
- : fast { std::string str() const { return "speed::fastest"; } };
+ : fast { std::string name() const { return "speed::fastest"; } };
};
-
- template <typename I>
- void print(std::ostream& ostr)
- {
- typedef image_<I> the;
- ostr << "{ "
- << typename the::category().str() << ", "
- << typename the::data().str() << ", "
- << typename the::kind().str() << ", "
- << typename the::quant().str() << ", "
- << typename the::value().str() << ", "
- << typename the::access().str() << ", "
- << typename the::space().str() << ", "
- << typename the::size().str() << ", "
- << typename the::support().str() << ", "
- << typename the::border().str() << ", "
- << typename the::io().str() << ", "
- << typename the::speed().str() << " }" << std::endl;
- }
-
-
-
- template <typename T, typename I>
- struct default_image_ : undefined_image_<I>
- {
- private:
- typedef metal::bool_<( mln_value_card_(T) = 0 )> is_high_quant_;
- public:
- typedef mln_value_kind(T) kind;
- typedef mlc_if( is_high_quant_, trait::quant::high, trait::quant::low ) quant;
- // FIXME: typedef undef value; // scalar, vectorial, structed
-
- // speed is fast by default (neither "fastest" nor "slow")
- typedef trait::speed::fast speed;
- };
-
-
- template <typename D, typename T, typename I>
- struct default_image_morpher_ : default_image_<T, I>
- {
- // value-related => delegation
- typedef typename image_<D>::kind kind;
- typedef typename image_<D>::quant quant;
- typedef typename image_<D>::value value;
-
- // domain-related => delegation
- typedef typename image_<D>::access access;
- typedef typename image_<D>::space space;
- typedef typename image_<D>::size size;
- typedef typename image_<D>::support support;
-
- // mostly global-related => delegation
- typedef typename image_<D>::border border;
- typedef typename image_<D>::data data;
- typedef typename image_<D>::io io;
- };
-
+ } // end of namespace mln::trait::image
} // end of namespace mln::trait
} // end of namespace mln
-#endif // ! MLN_TRAIT_IMAGES_HH
+#endif // ! MLN_TRAIT_IMAGE_PROPS_HH
Index: mln/trait/image/print.hh
--- mln/trait/image/print.hh (revision 0)
+++ mln/trait/image/print.hh (revision 0)
@@ -0,0 +1,90 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_TRAIT_IMAGE_PRINT_HH
+# define MLN_TRAIT_IMAGE_PRINT_HH
+
+/*! \file mln/trait/image/print.hh
+ *
+ * \brief Print the collection of traits for an image type.
+ */
+
+# include <iostream>
+# include <mln/trait/images.hh>
+# include <mln/metal/is_a.hh>
+
+
+
+namespace mln
+{
+
+ // Fwd decl.
+ template <typename E> struct Image;
+
+
+ namespace trait
+ {
+
+ namespace image
+ {
+
+ template <typename I>
+ void print(std::ostream& ostr);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void print(std::ostream& ostr)
+ {
+ mlc_is_a(I, Image)::check();
+ typedef mln::trait::image_<I> the;
+ ostr << "{ "
+ << typename the::category().name() << ", "
+ << typename the::data() .name() << ", "
+ << typename the::kind() .name() << ", "
+ << typename the::quant() .name() << ", "
+ << typename the::value() .name() << ", "
+ << typename the::access() .name() << ", "
+ << typename the::space() .name() << ", "
+ << typename the::size() .name() << ", "
+ << typename the::support() .name() << ", "
+ << typename the::border() .name() << ", "
+ << typename the::io() .name() << ", "
+ << typename the::speed() .name() << " }" << std::endl;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::trait::image
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+#endif // ! MLN_TRAIT_IMAGE_PRINT_HH
Index: mln/trait/ch_value.hh
--- mln/trait/ch_value.hh (revision 1263)
+++ mln/trait/ch_value.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_TRAIT_CH_VALUE_HH
# define MLN_TRAIT_CH_VALUE_HH
-/*! \file mln/core/trait/ch_value.hh
+/*! \file mln/trait/ch_value.hh
*
* \brief Definition of the "change value" image trait.
*/
Index: mln/trait/undef.hh
--- mln/trait/undef.hh (revision 0)
+++ mln/trait/undef.hh (revision 0)
@@ -0,0 +1,52 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_TRAIT_UNDEF_HH
+# define MLN_TRAIT_UNDEF_HH
+
+/*! \file mln/trait/undef.hh
+ *
+ * \brief Undefined flag type for a trait.
+ */
+
+# include <string>
+
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+ struct undef { std::string name() const { return "undef"; } };
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+#endif // ! MLN_TRAIT_UNDEF_HH
Index: mln/trait/concrete.hh
--- mln/trait/concrete.hh (revision 1263)
+++ mln/trait/concrete.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_TRAIT_CONCRETE_HH
# define MLN_TRAIT_CONCRETE_HH
-/*! \file mln/core/trait/concrete.hh
+/*! \file mln/trait/concrete.hh
*
* \brief Definition of the concrete image trait.
*/
Index: mln/trait/images.hh
--- mln/trait/images.hh (revision 1263)
+++ mln/trait/images.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_TRAIT_IMAGES_HH
# define MLN_TRAIT_IMAGES_HH
-/*! \file mln/core/trait/images.hh
+/*! \file mln/trait/images.hh
*
* \brief Forward declarations of all image types.
*
@@ -38,6 +38,8 @@
# include <iostream>
# include <string>
+# include <mln/trait/undef.hh>
+# include <mln/trait/image/props.hh>
# include <mln/value/props.hh>
# include <mln/metal/bexpr.hh>
@@ -65,15 +67,15 @@
// for io: I const => read_only, otherwise like I
# define mln_trait_image_io_from_(I) \
-mlc_if( mlc_is_const(I), mln::trait::io::read_only, mln_trait_image_io(I) )
+mlc_if( mlc_is_const(I), mln::trait::image::io::read_only, mln_trait_image_io(I) )
// for data: if raw or linear => stored, otherwise like I (i.e., either stored or computed)
#define mln_trait_image_data_from_(I) typename \
mln::metal::if_< mln::metal::or_< mlc_equal( mln_trait_image_data(I), \
- mln::trait::data::raw), \
+ mln::trait::image::data::raw), \
mlc_equal( mln_trait_image_data(I), \
- mln::trait::data::linear) >, \
- mln::trait::data::stored, \
+ mln::trait::image::data::linear) >, \
+ mln::trait::image::data::stored, \
mln_trait_image_data(I) >::ret
@@ -102,8 +104,6 @@
namespace trait
{
- struct undef { std::string str() const { return "undef"; } };
-
template <typename I>
struct undefined_image_
@@ -137,141 +137,6 @@
};
-
- struct category
- {
- struct any {};
- struct primary : any { std::string str() const { return "category::primary"; } };
- struct morpher : any {};
- struct domain_morpher
- : morpher { std::string str() const { return "category::domain_morpher"; } };
- struct value_morpher
- : morpher { std::string str() const { return "category::value_morpher"; } };
- struct identity_morpher
- : morpher { std::string str() const { return "category::identity_morpher"; } };
- };
-
- struct data
- {
- struct any {};
- struct computed : any { std::string str() const { return "data::computed"; } };
- struct stored : any { std::string str() const { return "data::stored"; } };
- struct linear
- : stored { std::string str() const { return "data::linear"; } };
- struct raw
- : linear { std::string str() const { return "data::raw"; } };
- };
-
- struct quant
- {
- struct any {};
- struct low : any { std::string str() const { return "quant::low"; } };
- struct high : any { std::string str() const { return "quant::high"; } };
- };
-
- struct value
- {
- struct any {};
- struct scalar : any { std::string str() const { return "value::scalar"; } };
- struct vectorial : any { std::string str() const { return "value::vectorial"; } };
- struct structed : any { std::string str() const { return "value::structed"; } };
- struct pointer : any { std::string str() const { return "value::pointer"; } };
-
- struct fixme // So FIXME!
- : any { std::string str() const { return "space::fixme"; } };
- };
-
-
- struct access
- {
- struct any {};
- struct random : any { std::string str() const { return "access::random"; } };
- struct browsing : any { std::string str() const { return "access::browsing"; } };
- };
-
- struct space
- {
- struct any {};
- struct one_d : any { std::string str() const { return "space::one_d"; } };
- struct two_d : any { std::string str() const { return "space::two_d"; } };
- struct three_d : any { std::string str() const { return "space::three_d"; } };
-
- struct fixme_ // So FIXME!
- : any { std::string str() const { return "space::fixme_"; } };
- };
-
- struct size
- {
- struct any {};
- struct huge : any { std::string str() const { return "size::huge"; } };
- struct regular : any { std::string str() const { return "size::regular"; } };
- };
-
- struct support
- {
- struct any {};
- struct irregular : any { std::string str() const { return "support::irregular"; } };
- struct regular : any { std::string str() const { return "support::regular"; } };
- struct aligned
- : regular { std::string str() const { return "support::aligned"; } };
-
- struct fixme_ // So FIXME!
- : any { std::string str() const { return "support::fixme_"; } };
- };
-
- struct border
- {
- struct any {};
- struct none : any { std::string str() const { return "border::none"; } };
- struct stored : any { std::string str() const { return "border::stored"; } };
- struct computed : any { std::string str() const { return "border::computed"; } };
- };
-
- struct io
- {
- struct any {};
- struct read : virtual any {};
- struct write : virtual any {};
- struct read_only
- : read { std::string str() const { return "io::read_only"; } };
- struct write_only
- : write { std::string str() const { return "io::write_only"; } };
- struct read_write
- : read, write { std::string str() const { return "io::read_write"; } };
- };
-
- struct speed
- {
- struct any {};
- struct slow : any { std::string str() const { return "speed::slow"; } };
- struct fast : any { std::string str() const { return "speed::fast"; } };
- struct fastest
- : fast { std::string str() const { return "speed::fastest"; } };
- };
-
-
-
- template <typename I>
- void print(std::ostream& ostr)
- {
- typedef image_<I> the;
- ostr << "{ "
- << typename the::category().str() << ", "
- << typename the::data().str() << ", "
- << typename the::kind().str() << ", "
- << typename the::quant().str() << ", "
- << typename the::value().str() << ", "
- << typename the::access().str() << ", "
- << typename the::space().str() << ", "
- << typename the::size().str() << ", "
- << typename the::support().str() << ", "
- << typename the::border().str() << ", "
- << typename the::io().str() << ", "
- << typename the::speed().str() << " }" << std::endl;
- }
-
-
-
template <typename T, typename I>
struct default_image_ : undefined_image_<I>
{
@@ -279,11 +144,13 @@
typedef metal::bool_<( mln_value_card_(T) = 0 )> is_high_quant_;
public:
typedef mln_value_kind(T) kind;
- typedef mlc_if( is_high_quant_, trait::quant::high, trait::quant::low ) quant;
+ typedef mlc_if( is_high_quant_,
+ trait::image::quant::high,
+ trait::image::quant::low ) quant;
// FIXME: typedef undef value; // scalar, vectorial, structed
// speed is fast by default (neither "fastest" nor "slow")
- typedef trait::speed::fast speed;
+ typedef trait::image::speed::fast speed;
};
@@ -313,4 +180,7 @@
} // end of namespace mln
+# include <mln/trait/image/print.hh>
+
+
#endif // ! MLN_TRAIT_IMAGES_HH
Index: mln/trait/value_.hh
--- mln/trait/value_.hh (revision 0)
+++ mln/trait/value_.hh (revision 0)
@@ -0,0 +1,80 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_TRAIT_VALUE__HH
+# define MLN_TRAIT_VALUE__HH
+
+/*! \file mln/trait/images.hh
+ *
+ * \brief Forward declarations of all image types.
+ *
+ * \todo Split this file into many.
+ */
+
+# include <iostream>
+# include <string>
+
+# include <mln/trait/undef.hh>
+
+# include <mln/trait/value/nature.hh>
+# include <mln/trait/value/kind.hh>
+
+
+# define mln_trait_value_nature(I) typename mln::trait::value_< V >::nature
+# define mln_trait_value_kind(V) typename mln::trait::value_< V >::kind
+
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+
+ template <typename V>
+ struct undefined_value_
+ {
+ typedef undef nature;
+ typedef undef kind;
+ };
+
+
+ template <typename V>
+ struct value_ : undefined_value_<V>
+ {
+ };
+
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+# include <mln/trait/value/print.hh>
+
+
+#endif // ! MLN_TRAIT_VALUE__HH
Index: mln/trait/value/kind.hh
--- mln/trait/value/kind.hh (revision 0)
+++ mln/trait/value/kind.hh (working copy)
@@ -25,15 +25,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_TRAIT_KIND_HH
-# define MLN_TRAIT_KIND_HH
+#ifndef MLN_TRAIT_VALUE_KIND_HH
+# define MLN_TRAIT_VALUE_KIND_HH
-/*! \file mln/core/trait/kind.hh
+/*! \file mln/trait/value/kind.hh
*
- * \brief Kind of values in images.
+ * \brief Kind of values (for use in images).
*/
-# include <iostream>
# include <string>
@@ -43,19 +42,28 @@
namespace trait
{
+ namespace value
+ {
+
struct kind
{
- struct color { std::string str() const { return "kind::color"; } };
- struct gray { std::string str() const { return "kind::gray"; } };
- struct label { std::string str() const { return "kind::label"; } };
- struct logic : label { std::string str() const { return "kind::logic"; } };
- struct binary : logic { std::string str() const { return "kind::binary"; } };
- struct data { std::string str() const { return "kind::data"; } };
+ struct any { std::string name() const { return "kind::any"; } };
+
+ struct color : any { std::string name() const { return "kind::color"; } };
+ struct gray : any { std::string name() const { return "kind::gray"; } };
+
+ struct label : any { std::string name() const { return "kind::label"; } };
+ struct logic : label { std::string name() const { return "kind::logic"; } };
+ struct binary : logic { std::string name() const { return "kind::binary"; } };
+
+ struct data : any { std::string name() const { return "kind::data"; } };
};
+ } // end of namespace mln::trait::kind
+
} // end of namespace mln::trait
} // end of namespace mln
-#endif // ! MLN_TRAIT_KIND_HH
+#endif // ! MLN_TRAIT_VALUE_KIND_HH
Index: mln/trait/value/print.hh
--- mln/trait/value/print.hh (revision 0)
+++ mln/trait/value/print.hh (revision 0)
@@ -0,0 +1,80 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_TRAIT_VALUE_PRINT_HH
+# define MLN_TRAIT_VALUE_PRINT_HH
+
+/*! \file mln/trait/values.hh
+ *
+ * \brief Print the collection of traits for an value type.
+ */
+
+# include <iostream>
+# include <mln/trait/value_.hh>
+# include <mln/metal/is_a.hh>
+
+
+
+namespace mln
+{
+
+ // Fwd decl.
+ template <typename E> struct Value;
+
+
+ namespace trait
+ {
+
+ namespace value
+ {
+
+ template <typename V>
+ void print(std::ostream& ostr);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename V>
+ void print(std::ostream& ostr)
+ {
+ mlc_is_a(V, Value)::check();
+ typedef mln::trait::value_<V> the;
+ ostr << "{ "
+ << typename the::nature().name() << ", "
+ << typename the::kind() .name() << " }" << std::endl;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::trait::value
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+#endif // ! MLN_TRAIT_VALUE_PRINT_HH
Index: mln/trait/value/nature.hh
--- mln/trait/value/nature.hh (revision 0)
+++ mln/trait/value/nature.hh (revision 0)
@@ -0,0 +1,68 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_TRAIT_VALUE_NATURE_HH
+# define MLN_TRAIT_VALUE_NATURE_HH
+
+/*! \file mln/trait/value/nature.hh
+ *
+ * \brief Nature of values (for use in images).
+ */
+
+# include <string>
+
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+ namespace value
+ {
+
+ struct nature
+ {
+ struct any { std::string name() const { return "nature::any"; } };
+
+ struct scalar : any { std::string name() const { return "nature::scalar"; } };
+ struct integer : scalar { std::string name() const { return "nature::integer"; } };
+ struct floating : scalar { std::string name() const { return "nature::floating"; } };
+
+ struct vectorial : any { std::string name() const { return "nature::vectorial"; } };
+ struct symbolic : any { std::string name() const { return "nature::symbolic"; } };
+ struct structured : any { std::string name() const { return "nature::structured"; } };
+ };
+
+ } // end of namespace mln::trait::value
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+#endif // ! MLN_TRAIT_VALUE_NATURE_HH
Index: mln/histo/compute.hh
--- mln/histo/compute.hh (revision 1263)
+++ mln/histo/compute.hh (working copy)
@@ -54,7 +54,7 @@
{
template <typename I>
- data<mln_vset(I)> compute(mln::trait::speed::any, const I& input)
+ data<mln_vset(I)> compute(trait::image::speed::any, const I& input)
{
data<mln_vset(I)> h(input.values());
mln_piter(I) p(input.domain());
@@ -64,7 +64,7 @@
}
template <typename I>
- data<mln_vset(I)> compute(mln::trait::speed::fastest, const I& input)
+ data<mln_vset(I)> compute(trait::image::speed::fastest, const I& input)
{
data<mln_vset(I)> h(input.values());
mln_pixter(const I) p(input);
Index: mln/debug/iota.hh
--- mln/debug/iota.hh (revision 1263)
+++ mln/debug/iota.hh (working copy)
@@ -53,7 +53,7 @@
{
template <typename I>
- void iota(mln::trait::speed::any, I& input)
+ void iota(trait::image::speed::any, I& input)
{
unsigned i = 0;
mln_piter(I) p(input.domain());
@@ -62,7 +62,7 @@
}
template <typename I>
- void iota(mln::trait::speed::fastest, I& input)
+ void iota(trait::image::speed::fastest, I& input)
{
unsigned i = 0;
mln_pixter(I) p(input);
Index: mln/debug/println_with_border.hh
--- mln/debug/println_with_border.hh (revision 1263)
+++ mln/debug/println_with_border.hh (working copy)
@@ -114,7 +114,7 @@
template <typename I>
void println_with_border(const Image<I>& input)
{
- mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
+ mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
impl::println_with_border(exact(input).bbox(), exact(input));
}
Index: mln/core/internal/image_if_base.hh
--- mln/core/internal/image_if_base.hh (revision 1263)
+++ mln/core/internal/image_if_base.hh (working copy)
@@ -72,17 +72,17 @@
{
private:
typedef mln_trait_image_data(I) I_data_;
- typedef mlc_equal(I_data_, trait::data::linear) I_data_are_linear_;
+ typedef mlc_equal(I_data_, trait::image::data::linear) I_data_are_linear_;
public:
- typedef trait::category::domain_morpher category;
+ typedef trait::image::category::domain_morpher category;
typedef mlc_if( mlc_is_const(I),
- trait::io::read_only, // I const => read_only
+ trait::image::io::read_only, // I const => read_only
mln_trait_image_io(I) ) io; // otherwise like I
typedef mlc_if( I_data_are_linear_,
- trait::data::stored, // if linear then just stored
+ trait::image::data::stored, // if linear then just stored
I_data_ ) data; // otherwise like I
};
Index: mln/core/internal/check/image_all.hh
--- mln/core/internal/check/image_all.hh (revision 1263)
+++ mln/core/internal/check/image_all.hh (working copy)
@@ -53,7 +53,7 @@
struct image_all_
:
public image_fastest_< E, typename mlc_equal(mln_trait_image_speed(E),
- trait::speed::fastest)::eval >
+ trait::image::speed::fastest)::eval >
// , ...
{
};
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1263)
+++ mln/core/image2d_b.hh (working copy)
@@ -87,17 +87,17 @@
template <typename T>
struct image_< image2d_b<T> > : default_image_< T, image2d_b<T> >
{
- typedef trait::category::primary category;
+ typedef trait::image::category::primary category;
- typedef trait::access::random access;
- typedef trait::space::two_d space;
- typedef trait::size::regular size;
- typedef trait::support::aligned support;
-
- typedef trait::border::stored border;
- typedef trait::data::raw data;
- typedef trait::io::read_write io;
- typedef trait::speed::fastest speed;
+ typedef trait::image::access::random access;
+ typedef trait::image::space::two_d space;
+ typedef trait::image::size::regular size;
+ typedef trait::image::support::aligned support;
+
+ typedef trait::image::border::stored border;
+ typedef trait::image::data::raw data;
+ typedef trait::image::io::read_write io;
+ typedef trait::image::speed::fastest speed;
};
} // end of namespace mln::trait
Index: mln/core/sub_image.hh
--- mln/core/sub_image.hh (revision 1263)
+++ mln/core/sub_image.hh (working copy)
@@ -67,9 +67,9 @@
// typedef mlc_equal(I_data_, trait::data::linear) I_data_are_linear_;
// public:
- typedef trait::category::domain_morpher category;
+ typedef trait::image::category::domain_morpher category;
- typedef trait::border::none border; // no more accessible border
+ typedef trait::image::border::none border; // no more accessible border
typedef mln_trait_image_io_from_(I) io; // un-write when I const
Index: mln/core/concept/value.hh
--- mln/core/concept/value.hh (revision 1263)
+++ mln/core/concept/value.hh (working copy)
@@ -33,6 +33,7 @@
*/
# include <mln/core/concept/object.hh>
+# include <mln/trait/value_.hh>
namespace mln
Index: mln/core/image1d_b.hh
--- mln/core/image1d_b.hh (revision 1263)
+++ mln/core/image1d_b.hh (working copy)
@@ -88,17 +88,17 @@
template <typename T>
struct image_< image1d_b<T> > : default_image_< T, image1d_b<T> >
{
- typedef trait::category::primary category;
+ typedef trait::image::category::primary category;
- typedef trait::access::random access;
- typedef trait::space::one_d space;
- typedef trait::size::regular size;
- typedef trait::support::aligned support;
-
- typedef trait::border::stored border;
- typedef trait::data::raw data;
- typedef trait::io::read_write io;
- typedef trait::speed::fastest speed;
+ typedef trait::image::access::random access;
+ typedef trait::image::space::one_d space;
+ typedef trait::image::size::regular size;
+ typedef trait::image::support::aligned support;
+
+ typedef trait::image::border::stored border;
+ typedef trait::image::data::raw data;
+ typedef trait::image::io::read_write io;
+ typedef trait::image::speed::fastest speed;
};
} // end of namespace mln::trait
Index: mln/core/image3d_b.hh
--- mln/core/image3d_b.hh (revision 1263)
+++ mln/core/image3d_b.hh (working copy)
@@ -89,17 +89,17 @@
template <typename T>
struct image_< image3d_b<T> > : default_image_< T, image3d_b<T> >
{
- typedef trait::category::primary category;
+ typedef trait::image::category::primary category;
- typedef trait::access::random access;
- typedef trait::space::three_d space;
- typedef trait::size::regular size;
- typedef trait::support::aligned support;
-
- typedef trait::border::stored border;
- typedef trait::data::raw data;
- typedef trait::io::read_write io;
- typedef trait::speed::fastest speed;
+ typedef trait::image::access::random access;
+ typedef trait::image::space::three_d space;
+ typedef trait::image::size::regular size;
+ typedef trait::image::support::aligned support;
+
+ typedef trait::image::border::stored border;
+ typedef trait::image::data::raw data;
+ typedef trait::image::io::read_write io;
+ typedef trait::image::speed::fastest speed;
};
} // end of namespace mln::trait
Index: mln/metal/mat.hh
--- mln/metal/mat.hh (revision 1263)
+++ mln/metal/mat.hh (working copy)
@@ -150,7 +150,7 @@
template <unsigned n, unsigned m, typename T>
struct props< metal::mat<n,m,T> >
{
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = n * m * mln_card_(T);
typedef metal::mat<n,m, mln_value_sum(T)> sum;
};
Index: mln/metal/vec.hh
--- mln/metal/vec.hh (revision 1263)
+++ mln/metal/vec.hh (working copy)
@@ -229,7 +229,7 @@
template <unsigned n, typename T>
struct props< metal::vec<n,T> >
{
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = n * mln_card_(T);
typedef metal::vec<n, mln_value_sum(T)> sum;
};
Index: mln/arith/plus.hh
--- mln/arith/plus.hh (revision 1263)
+++ mln/arith/plus.hh (working copy)
@@ -107,9 +107,9 @@
{
template <typename L, typename R, typename O>
- void plus_(mln::trait::speed::any, const L& lhs,
- mln::trait::speed::any, const R& rhs,
- mln::trait::speed::any, O& output)
+ void plus_(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs,
+ trait::image::speed::any, O& output)
{
mln_piter(L) p(lhs.domain());
for_all(p)
@@ -117,9 +117,9 @@
}
template <typename L, typename R, typename O>
- void plus_(mln::trait::speed::fastest, const L& lhs,
- mln::trait::speed::fastest, const R& rhs,
- mln::trait::speed::fastest, O& output)
+ void plus_(trait::image::speed::fastest, const L& lhs,
+ trait::image::speed::fastest, const R& rhs,
+ trait::image::speed::fastest, O& output)
{
mln_pixter(const L) lp(lhs);
mln_pixter(const R) rp(rhs);
@@ -129,8 +129,8 @@
}
template <typename L, typename R>
- void plus_inplace_(mln::trait::speed::any, L& lhs,
- mln::trait::speed::any, const R& rhs)
+ void plus_inplace_(trait::image::speed::any, L& lhs,
+ trait::image::speed::any, const R& rhs)
{
mln_piter(R) p(rhs.domain());
for_all(p)
@@ -138,8 +138,8 @@
}
template <typename L, typename R>
- void plus_inplace_(mln::trait::speed::fastest, L& lhs,
- mln::trait::speed::fastest, const R& rhs)
+ void plus_inplace_(trait::image::speed::fastest, L& lhs,
+ trait::image::speed::fastest, const R& rhs)
{
mln_pixter(L) lp(lhs);
mln_pixter(const R) rp(rhs);
@@ -178,9 +178,8 @@
void plus_cst(const Image<I>& input, const V& val, Image<O>& output)
{
mln_precondition(exact(output).domain() = exact(input).domain());
- trait::speed::any any;
impl::plus_(mln_trait_image_speed(I)(), exact(input),
- any, pw::cst(val) | exact(input).domain(),
+ trait::image::speed::any(), pw::cst(val) | exact(input).domain(),
mln_trait_image_speed(O)(), exact(output)); // Calls the previous version.
}
@@ -196,9 +195,8 @@
void plus_cst_inplace(Image<I>& input, const V& val)
{
mln_precondition(exact(input).has_data());
- trait::speed::any any;
plus_inplace(mln_trait_image_speed(I)(), exact(input),
- any, pw::cst(val) | exact(input).domain());
+ trait::image::speed::any(), pw::cst(val) | exact(input).domain());
// Calls the previous version.
}
Index: mln/arith/min.hh
--- mln/arith/min.hh (revision 1263)
+++ mln/arith/min.hh (working copy)
@@ -76,9 +76,9 @@
{
template <typename L, typename R, typename O>
- void min_(mln::trait::speed::any, const L& lhs,
- mln::trait::speed::any, const R& rhs,
- mln::trait::speed::any, O& output)
+ void min_(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs,
+ trait::image::speed::any, O& output)
{
mln_piter(L) p(lhs.domain());
for_all(p)
@@ -86,9 +86,9 @@
}
template <typename L, typename R, typename O>
- void min_(mln::trait::speed::fastest, const L& lhs,
- mln::trait::speed::fastest, const R& rhs,
- mln::trait::speed::fastest, O& output)
+ void min_(trait::image::speed::fastest, const L& lhs,
+ trait::image::speed::fastest, const R& rhs,
+ trait::image::speed::fastest, O& output)
{
mln_pixter(const L) lp(lhs);
mln_pixter(const R) rp(rhs);
@@ -98,8 +98,8 @@
}
template <typename L, typename R>
- void min_inplace_(mln::trait::speed::any, L& lhs,
- mln::trait::speed::any, const R& rhs)
+ void min_inplace_(trait::image::speed::any, L& lhs,
+ trait::image::speed::any, const R& rhs)
{
mln_piter(R) p(rhs.domain());
for_all(p)
@@ -108,8 +108,8 @@
}
template <typename L, typename R>
- void min_inplace_(mln::trait::speed::fastest, L& lhs,
- mln::trait::speed::fastest, const R& rhs)
+ void min_inplace_(trait::image::speed::fastest, L& lhs,
+ trait::image::speed::fastest, const R& rhs)
{
mln_pixter(L) lp(lhs);
mln_pixter(const R) rp(rhs);
Index: mln/arith/revert.hh
--- mln/arith/revert.hh (revision 1263)
+++ mln/arith/revert.hh (working copy)
@@ -78,8 +78,8 @@
{
template <typename I, typename O>
- void revert_(mln::trait::speed::any, const I& input,
- mln::trait::speed::any, O& output)
+ void revert_(trait::image::speed::any, const I& input,
+ trait::image::speed::any, O& output)
{
typedef mln_value(I) V;
mln_piter(I) p(input.domain());
@@ -88,8 +88,8 @@
}
template <typename I, typename O>
- void revert_(mln::trait::speed::fastest, const I& input,
- mln::trait::speed::fastest, O& output)
+ void revert_(trait::image::speed::fastest, const I& input,
+ trait::image::speed::fastest, O& output)
{
typedef mln_value(I) V;
mln_pixter(const I) ip(input);
Index: mln/arith/minus.hh
--- mln/arith/minus.hh (revision 1263)
+++ mln/arith/minus.hh (working copy)
@@ -75,9 +75,9 @@
{
template <typename L, typename R, typename O>
- void minus_(mln::trait::speed::any, const L& lhs,
- mln::trait::speed::any, const R& rhs,
- mln::trait::speed::any, O& output)
+ void minus_(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs,
+ trait::image::speed::any, O& output)
{
mln_piter(L) p(lhs.domain());
for_all(p)
@@ -85,9 +85,9 @@
}
template <typename L, typename R, typename O>
- void minus_(mln::trait::speed::fastest, const L& lhs,
- mln::trait::speed::fastest, const R& rhs,
- mln::trait::speed::fastest, O& output)
+ void minus_(trait::image::speed::fastest, const L& lhs,
+ trait::image::speed::fastest, const R& rhs,
+ trait::image::speed::fastest, O& output)
{
mln_pixter(const L) lp(lhs);
mln_pixter(const R) rp(rhs);
@@ -97,8 +97,8 @@
}
template <typename L, typename R>
- void minus_inplace_(mln::trait::speed::any, L& lhs,
- mln::trait::speed::any, const R& rhs)
+ void minus_inplace_(trait::image::speed::any, L& lhs,
+ trait::image::speed::any, const R& rhs)
{
mln_piter(R) p(rhs.domain());
for_all(p)
@@ -106,8 +106,8 @@
}
template <typename L, typename R>
- void minus_inplace_(mln::trait::speed::fastest, L& lhs,
- mln::trait::speed::fastest, const R& rhs)
+ void minus_inplace_(trait::image::speed::fastest, L& lhs,
+ trait::image::speed::fastest, const R& rhs)
{
mln_pixter(L) lp(lhs);
mln_pixter(const R) rp(rhs);
Index: mln/level/take.hh
--- mln/level/take.hh (revision 1263)
+++ mln/level/take.hh (working copy)
@@ -63,7 +63,7 @@
{
template <typename A, typename I>
- void take(mln::trait::speed::any, const I& input, A& a)
+ void take(trait::image::speed::any, const I& input, A& a)
{
mln_piter(I) p(input.domain());
for_all(p)
@@ -71,7 +71,7 @@
}
template <typename A, typename I>
- void take(mln::trait::speed::fastest, const I& input, A& a)
+ void take(trait::image::speed::fastest, const I& input, A& a)
{
mln_pixter(const I) pxl(input);
for_all(pxl)
Index: mln/level/assign.hh
--- mln/level/assign.hh (revision 1263)
+++ mln/level/assign.hh (working copy)
@@ -65,8 +65,8 @@
{
template <typename L, typename R>
- void assign(mln::trait::speed::any, L& target,
- mln::trait::speed::any, const R& data)
+ void assign(trait::image::speed::any, L& target,
+ trait::image::speed::any, const R& data)
{
mln_piter(L) p(target.domain());
for_all(p)
@@ -74,8 +74,8 @@
}
template <typename L, typename R>
- void assign(mln::trait::speed::fastest, L& target,
- mln::trait::speed::fastest, const R& data)
+ void assign(trait::image::speed::fastest, L& target,
+ trait::image::speed::fastest, const R& data)
{
mln_pixter(L) lhs(target);
mln_pixter(const R) rhs(data);
Index: mln/level/apply.hh
--- mln/level/apply.hh (revision 1263)
+++ mln/level/apply.hh (working copy)
@@ -67,7 +67,7 @@
{
template <typename I, typename F>
- void apply_(mln::trait::speed::any, I& input, const F& f)
+ void apply_(trait::image::speed::any, I& input, const F& f)
{
mln_piter(I) p(input.domain());
for_all(p)
@@ -75,7 +75,7 @@
}
template <typename I, typename F>
- void apply_(mln::trait::speed::fastest, I& input, const F& f)
+ void apply_(trait::image::speed::fastest, I& input, const F& f)
{
mln_pixter(I) pxl(input);
for_all(pxl)
Index: mln/level/fill.hh
--- mln/level/fill.hh (revision 1263)
+++ mln/level/fill.hh (working copy)
@@ -132,7 +132,7 @@
// fill_with_value
template <typename I>
- void fill_with_value(mln::trait::speed::any, I& ima,
+ void fill_with_value(trait::image::speed::any, I& ima,
const mln_value(I)& value)
{
mln_piter(I) p(ima.domain());
@@ -141,7 +141,7 @@
}
template <typename I>
- void fill_with_value(mln::trait::speed::fastest, I& ima,
+ void fill_with_value(trait::image::speed::fastest, I& ima,
const mln_value(I)& value)
{
level::memset_(ima, ima.point_at_offset(0), value, ima.ncells());
@@ -157,7 +157,7 @@
template <typename I>
void fill(Image<I>& ima, const mln_value(I)& value)
{
- mlc_is(mln_trait_image_io(I), trait::io::write)::check(); // FIXME: Only the upcoming general facade!!!
+ mlc_is(mln_trait_image_io(I), trait::image::io::write)::check(); // FIXME: Only the upcoming general facade!!!
mln_precondition(exact(ima).has_data());
impl::fill_with_value(mln_trait_image_speed(I)(), exact(ima),
value);
Index: mln/level/memset_.hh
--- mln/level/memset_.hh (revision 1263)
+++ mln/level/memset_.hh (working copy)
@@ -114,7 +114,7 @@
void memset_(I& input, const mln_point(I)& p,
const mln_value(I)& v, std::size_t n)
{
- mlc_is(mln_trait_image_speed(I), trait::speed::fastest)::check();
+ mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
mln_precondition(input.has_data());
mln_precondition(input.owns_(p));
Index: mln/level/median.hh
--- mln/level/median.hh (revision 1263)
+++ mln/level/median.hh (working copy)
@@ -283,8 +283,8 @@
{
trace::entering("level::median_dir");
- mlc_is(mln_trait_image_io(O), trait::io::write)::check();
- mlc_is(mln_trait_image_support(I), trait::support::aligned)::check();
+ mlc_is(mln_trait_image_io(O), trait::image::io::write)::check();
+ mlc_is(mln_trait_image_support(I), trait::image::support::aligned)::check();
mlc_converts_to(mln_value(I), mln_value(O))::check();
mln_precondition(exact(output).domain() = exact(input).domain());
Index: mln/level/paste.spe.hh
--- mln/level/paste.spe.hh (revision 1263)
+++ mln/level/paste.spe.hh (working copy)
@@ -79,15 +79,15 @@
// Remember: raw < linear < stored, computed.
template <typename I, typename J>
- void paste_(mln::trait::data::any, const I& data,
- mln::trait::data::any, J& destination)
+ void paste_(trait::image::data::any, const I& data,
+ trait::image::data::any, J& destination)
{
generic::paste_(data, destination);
}
template <typename I, typename J>
- void paste_(mln::trait::data::raw, const I& data,
- mln::trait::data::raw, J& destination)
+ void paste_(trait::image::data::raw, const I& data,
+ trait::image::data::raw, J& destination)
{
if (sizeof(mln_value(I)) = sizeof(mln_value(J)))
paste_lines_(data, destination);
Index: mln/level/paste.hh
--- mln/level/paste.hh (revision 1263)
+++ mln/level/paste.hh (working copy)
@@ -103,7 +103,7 @@
J& destination = exact(destination_);
trace::entering("level::paste");
- mlc_is(mln_trait_image_io(J), trait::io::write)::check();
+ mlc_is(mln_trait_image_io(J), trait::image::io::write)::check();
mlc_converts_to(mln_value(I), mln_value(J))::check();
mln_precondition(data.domain() <= destination.domain());
Index: mln/linear/convolve.hh
--- mln/linear/convolve.hh (revision 1263)
+++ mln/linear/convolve.hh (working copy)
@@ -67,9 +67,9 @@
{
template <typename I, typename W, typename O>
- void convolve_(mln::trait::speed::any, const I& input,
+ void convolve_(trait::image::speed::any, const I& input,
const Weighted_Window<W>& w_win_,
- mln::trait::speed::any, O& output)
+ trait::image::speed::any, O& output)
{
const W& w_win = exact(w_win_);
@@ -86,9 +86,9 @@
}
template <typename I, typename W, typename O>
- void convolve_(mln::trait::speed::fastest, const I& input,
+ void convolve_(trait::image::speed::fastest, const I& input,
const Weighted_Window<W>& w_win_,
- mln::trait::speed::fastest, O& output)
+ trait::image::speed::fastest, O& output)
{
const W& w_win = exact(w_win_);
Index: mln/linear/local/convolve.hh
--- mln/linear/local/convolve.hh (revision 1263)
+++ mln/linear/local/convolve.hh (working copy)
@@ -87,7 +87,7 @@
{
template <typename I, typename P, typename W, typename R>
- void convolve(mln::trait::speed::any, const I& input,
+ void convolve(trait::image::speed::any, const I& input,
const Generalized_Point<P>& p_,
const W& w_win,
R& result)
@@ -102,7 +102,7 @@
}
template <typename I, typename P, typename W, typename R>
- void convolve(mln::trait::speed::fastest, const I& input,
+ void convolve(trait::image::speed::fastest, const I& input,
const Generalized_Point<P>& p_,
const W& w_win,
R& result)
Index: mln/value/graylevel.hh
--- mln/value/graylevel.hh (revision 1263)
+++ mln/value/graylevel.hh (working copy)
@@ -90,7 +90,7 @@
static const graylevel<n> min() { return 0; }
static const graylevel<n> max() { return card_ - 1; }
static const unsigned nbits = n;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
typedef int interop;
};
Index: mln/value/float01_.hh
--- mln/value/float01_.hh (revision 1263)
+++ mln/value/float01_.hh (working copy)
@@ -118,7 +118,7 @@
static const int min() { return 0; }
static const int max() { return 1; }
static const unsigned nbits = n;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
typedef float interop;
};
Index: mln/value/int_s.hh
--- mln/value/int_s.hh (revision 1263)
+++ mln/value/int_s.hh (working copy)
@@ -149,7 +149,7 @@
static const int_s<n> max() { return metal::pow<2, n-1>::value - 1; }
static const int_s<n> min() { return - max(); }
static const unsigned nbits = n;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
};
Index: mln/value/int_u.hh
--- mln/value/int_u.hh (revision 1263)
+++ mln/value/int_u.hh (working copy)
@@ -80,6 +80,13 @@
// FIXME: Is that all? (No!)
+ template <unsigned n>
+ struct value_< mln::value::int_u<n> >
+ {
+ typedef trait::value::nature::integer nature;
+ typedef trait::value::kind::data kind;
+ };
+
} // end of namespace mln::trait
@@ -142,7 +149,7 @@
static const int_u<n> min() { return 0; }
static const int_u<n> max() { return card_ - 1; }
static const unsigned nbits = n;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
typedef int interop;
};
Index: mln/value/int_u_sat.hh
--- mln/value/int_u_sat.hh (revision 1263)
+++ mln/value/int_u_sat.hh (working copy)
@@ -104,7 +104,7 @@
static const int_u_sat<n> min() { return 0; }
static const int_u_sat<n> max() { return card_ - 1; }
static const unsigned nbits = n;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
};
Index: mln/value/props.hh
--- mln/value/props.hh (revision 1263)
+++ mln/value/props.hh (working copy)
@@ -40,7 +40,7 @@
# include <mln/core/macros.hh>
# include <mln/metal/bool.hh>
-# include <mln/trait/kind.hh>
+# include <mln/trait/value/kind.hh>
/// Get the minimum value of type \c T.
@@ -85,7 +85,7 @@
template <typename T>
struct props
{
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = 0;
};
@@ -117,7 +117,7 @@
static const bool min() { return false; }
static const bool max() { return true; }
static const std::size_t card_ = 2;
- typedef trait::kind::binary kind;
+ typedef trait::value::kind::binary kind;
};
@@ -129,7 +129,7 @@
static const unsigned char min() { return 0; }
static const unsigned char max() { return 255; }
static const std::size_t card_ = 256;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
};
@@ -139,7 +139,7 @@
static const signed char min() { return -128; }
static const signed char max() { return 127; }
static const std::size_t card_ = 256;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
};
@@ -149,7 +149,7 @@
static const unsigned short min() { return 0; }
static const unsigned short max() { return 65535; }
static const std::size_t card_ = 65536;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
};
@@ -159,7 +159,7 @@
static const signed short min() { return -32768; }
static const signed short max() { return 32767; }
static const std::size_t card_ = 65536;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
};
@@ -168,7 +168,7 @@
{
static const unsigned int min() { return 0; }
static const unsigned int max() { return UINT_MAX; }
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = 0;
typedef float sum;
};
@@ -178,7 +178,7 @@
{
static const signed int min() { return INT_MIN; }
static const signed int max() { return INT_MAX; }
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = 0;
typedef float sum;
};
@@ -188,7 +188,7 @@
{
static const unsigned long int min() { return 0; }
static const unsigned long int max() { return ULONG_MAX; }
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = 0;
typedef float sum;
};
@@ -198,7 +198,7 @@
{
static const signed long int min() { return LONG_MIN; }
static const signed long int max() { return LONG_MAX; }
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = 0;
typedef float sum;
};
@@ -212,7 +212,7 @@
static const float min() { return FLT_MIN; }
static const float max() { return FLT_MAX; }
static const float epsilon() { return 0.00001f; }
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = 0;
typedef float sum;
};
@@ -223,7 +223,7 @@
static const double min() { return DBL_MIN; }
static const double max() { return DBL_MAX; }
static const double epsilon() { return 0.0000001; }
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
static const std::size_t card_ = 0;
typedef double sum;
};
Index: mln/value/rgb.hh
--- mln/value/rgb.hh (revision 1263)
+++ mln/value/rgb.hh (working copy)
@@ -134,7 +134,7 @@
{
static const unsigned nbits = 24;
static const std::size_t card_ = 0; // FIXME: was: metal::pow<2, nbits>::value;
- typedef trait::kind::color kind;
+ typedef trait::value::kind::color kind;
typedef float_x3_t sum;
typedef uchar_x3_t interop;
Index: mln/value/rgb8_non_templated.hh
--- mln/value/rgb8_non_templated.hh (revision 1263)
+++ mln/value/rgb8_non_templated.hh (working copy)
@@ -106,7 +106,7 @@
{
static const unsigned nbits = 24;
static const std::size_t card_ = metal::pow<2, nbits>::value;
- typedef trait::kind::color kind;
+ typedef trait::value::kind::color kind;
typedef float_x3_t sum;
typedef uchar_x3_t interop;
};
Index: mln/value/float01_f.hh
--- mln/value/float01_f.hh (revision 1263)
+++ mln/value/float01_f.hh (working copy)
@@ -78,7 +78,7 @@
static const float min() { return 0; }
static const float max() { return 1; }
//static const unsigned nbits = n;
- typedef trait::kind::data kind;
+ typedef trait::value::kind::data kind;
typedef float sum;
typedef float interop;
};
Index: mln/value/label.hh
--- mln/value/label.hh (revision 1263)
+++ mln/value/label.hh (working copy)
@@ -133,7 +133,7 @@
static const label<n> min; // = 0
static const label<n> max; // = card_ - 1
static const unsigned nbits = n;
- typedef trait::kind::label kind;
+ typedef trait::value::kind::label kind;
};
Index: mln/border/resize.hh
--- mln/border/resize.hh (revision 1263)
+++ mln/border/resize.hh (working copy)
@@ -65,7 +65,7 @@
template <typename I>
void resize(const Image<I>& ima_, unsigned thickness)
{
- mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
+ mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
if (ima.border() >= thickness)
Index: mln/border/fill.hh
--- mln/border/fill.hh (revision 1263)
+++ mln/border/fill.hh (working copy)
@@ -111,7 +111,7 @@
typedef mln_point(I) P;
const I& ima = exact(ima_);
- mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
+ mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
mln_precondition(ima.has_data());
if (!ima.border ())
return;
Index: mln/border/duplicate.hh
--- mln/border/duplicate.hh (revision 1263)
+++ mln/border/duplicate.hh (working copy)
@@ -190,7 +190,7 @@
template <typename I>
void duplicate(const Image<I>& ima_)
{
- mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
+ mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
const I& ima = exact(ima_);
typedef mln_point(I) P;
trace::entering("border::duplicate");
Index: mln/border/mirror.hh
--- mln/border/mirror.hh (revision 1263)
+++ mln/border/mirror.hh (working copy)
@@ -63,7 +63,7 @@
{
const I& ima = exact(ima_);
- mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
+ mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
mln_precondition(ima.has_data());
mln::internal::fixme();
Index: mln/border/get.hh
--- mln/border/get.hh (revision 1263)
+++ mln/border/get.hh (working copy)
@@ -69,13 +69,13 @@
}
template <typename I>
- unsigned get_(mln::trait::speed::any, const I& ima)
+ unsigned get_(trait::image::speed::any, const I& ima)
{
return border::impl::get__(ima);
}
template <typename I>
- unsigned get_(mln::trait::speed::fastest, const I& ima)
+ unsigned get_(trait::image::speed::fastest, const I& ima)
{
return ima.border();
}
Index: mln/test/predicate.hh
--- mln/test/predicate.hh (revision 1263)
+++ mln/test/predicate.hh (working copy)
@@ -69,7 +69,7 @@
{
template <typename I, typename F>
- bool predicate_(mln::trait::speed::any, const I& ima_, const F& f)
+ bool predicate_(trait::image::speed::any, const I& ima_, const F& f)
{
const I& ima = exact(ima_);
mln_piter(I) p(ima.domain());
@@ -80,7 +80,7 @@
}
template <typename I, typename F>
- bool predicate_(mln::trait::speed::fastest, const I& ima_, const F& f)
+ bool predicate_(trait::image::speed::fastest, const I& ima_, const F& f)
{
const I& ima = exact(ima_);
mln_pixter(const I) pxl(ima);
Index: mln/pw/image.hh
--- mln/pw/image.hh (revision 1263)
+++ mln/pw/image.hh (working copy)
@@ -81,18 +81,18 @@
struct image_< pw::image<F,S> > : default_image_< mlc_unqualif(mln_result(F)),
pw::image<F,S> >
{
- typedef trait::category::primary category;
+ typedef trait::image::category::primary category;
- typedef trait::value::fixme value;
+ typedef trait::image::value::fixme value;
- typedef trait::access::browsing access;
- typedef trait::space::fixme_ space;
- typedef trait::size::regular size;
- typedef trait::support::fixme_ support;
-
- typedef trait::border::none border;
- typedef trait::data::computed data;
- typedef trait::io::read_only io;
+ typedef trait::image::access::browsing access;
+ typedef trait::image::space::fixme_ space;
+ typedef trait::image::size::regular size;
+ typedef trait::image::support::fixme_ support;
+
+ typedef trait::image::border::none border;
+ typedef trait::image::data::computed data;
+ typedef trait::image::io::read_only io;
};
} // end of namespace mln::trait
Index: mln/morpho/min.hh
--- mln/morpho/min.hh (revision 1263)
+++ mln/morpho/min.hh (working copy)
@@ -60,7 +60,7 @@
{
template <typename I, typename J, typename O>
- void min_(trait::kind::logic, // binary => morphology on sets
+ void min_(trait::image::kind::logic, // binary => morphology on sets
const Image<I>& lhs, const Image<J>& rhs,
Image<O>& output)
{
@@ -78,7 +78,7 @@
// in place
template <typename I, typename J>
- void min_inplace_(trait::kind::logic, // binary => morphology on sets
+ void min_inplace_(trait::image::kind::logic, // binary => morphology on sets
Image<I>& lhs, const Image<J>& rhs)
{
return logical::and_inplace(lhs, rhs);
Index: mln/morpho/plus.hh
--- mln/morpho/plus.hh (revision 1263)
+++ mln/morpho/plus.hh (working copy)
@@ -60,7 +60,7 @@
{
template <typename I, typename J, typename O>
- void plus_(trait::kind::logic, // binary => morphology on sets
+ void plus_(trait::image::kind::logic, // binary => morphology on sets
const Image<I>& lhs, const Image<J>& rhs,
Image<O>& output)
{
Index: mln/morpho/minus.hh
--- mln/morpho/minus.hh (revision 1263)
+++ mln/morpho/minus.hh (working copy)
@@ -60,7 +60,7 @@
{
template <typename I, typename J, typename O>
- void minus_(trait::kind::logic, // binary => morphology on sets
+ void minus_(trait::image::kind::logic, // binary => morphology on sets
const Image<I>& lhs, const Image<J>& rhs,
Image<O>& output)
{
Index: mln/morpho/complementation.hh
--- mln/morpho/complementation.hh (revision 1263)
+++ mln/morpho/complementation.hh (working copy)
@@ -61,7 +61,7 @@
{
template <typename I, typename O>
- void complementation_(trait::kind::logic, // binary => morphology on sets
+ void complementation_(trait::image::kind::logic, // binary => morphology on sets
const Image<I>& input,
Image<O>& output)
{
Index: mln/morpho/dilation.hh
--- mln/morpho/dilation.hh (revision 1263)
+++ mln/morpho/dilation.hh (working copy)
@@ -112,7 +112,7 @@
// Stage 2: dispatch w.r.t. the value kind.
template <typename I, typename W, typename O>
- void dilation_wrt_value(trait::kind::logic, // binary => morphology on sets
+ void dilation_wrt_value(trait::image::kind::logic, // binary => morphology on sets
const Image<I>& input, const Window<W>& win, Image<O>& output)
{
return impl::dilation_on_set(exact(input), exact(win), output);
Index: mln/morpho/erosion.hh
--- mln/morpho/erosion.hh (revision 1263)
+++ mln/morpho/erosion.hh (working copy)
@@ -115,7 +115,7 @@
// Stage 2: dispatch w.r.t. the value kind.
template <typename I, typename W, typename O>
- void erosion_wrt_value(trait::kind::logic, // binary => morphology on sets
+ void erosion_wrt_value(trait::image::kind::logic, // binary => morphology on sets
const Image<I>& input, const Window<W>& win, Image<O>& output)
{
return impl::erosion_on_set(exact(input), exact(win), output);
Index: mln/morpho/hit_or_miss.hh
--- mln/morpho/hit_or_miss.hh (revision 1263)
+++ mln/morpho/hit_or_miss.hh (working copy)
@@ -115,7 +115,7 @@
// On sets.
template <typename I, typename Wh, typename Wm, typename O>
- void hit_or_miss_(trait::kind::logic, // binary => morphology on sets
+ void hit_or_miss_(trait::image::kind::logic, // binary => morphology on sets
const Image<I>& input,
const Window<Wh>& win_hit, const Window<Wm>& win_miss,
Image<O>& output)
Index: mln/io/internal/pnm/save.hh
--- mln/io/internal/pnm/save.hh (revision 1263)
+++ mln/io/internal/pnm/save.hh (working copy)
@@ -139,7 +139,7 @@
// caller for fastest images
template <typename I>
void save_data_(std::ofstream& file,
- mln::trait::speed::fastest, const I& ima)
+ trait::image::speed::fastest, const I& ima)
{
if (sizeof(value::int_u8) = 1)
save_data_contiguous(file, ima);
@@ -150,7 +150,7 @@
// caller for non fastest images
template <typename I>
void save_data_(std::ofstream& file,
- mln::trait::speed::any, const I& ima)
+ trait::image::speed::any, const I& ima)
{
save_data_uncontiguous(file, ima);
}
Index: mln/logical/and.hh
--- mln/logical/and.hh (revision 1263)
+++ mln/logical/and.hh (working copy)
@@ -77,9 +77,9 @@
{
template <typename L, typename R, typename O>
- void and__(mln::trait::speed::any, const L& lhs,
- mln::trait::speed::any, const R& rhs,
- mln::trait::speed::any, O& output)
+ void and__(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs,
+ trait::image::speed::any, O& output)
{
mln_piter(L) p(lhs.domain());
for_all(p)
@@ -87,9 +87,9 @@
}
template <typename L, typename R, typename O>
- void and__(mln::trait::speed::fastest, const L& lhs,
- mln::trait::speed::fastest, const R& rhs,
- mln::trait::speed::fastest, O& output)
+ void and__(trait::image::speed::fastest, const L& lhs,
+ trait::image::speed::fastest, const R& rhs,
+ trait::image::speed::fastest, O& output)
{
mln_pixter(const L) lp(lhs);
mln_pixter(const R) rp(rhs);
Index: mln/logical/and_not.hh
--- mln/logical/and_not.hh (revision 1263)
+++ mln/logical/and_not.hh (working copy)
@@ -77,9 +77,9 @@
{
template <typename L, typename R, typename O>
- void and_not_(mln::trait::speed::any, const L& lhs,
- mln::trait::speed::any, const R& rhs,
- mln::trait::speed::any, O& output)
+ void and_not_(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs,
+ trait::image::speed::any, O& output)
{
mln_piter(L) p(lhs.domain());
for_all(p)
@@ -87,9 +87,9 @@
}
template <typename L, typename R, typename O>
- void and_not_(mln::trait::speed::fastest, const L& lhs,
- mln::trait::speed::fastest, const R& rhs,
- mln::trait::speed::fastest, O& output)
+ void and_not_(trait::image::speed::fastest, const L& lhs,
+ trait::image::speed::fastest, const R& rhs,
+ trait::image::speed::fastest, O& output)
{
mln_pixter(const L) lp(lhs);
mln_pixter(const R) rp(rhs);
Index: mln/logical/or.hh
--- mln/logical/or.hh (revision 1263)
+++ mln/logical/or.hh (working copy)
@@ -77,9 +77,9 @@
{
template <typename L, typename R, typename O>
- void or__(mln::trait::speed::any, const L& lhs,
- mln::trait::speed::any, const R& rhs,
- mln::trait::speed::any, O& output)
+ void or__(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs,
+ trait::image::speed::any, O& output)
{
mln_piter(L) p(lhs.domain());
for_all(p)
@@ -87,9 +87,9 @@
}
template <typename L, typename R, typename O>
- void or__(mln::trait::speed::fastest, const L& lhs,
- mln::trait::speed::fastest, const R& rhs,
- mln::trait::speed::fastest, O& output)
+ void or__(trait::image::speed::fastest, const L& lhs,
+ trait::image::speed::fastest, const R& rhs,
+ trait::image::speed::fastest, O& output)
{
mln_pixter(const L) lp(lhs);
mln_pixter(const R) rp(rhs);
Index: mln/logical/not.hh
--- mln/logical/not.hh (revision 1263)
+++ mln/logical/not.hh (working copy)
@@ -73,8 +73,8 @@
{
template <typename I, typename O>
- void not__(mln::trait::speed::any, const I& input,
- mln::trait::speed::any, O& output)
+ void not__(trait::image::speed::any, const I& input,
+ trait::image::speed::any, O& output)
{
mln_piter(I) p(input.domain());
for_all(p)
@@ -82,8 +82,8 @@
}
template <typename I, typename O>
- void not__(mln::trait::speed::fastest, const I& input,
- mln::trait::speed::fastest, O& output)
+ void not__(trait::image::speed::fastest, const I& input,
+ trait::image::speed::fastest, O& output)
{
mln_pixter(const I) ip(input);
mln_pixter(O) op(output);
Index: mln/labeling/level.hh
--- mln/labeling/level.hh (revision 1263)
+++ mln/labeling/level.hh (working copy)
@@ -96,9 +96,9 @@
// Routines.
template <typename I, typename N, typename O>
- bool level_(mln::trait::speed::any, const I& input,
+ bool level_(trait::image::speed::any, const I& input,
const mln_value(I)& val, const Neighborhood<N>& nbh,
- mln::trait::speed::any, O& output, unsigned& nlabels)
+ trait::image::speed::any, O& output, unsigned& nlabels)
{
typedef impl::level_t<I,N,O> F;
F f(input, val, exact(nbh), output);
@@ -132,9 +132,9 @@
template <typename I, typename N, typename O>
- bool level_(mln::trait::speed::fastest, const I& input,
+ bool level_(trait::image::speed::fastest, const I& input,
const mln_value(I)& val, const Neighborhood<N>& nbh,
- mln::trait::speed::fastest, O& output, unsigned& nlabels)
+ trait::image::speed::fastest, O& output, unsigned& nlabels)
{
typedef level_fast_t<I,N,O> F;
F f(input, val, exact(nbh), output);
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Fix println in 3d.
* mln/debug/println.hh: Fix.
---
println.hh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Index: trunk/milena/mln/debug/println.hh
===================================================================
--- trunk/milena/mln/debug/println.hh (revision 1262)
+++ trunk/milena/mln/debug/println.hh (revision 1263)
@@ -102,15 +102,15 @@
int& row = p.row();
int& col = p.col();
const int
- min_sli = b.min_sli(),
max_row = b.max_row(),
+ max_sli = b.max_sli(),
max_col = b.max_col();
- for (row = b.min_row(); row <= max_row; ++row)
+ for (sli = b.min_sli(); sli <= max_sli; ++sli)
{
- for (sli = b.max_sli(); sli >= min_sli; --sli)
+ for (row = b.min_row(); row <= max_row; ++row)
{
- for (int i = min_sli; i <= sli; ++i)
+ for (int i = max_row; i >= row; --i)
std::cout << ' ';
for (col = b.min_col(); col <= max_col; ++col)
if (input.has(p))
@@ -128,8 +128,8 @@
} // end of namespace mln::debug::impl
+ // Facade.
- // facade
template <typename I>
void println(const Image<I>& input)
{
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Get rid of the Fastest_Image concept class.
* mln/core/concept/fastest_image.hh: Remove.
* mln/core/internal/impl: New.
* mln/core/internal/image_base.hh (image_impled_): Remove;
merge with image_checked_.
* mln/core/internal/check/image_fastest.hh: Fix doc.
(offset_at): New; copy from the now removed concept class.
* mln/core/image2d_b.hh: Remove dead code.
* mln/core/concept/image.hh: Remove obsolete include.
* mln/core/concept/doc/fastest_image.hh: Rename as...
* mln/core/concept/doc/image_fastest.hh: ...this.
Update.
* mln/level/median.hh: Fix text.
* mln/level/transform.hh: Likewise.
* mln/border/resize.hh: Update sig.
* mln/border/duplicate.hh: Likewise.
* mln/morpho/erosion_fast.hh: Update text.
* mln/morpho/dilation_fast.hh: Likewise.
* tests/canvas_browsing_fwd.cc: Augment.
* tests/image2d_b.cc (check_fastest): Remove; obsolete.
mln/border/duplicate.hh | 13 ++++++----
mln/border/resize.hh | 6 ++--
mln/core/concept/doc/image_fastest.hh | 11 +++++---
mln/core/concept/image.hh | 2 -
mln/core/image2d_b.hh | 13 ----------
mln/core/internal/check/image_fastest.hh | 40 +++++++++++++++++++++++++++----
mln/core/internal/image_base.hh | 40 +++----------------------------
mln/level/median.hh | 2 -
mln/level/transform.hh | 4 ++-
mln/morpho/dilation_fast.hh | 2 -
mln/morpho/erosion_fast.hh | 2 -
tests/canvas_browsing_fwd.cc | 18 +++++++++++++
tests/image2d_b.cc | 7 -----
13 files changed, 81 insertions(+), 79 deletions(-)
Index: tests/image2d_b.cc
--- tests/image2d_b.cc (revision 1261)
+++ tests/image2d_b.cc (working copy)
@@ -36,11 +36,6 @@
#include <mln/core/init.hh>
-template <typename I>
-void check_fastest(const mln::Fastest_Image<I>&)
-{
-}
-
int main()
{
@@ -54,6 +49,4 @@
mln_assertion(f.npoints() = geom::nrows(f) * geom::ncols(f));
mln_assertion(f.ncells() = (nrows + 2 * border) * (ncols + 2 * border));
-
- check_fastest(f);
}
Index: tests/canvas_browsing_fwd.cc
--- tests/canvas_browsing_fwd.cc (revision 1261)
+++ tests/canvas_browsing_fwd.cc (working copy)
@@ -107,7 +107,25 @@
my_test(ima2, fun::p2v::iota, canvas::browsing::snake_fwd);
debug::println(ima2);
+
+ level::fill(ima2, 0);
+ my_test(ima2, fun::p2v::iota, canvas::browsing::directional, 0);
+ debug::println(ima2);
+
+ level::fill(ima2, 0);
+ my_test(ima2, fun::p2v::iota, canvas::browsing::directional, 1);
+ debug::println(ima2);
+
+
+ level::fill(ima3, 0);
+ my_test(ima3, fun::p2v::iota, canvas::browsing::directional, 0);
+ debug::println(ima3);
+
level::fill(ima3, 0);
my_test(ima3, fun::p2v::iota, canvas::browsing::directional, 1);
debug::println(ima3);
+
+ level::fill(ima3, 0);
+ my_test(ima3, fun::p2v::iota, canvas::browsing::directional, 2);
+ debug::println(ima3);
}
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 1261)
+++ mln/core/internal/image_base.hh (working copy)
@@ -35,6 +35,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/grids.hh>
+# include <mln/core/trait/qlf_value.hh>
# include <mln/core/internal/check/image_all.hh>
# include <mln/util/tracked_ptr.hh>
@@ -78,48 +79,15 @@
};
- /*! \brief Selector for image inheritance (fastest or not fastest).
- *
- * \internal
- */
- template <typename Is_fastest, typename E>
- struct select_image_concept_;
-
- template <typename E>
- struct select_image_concept_< metal::true_, E >
- : public Fastest_Image<E>
- {};
-
- template <typename E>
- struct select_image_concept_< metal::false_, E >
- : public Image<E>
- {};
-
-
-
template <typename E>
struct image_checked_
:
public check::image_all_<E>,
-
- // FIXME: first check impl w.r.t. properties, then:
- public select_image_concept_< typename mlc_equal(mln_trait_image_speed(E),
- trait::speed::fastest)::eval,
- E > // FIXME: Change to Image<E>
+ public Image<E>
{
};
- template <typename E>
- struct image_impled_
- :
- // FIXME: first fetch default impl w.r.t. properties, then:
- image_checked_<E>
- {
- };
-
-
-
/*! \brief A base class for images.
*
* Parameter \p S is a point set type.
@@ -129,7 +97,7 @@
template <typename S, typename E>
struct image_base_
:
- public image_impled_<E>
+ public image_checked_<E>
{
/// Point_Set associated type.
@@ -206,7 +174,7 @@
template <typename S, typename E>
image_base_<S,E>::image_base_(const image_base_& rhs)
- : image_impled_<E>()
+ : image_checked_<E>()
{
mln_precondition(exact(rhs).has_data()); // FIXME: Is-it too restrictive?
this->data_ = rhs.data_;
Index: mln/core/internal/check/image_fastest.hh
--- mln/core/internal/check/image_fastest.hh (revision 1261)
+++ mln/core/internal/check/image_fastest.hh (working copy)
@@ -28,11 +28,14 @@
#ifndef MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
# define MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
-/*! \file mln/core/concept/fastest_image.hh
- * \brief Definition of the concept of mln::Fastest_Image.
+/*! \file mln/core/internal/check/image_fastest.hh
+ *
+ * \brief Class that statically checks the interface of fastest
+ * images.
*/
+
namespace mln
{
@@ -43,13 +46,24 @@
{
/*! \brief FIXME
- *
- * \see mln::doc::Fastest_Image for a complete documentation of this
- * class contents.
*/
template < typename E, typename B = metal::true_ >
struct image_fastest_
{
+
+ /*! \brief Give the offset of the point \p p.
+ *
+ * \param[in] p A generalized point.
+ *
+ * \warning This method is final.
+ *
+ * \pre The image has to be initialized and to own the point \p p.
+ * \post p = point_at_offset(result)
+ */
+ template <typename P>
+ unsigned
+ offset_at(const Generalized_Point<P>& p) const;
+
protected:
image_fastest_();
};
@@ -101,6 +115,22 @@
// FIXME: how to check that qixter are defined when W is unknown!
}
+ template <typename E, typename B>
+ template <typename P>
+ unsigned // FIXME: std::size_t?
+ image_fastest_<E,B>::offset_at(const Generalized_Point<P>& p_) const
+ {
+ // FIXME: check that P is mln_point(E)
+ const E* this_ = & internal::force_exact<E>(*this);
+ const P& p = internal::force_exact<P>(p_);
+ mln_precondition(this_->has_data());
+ mln_precondition(this_->owns_(p));
+
+ unsigned o = & this_->operator()(p) - this_->buffer();
+ mln_postcondition(p = this_->point_at_offset(o));
+ return o;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::internal::check
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1261)
+++ mln/core/image2d_b.hh (working copy)
@@ -104,19 +104,6 @@
-// namespace trait
-// {
-
-// template <typename T>
-// struct is_fast< image2d_b<T> >
-// {
-// typedef metal::true_ ret;
-// };
-
-// } // end of mln::trait
-
-
-
/*! \brief Basic 2D image class.
*
* The parameter \c T is the type of pixel values. This image class
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 1261)
+++ mln/core/concept/image.hh (working copy)
@@ -196,7 +196,5 @@
} // end of namespace mln
-# include <mln/core/concept/fastest_image.hh>
-
#endif // ! MLN_CORE_CONCEPT_IMAGE_HH
Index: mln/core/concept/doc/image_fastest.hh
--- mln/core/concept/doc/image_fastest.hh (revision 1256)
+++ mln/core/concept/doc/image_fastest.hh (working copy)
@@ -25,18 +25,21 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file mln/core/concept/doc/fastest_image.hh
- * \brief This file documents the concept of mln::Fastest_Image.
+/*! \file mln/core/concept/doc/image_fastest.hh
+ *
+ * \brief This file documents the concept of images that have the
+ * speed property set to "fastest".
*/
+
namespace mln
{
namespace doc
{
- /*! \brief Documentation class for mln::Fastest_Image.
- * \see mln::Fastest_Image
+ /*! \brief Documentation class for the concept of images that have
+ * the speed property set to "fastest".
*/
template <typename E>
struct Fastest_Image : public Image<E>
Index: mln/level/median.hh
--- mln/level/median.hh (revision 1261)
+++ mln/level/median.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Median filtering of an image.
*
- * \todo Add Fastest_Image versions.
+ * \todo Add versions for fastest and semi-linear images.
*/
# include <mln/core/concept/image.hh>
Index: mln/level/transform.hh
--- mln/level/transform.hh (revision 1261)
+++ mln/level/transform.hh (working copy)
@@ -98,9 +98,11 @@
}
+ // FIXME: Handle the cases of fastest images.
+
// template <typename I, typename F, typename O>
// void transform(metal::true_, // low quantization
-// const Fastest_Image<I>& input_, const Function_v2v<F>& f_, Image<O>& output_)
+// const Image<I>& input_, const Function_v2v<F>& f_, Image<O>& output_)
// {
// const I& input = exact(input_);
// const F& f = exact(f_);
Index: mln/border/resize.hh
--- mln/border/resize.hh (revision 1261)
+++ mln/border/resize.hh (working copy)
@@ -57,17 +57,17 @@
* \todo Implement it.
*/
template <typename I>
- void resize(const Fastest_Image<I>& ima, unsigned thickness);
+ void resize(const Image<I>& ima, unsigned thickness);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- void resize(const Fastest_Image<I>& ima_, unsigned thickness)
+ void resize(const Image<I>& ima_, unsigned thickness)
{
+ mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
- mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
if (ima.border() >= thickness)
return;
mln::internal::fixme();
Index: mln/border/duplicate.hh
--- mln/border/duplicate.hh (revision 1261)
+++ mln/border/duplicate.hh (working copy)
@@ -120,7 +120,7 @@
}
template <typename I>
- void duplicate_3d_(const Fastest_Image<I>& ima_)
+ void duplicate_3d_(const Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -188,22 +188,25 @@
// Facade.
template <typename I>
- void duplicate(const Fastest_Image<I>& ima_)
+ void duplicate(const Image<I>& ima_)
{
- trace::entering("border::duplicate");
- typedef mln_point(I) P;
+ mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
const I& ima = exact(ima_);
+ typedef mln_point(I) P;
+ trace::entering("border::duplicate");
+
mln_precondition(ima.has_data());
- mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
if (!ima.border ())
return;
+
if (P::dim = 1)
impl::duplicate_1d_(ima);
if (P::dim = 2)
impl::duplicate_2d_(ima);
if (P::dim = 3)
impl::duplicate_3d_(ima);
+
trace::exiting("border::duplicate");
}
Index: mln/morpho/erosion_fast.hh
--- mln/morpho/erosion_fast.hh (revision 1261)
+++ mln/morpho/erosion_fast.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Ero filtering of an image.
*
- * \todo Add Fastest_Image versions.
+ * \todo Add fastest versions.
*/
# include <mln/core/concept/image.hh>
Index: mln/morpho/dilation_fast.hh
--- mln/morpho/dilation_fast.hh (revision 1261)
+++ mln/morpho/dilation_fast.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Ero filtering of an image.
*
- * \todo Add Fastest_Image versions.
+ * \todo Add fastest versions.
*/
# include <mln/core/concept/image.hh>
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add test for chamfer.
* chamfer.cc: Test for chamfer.
---
chamfer.cc | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
Index: trunk/milena/tests/chamfer.cc
===================================================================
--- trunk/milena/tests/chamfer.cc (revision 0)
+++ trunk/milena/tests/chamfer.cc (revision 1261)
@@ -0,0 +1,81 @@
+// Copyright (C) 2007 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, 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/chamfer.cc
+ *
+ * \brief Tests on all files in mln/geom/chamfer.hh .
+ */
+
+#include <mln/core/image2d_b.hh>
+#include <mln/core/sub_image.hh>
+#include <mln/core/image_if_value.hh>
+#include <mln/core/inplace.hh>
+
+#include <mln/level/fill.hh>
+# include <mln/debug/println.hh>
+# include <mln/core/w_window2d_int.hh>
+# include <mln/core/w_window2d_float.hh>
+# include <mln/core/image_if_interval.hh>
+
+# include <mln/make/win_chamfer.hh>
+# include <mln/geom/chamfer.hh>
+
+int main()
+{
+ using namespace mln;
+ unsigned max = 51;
+
+ image2d_b<bool> ima(9, 9);
+
+ {
+ level::fill(ima, false);
+ ima.at(4,4) = true;
+ const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 0> ();
+ image2d_b<unsigned> out = geom::chamfer(ima, w_win, max);
+ debug::println(out | value::interval(0, 8));
+ }
+
+ {
+ level::fill(ima, false);
+ ima.at(4,4) = true;
+ const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 3> ();
+ image2d_b<unsigned> out = geom::chamfer(ima, w_win, max);
+ debug::println(out | value::interval(0, 8));
+ }
+
+ {
+ level::fill(ima, false);
+ ima.at(4,4) = true;
+ const w_window2d_int& w_win = win_chamfer::mk_chamfer_5x5_int<4, 6, 9> ();
+ image2d_b<unsigned> out = geom::chamfer(ima, w_win, max);
+ image2d_b<unsigned>::fwd_piter p(out.domain());
+ for_all(p)
+ out(p) = out(p) / 2;
+ debug::println(out | value::interval(0, 8));
+ }
+
+}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add canvas for chamfer.
* canvas/chamfer.hh: New canvas for chamfer.
* geom/chamfer.hh: New.
* make/win_chamfer.hh: New.
---
canvas/chamfer.hh | 98 ++++++++++++++++++++++++++++++++++++++++
geom/chamfer.hh | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++
make/win_chamfer.hh | 69 ++++++++++++++++++++++++++++
3 files changed, 293 insertions(+)
Index: trunk/milena/mln/make/win_chamfer.hh
===================================================================
--- trunk/milena/mln/make/win_chamfer.hh (revision 0)
+++ trunk/milena/mln/make/win_chamfer.hh (revision 1260)
@@ -0,0 +1,69 @@
+# include <mln/core/w_window2d_int.hh>
+# include <mln/core/w_window2d_float.hh>
+# include <math.h>
+
+namespace mln
+{
+ namespace win_chamfer
+ {
+
+ template<int d10, int d11>
+ const w_window2d_int
+ mk_chamfer_3x3_int()
+ {
+ int ws[] = { d11, d10, d11,
+ d10, 0, 0,
+ 0, 0, 0 };
+
+ return (make::w_window2d(ws));
+ }
+
+ template<int d10, int d11, int d21>
+ const w_window2d_int
+ mk_chamfer_5x5_int()
+ {
+ int ws[] = { 0, d21, 0, d21, 0,
+ d21, d11, d10, d11, d21,
+ 0, d10, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0 };
+
+ return (make::w_window2d(ws));
+ }
+
+ const w_window2d_float
+ mk_chamfer_3x3_float(float d10, float d11)
+ {
+ float ws[] = { d11, d10, d11,
+ d10, 0, 0,
+ 0, 0, 0 };
+
+ return (make::w_window2d(ws));
+ }
+
+ const w_window2d_float
+ mk_chamfer_5x5_float(float d10, float d11, float d21)
+ {
+ float ws[] = { 0, d21, 0, d21, 0,
+ d21, d11, d10, d11, d21,
+ 0, d10, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0 };
+
+ return (make::w_window2d(ws));
+ }
+
+ const w_window2d_float
+ mk_chamfer_exact()
+ {
+ float r2 = sqrt(2);
+ float ws[] = { r2, 1, r2,
+ 1, 0, 0,
+ 0, 0, 0 };
+
+ return (make::w_window2d(ws));
+ }
+
+ } // end of mln::win_chamfer
+
+} // end of mln
Index: trunk/milena/mln/geom/chamfer.hh
===================================================================
--- trunk/milena/mln/geom/chamfer.hh (revision 0)
+++ trunk/milena/mln/geom/chamfer.hh (revision 1260)
@@ -0,0 +1,126 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_GEOM_CHAMFER_HH
+# define MLN_GEOM_CHAMFER_HH
+
+/*! \file mln/geom/chamfer.hh
+ *
+ * \brief Connected component chamfer of the image objects.
+ */
+
+# include <mln/level/fill.hh>
+# include <mln/core/w_window2d_int.hh>
+# include <mln/core/w_window2d_float.hh>
+
+# include <mln/canvas/chamfer.hh>
+
+namespace mln
+{
+
+ namespace geom
+ {
+
+
+ template <typename I, typename W>
+ mln_ch_value( I, unsigned )
+ chamfer(const Image<I>& input_, const W& w_win_,
+ unsigned max = mln_max(unsigned));
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Functors.
+
+ template <typename I_, typename W_>
+ struct chamfer_t
+ {
+ typedef I_ I;
+ typedef W_ W;
+ typedef mln_point(I_) P;
+
+ // requirements from mln::canvas::chamfer:
+
+ const I& input;
+ const W& win;
+
+ mln_ch_value(I_, unsigned) output;
+ bool status;
+ unsigned max;
+
+ void init() { initialize(output, exact(input));
+ level::fill(inplace(output | (input | true).domain()), 0);
+ level::fill(inplace(output | (input | false).domain()), max); }
+ bool handles(const P& p) const { return input(p) == false; }
+
+ // end of requirements
+
+ chamfer_t(const I_& input, const W_& win, unsigned max)
+ : input (input),
+ win (win),
+ max (max)
+ {}
+ };
+
+ // Routines.
+
+ template <typename I, typename W>
+ mln_ch_value(I, unsigned)
+ chamfer_(const Image<I>& input_, const W& w_win_,
+ unsigned max = mln_max(unsigned))
+ {
+ typedef chamfer_t<I, W> F;
+
+ F f(exact(input_), exact(w_win_), max);
+ canvas::chamfer<F> run(f);
+ return f.output;
+ }
+
+ } // end of namespace mln::geom::impl
+
+#endif // !MLN_INCLUDE_ONLY
+
+
+ // Facade.
+
+ template <typename I, typename W>
+ mln_ch_value(I, unsigned)
+ chamfer(const Image<I>& input_, const W& w_win_,
+ unsigned max = mln_max(unsigned))
+ {
+ return impl::chamfer_(exact (input_), exact(w_win_), max);
+ }
+
+
+ } // end of namespace mln::geom
+
+} // end of namespace mln
+
+#endif // !MLN_GEOM_CHAMFER_HH
Index: trunk/milena/mln/canvas/chamfer.hh
===================================================================
--- trunk/milena/mln/canvas/chamfer.hh (revision 0)
+++ trunk/milena/mln/canvas/chamfer.hh (revision 1260)
@@ -0,0 +1,98 @@
+// Copyright (C) 2007 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, 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.
+
+#ifndef MLN_CANVAS_CHAMFER_HH
+# define MLN_CANVAS_CHAMFER_HH
+
+/*! \file mln/canvas/chamfer.hh
+ *
+ * \brief Connected component chamfer of the object part in a binary
+ * image.
+ */
+
+namespace mln
+{
+ namespace canvas
+ {
+
+ template <typename F>
+ struct chamfer
+ {
+ F& f;
+
+ typedef typename F::I I;
+ typedef typename F::W W;
+ typedef mln_point(I) point;
+
+ chamfer(F& f)
+ : f(f)
+ {
+ run();
+ }
+
+ void run()
+ {
+ /// Init.
+ {
+ f.init();
+ }
+
+ /// Fwd pass.
+ {
+ mln_fwd_piter(I) p(f.input.domain());
+ mln_qiter(W) q(f.win, p);
+
+ for_all(p) if (f.handles (p))
+ for_all(q) if (f.input.has(q))
+ if (f.output(q) != f.max
+ && f.output(q) + q.w() < f.output(p))
+ f.output(p) = f.output(q) + q.w();
+ }
+
+ /// Bkd pass.
+ {
+ W w_win_b = geom::sym(f.win);
+
+ mln_bkd_piter(I) p(f.input.domain());
+ mln_qiter(W) q(w_win_b, p);
+
+ for_all(p) if (f.handles (p))
+ for_all(q) if (f.input.has(q))
+ if (f.output(q) != f.max
+ && f.output(q) + q.w() < f.output(p))
+ f.output(p) = f.output(q) + q.w();
+ f.status = true;
+ }
+
+ }
+ };
+
+ } // end of mln::canvas
+
+} // end of mln
+
+#endif // ! MLN_CANVAS_CHAMFER_HH
1
0