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
ChangeLog:
2007-09-21 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update tests with new println.
* labeling_level.hh,
* labeling_level_fast_10000x1000.cc,
* labeling_level_generic_10000x1000.cc,
* test_border_duplicate_image3d_1.cc,
* test_border_duplicate_image3d_2.cc,
* test_border_duplicate_image3d_3.cc,
* test_border_duplicate_image3d_4.cc,
* test_border_fill_image3d_1.cc,
* test_border_fill_image3d_2.cc,
* test_border_fill_image3d_3.cc,
* test_border_fill_image3d_4.cc,
* test_debug_iota_3d.cc: Update.
---
labeling_level.hh | 18 ++++++++++--------
labeling_level_fast_10000x1000.cc | 4 ++--
labeling_level_generic_10000x1000.cc | 4 ++--
test_border_duplicate_image3d_1.cc | 4 ++--
test_border_duplicate_image3d_2.cc | 4 ++--
test_border_duplicate_image3d_3.cc | 4 ++--
test_border_duplicate_image3d_4.cc | 5 +++--
test_border_fill_image3d_1.cc | 4 ++--
test_border_fill_image3d_2.cc | 7 +++----
test_border_fill_image3d_3.cc | 4 ++--
test_border_fill_image3d_4.cc | 4 ++--
test_debug_iota_3d.cc | 8 ++++----
12 files changed, 36 insertions(+), 34 deletions(-)
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc (revision 1149)
@@ -30,7 +30,7 @@
* \brief Tests on mln::border::fill.
*/
-#include "debug_print_3d_with_border.hh"
+#include <mln/debug/println_with_border.hh>
#include "border_fill.hh"
#include <mln/core/image3d_b.hh>
#include <mln/value/int_u8.hh>
@@ -46,6 +46,6 @@
<< std::endl;
image3d_b<value::int_u8> i4(2, 3, 1, 2);
border::fill (i4, 7);
- debug::print_3d_with_border(i4);
+ debug::println_with_border(i4);
std::cout << std::endl;
}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc (revision 1149)
@@ -30,10 +30,10 @@
* \brief Tests on mln::border::fill.
*/
-#include "debug_print_3d_with_border.hh"
#include "border_fill.hh"
#include <mln/core/image3d_b.hh>
#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
using namespace mln;
@@ -48,6 +48,6 @@
box3d b(make::point3d(2, 6, 1), make::point3d(3, 8, 3));
image3d_b<value::int_u8> i4(b, 1);
border::fill (i4, 2);
- debug::print_3d_with_border(i4);
+ debug::println_with_border(i4);
std::cout << std::endl;
}
Index: trunk/milena/sandbox/duhamel/labeling_level_generic_10000x1000.cc
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_level_generic_10000x1000.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/labeling_level_generic_10000x1000.cc (revision 1149)
@@ -52,8 +52,8 @@
unsigned border = 1;
- image2d_b<value::int_u8> i1(10000, 1000, border);
- i1[10009] = i1[10010] = 2;
+ image2d_b<value::int_u8> i1(1000, 1000, border);
+ i1[1009] = i1[1010] = 2;
unsigned n;
image2d_b<value::int_u8> out(i1.domain(), border);
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_1.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_1.cc (revision 1149)
@@ -30,11 +30,11 @@
* \brief Tests on mln::border::fill.
*/
-#include "debug_print_3d_with_border.hh"
#include "border_duplicate.hh"
#include <mln/core/image3d_b.hh>
#include <mln/value/int_u8.hh>
#include <mln/debug/iota.hh>
+#include <mln/debug/println_with_border.hh>
using namespace mln;
@@ -48,6 +48,6 @@
image3d_b<value::int_u8> ima(2, 3, 1, 2);
debug::iota (ima);
border::duplicate (ima);
- debug::print_3d_with_border(ima);
+ debug::println_with_border(ima);
std::cout << std::endl;
}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_3.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_3.cc (revision 1149)
@@ -31,11 +31,11 @@
*/
-#include "debug_print_3d_with_border.hh"
#include "border_duplicate.hh"
#include <mln/core/image3d_b.hh>
#include <mln/value/int_u8.hh>
#include <mln/debug/iota.hh>
+#include <mln/debug/println_with_border.hh>
using namespace mln;
@@ -51,6 +51,6 @@
image3d_b<value::int_u8> ima(b, 1);
debug::iota (ima);
border::duplicate (ima);
- debug::print_3d_with_border(ima);
+ debug::println_with_border(ima);
std::cout << std::endl;
}
Index: trunk/milena/sandbox/duhamel/labeling_level_fast_10000x1000.cc
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_level_fast_10000x1000.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/labeling_level_fast_10000x1000.cc (revision 1149)
@@ -52,8 +52,8 @@
unsigned border = 1;
- image2d_b<value::int_u8> i1(10000, 1000, border);
- i1[10009] = i1[10010] = 2;
+ image2d_b<value::int_u8> i1(1000, 1000, border);
+ i1[1009] = i1[1010] = 2;
unsigned n;
image2d_b<value::int_u8> out(i1.domain(), border);
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc (revision 1149)
@@ -30,10 +30,9 @@
* \brief Tests on mln::border::fill.
*/
-#include "debug_print_3d_with_border.hh"
-#include "border_fill.hh"
#include <mln/core/image3d_b.hh>
-
+#include "border_fill.hh"
+#include <mln/debug/println_with_border.hh>
using namespace mln;
@@ -46,6 +45,6 @@
<< std::endl;
image3d_b<int> i3(2, 3, 1, 1);
border::fill (i3, 6);
- debug::print_3d_with_border(i3);
+ debug::println_with_border(i3);
std::cout << std::endl;
}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc (revision 1149)
@@ -31,9 +31,9 @@
*/
-#include "debug_print_3d_with_border.hh"
#include "border_fill.hh"
#include <mln/core/image3d_b.hh>
+#include <mln/debug/println_with_border.hh>
using namespace mln;
@@ -48,6 +48,6 @@
box3d b(make::point3d(-7, -8, -6), make::point3d(-5, -4, -1));
image3d_b<int> i4(b, 1);
border::fill (i4, 2);
- debug::print_3d_with_border(i4);
+ debug::println_with_border(i4);
std::cout << std::endl;
}
Index: trunk/milena/sandbox/duhamel/labeling_level.hh
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_level.hh (revision 1148)
+++ trunk/milena/sandbox/duhamel/labeling_level.hh (revision 1149)
@@ -98,15 +98,17 @@
}
// first pass
{
- typedef mln_point (I) P;
mln_bkd_pixter(const I) p(f.input);
// mln_nixter(const I, N) n(p, f.nbh);
- mln_qixter(const I, window<P>) n(p, convert::to_upper_window(f.nbh));
+
+ typedef window<mln_dpoint(I)> W;
+ W win = convert::to_upper_window(f.nbh);
+ mln_qixter(const I, W) n(p, win);
for_all(p) if (f.handles(p))
{
make_set(p);
- for_all(n) if (n > p)
+ for_all(n)
if (f.equiv(n, p))
do_union(n, p);
else
@@ -173,21 +175,21 @@
template <typename I_, typename N_, typename O_>
- struct level_fast_t : mln::labeling::impl::base_fast_<I_,N_,O_>
+ struct level_fast_t : labeling::impl::base_fast_<I_,N_,O_>
{
typedef mln_point(I_) P;
// typedef mln_pset(I_) S;
// const S& s;
- void init() { mln::level::fill(this->output, 0); }
- bool handles(unsigned p) const { return mln::labeling::impl::base_fast_<I_,N_,O_>::input[p] == val; }
- bool equiv(unsigned n, unsigned) const { return mln::labeling::impl::base_fast_<I_,N_,O_>::input[n] == val; }
+ void init() { level::fill(this->output, 0); }
+ bool handles(unsigned p) const { return this->input[p] == val; }
+ bool equiv(unsigned n, unsigned) const { return this->input[n] == val; }
const mln_value(I_)& val;
level_fast_t(const I_& input, const mln_value(I_)& val, const N_& nbh, O_& output)
- : mln::labeling::impl::base_fast_<I_,N_,O_>(input, nbh, output),
+ : labeling::impl::base_fast_<I_,N_,O_>(input, nbh, output),
// s(input.domain()),
val(val)
{}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_2.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_2.cc (revision 1149)
@@ -30,10 +30,10 @@
* \brief Tests on mln::border::fill.
*/
-#include "debug_print_3d_with_border.hh"
#include "border_duplicate.hh"
#include <mln/core/image3d_b.hh>
#include <mln/debug/iota.hh>
+#include <mln/debug/println_with_border.hh>
using namespace mln;
@@ -47,6 +47,6 @@
image3d_b<int> ima(2, 3, 1, 1);
debug::iota (ima);
border::duplicate (ima);
- debug::print_3d_with_border(ima);
+ debug::println_with_border(ima);
std::cout << std::endl;
}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_4.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_4.cc (revision 1149)
@@ -30,10 +30,11 @@
* \brief Tests on mln::border::fill.
*/
-#include "debug_print_3d_with_border.hh"
+
#include "border_duplicate.hh"
#include <mln/core/image3d_b.hh>
#include <mln/debug/iota.hh>
+#include <mln/debug/println_with_border.hh>
using namespace mln;
@@ -49,6 +50,6 @@
image3d_b<int> ima(b, 1);
debug::iota (ima);
border::duplicate (ima);
- debug::print_3d_with_border(ima);
+ debug::println_with_border(ima);
std::cout << std::endl;
}
Index: trunk/milena/sandbox/duhamel/test_debug_iota_3d.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_debug_iota_3d.cc (revision 1148)
+++ trunk/milena/sandbox/duhamel/test_debug_iota_3d.cc (revision 1149)
@@ -31,10 +31,11 @@
*/
-#include "debug_print_3d_with_border.hh"
+
#include <mln/core/image3d_b.hh>
#include <mln/value/int_u8.hh>
#include <mln/debug/iota.hh>
+#include <mln/debug/println_with_border.hh>
using namespace mln;
@@ -42,9 +43,8 @@
main (void)
{
- box3d b(make::point3d(2, 6, 1), make::point3d(3, 8, 3));
- image3d_b<value::int_u8> ima(b, 1);
+ image3d_b<bool> ima(2,3,3,1);
debug::iota (ima);
- debug::print_3d_with_border(ima);
+ debug::println_with_border(ima);
}
1
0
ChangeLog:
2007-09-21 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add println_with_border for 3d image.
* println_with_border.hh: Update 3d version.
---
println_with_border.hh | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
Index: trunk/milena/mln/debug/println_with_border.hh
===================================================================
--- trunk/milena/mln/debug/println_with_border.hh (revision 1147)
+++ trunk/milena/mln/debug/println_with_border.hh (revision 1148)
@@ -38,7 +38,7 @@
# include <mln/debug/format.hh>
# include <mln/core/box2d.hh>
-
+# include <mln/core/box3d.hh>
namespace mln
{
@@ -81,6 +81,34 @@
std::cout << std::endl;
}
+ // 3D version
+ template <typename I>
+ void println_with_border(const box3d& b, const Fast_Image<I>& input_)
+ {
+ const I& ima = exact(input_);
+ typedef mln_point(I) P;
+
+ std::size_t len_s = b.len(P::dim - 3);
+ std::size_t len_r = b.len(P::dim - 2);
+ std::size_t len_c = b.len(P::dim - 1);
+ std::size_t border = ima.border ();
+ std::size_t real_len_s = len_s + 2 * border;
+ std::size_t real_len_r = len_r + 2 * border;
+ std::size_t real_len_c = len_c + 2 * border;
+
+ for (std::size_t k = 0; k < real_len_s; ++k)
+ {
+ for (std::size_t j = 0; j < real_len_r; ++j)
+ {
+ for (std::size_t i = 0; i < real_len_c; ++i)
+ std::cout << format(ima[k * (real_len_r * real_len_c) + j * real_len_c + i])
+ << ' ';
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
} // end of namespace mln::debug::impl
1
0
milena r1147: Add tests for duplicate border and debug print with border for 3d.
by Guillaume Duhamel 20 Sep '07
by Guillaume Duhamel 20 Sep '07
20 Sep '07
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-20 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add tests for duplicate border and debug print with border for 3d.
Tests for duplicate.
* test_border_duplicate_image1d_1.cc,
* test_border_duplicate_image1d_2.cc,
* test_border_duplicate_image1d_3.cc,
* test_border_duplicate_image1d_4.cc,
* test_border_duplicate_image1d_5.cc,
* test_border_duplicate_image2d_1.cc,
* test_border_duplicate_image2d_2.cc,
* test_border_duplicate_image2d_3.cc,
* test_border_duplicate_image2d_4.cc,
* test_border_duplicate_image3d_1.cc,
* test_border_duplicate_image3d_2.cc,
* test_border_duplicate_image3d_3.cc,
* test_border_duplicate_image3d_4.cc: New tests.
New print for 3d with border.
* debug_print_3d_with_border.hh: New.
Update.
* test_border_fill_image3d_2.cc,
* test_border_fill_image3d_3.cc,
* test_border_fill_image3d_4.cc,
* test_border_fill_image3d_1.cc,
* border_duplicate.hh: Update.
New iota
* test_debug_iota_3d.cc: New iota debug for 3d.
---
border_duplicate.hh | 107 +++++--------------------------------
debug_print_3d_with_border.hh | 70 ++++++++++++++++++++++++
test_border_duplicate_image1d_1.cc | 54 ++++++++++++++++++
test_border_duplicate_image1d_2.cc | 53 ++++++++++++++++++
test_border_duplicate_image1d_3.cc | 57 +++++++++++++++++++
test_border_duplicate_image1d_4.cc | 56 +++++++++++++++++++
test_border_duplicate_image1d_5.cc | 56 +++++++++++++++++++
test_border_duplicate_image2d_1.cc | 54 ++++++++++++++++++
test_border_duplicate_image2d_2.cc | 53 ++++++++++++++++++
test_border_duplicate_image2d_3.cc | 54 ++++++++++++++++++
test_border_duplicate_image2d_4.cc | 56 +++++++++++++++++++
test_border_duplicate_image3d_1.cc | 53 ++++++++++++++++++
test_border_duplicate_image3d_2.cc | 52 +++++++++++++++++
test_border_duplicate_image3d_3.cc | 56 +++++++++++++++++++
test_border_duplicate_image3d_4.cc | 54 ++++++++++++++++++
test_border_fill_image3d_1.cc | 38 -------------
test_border_fill_image3d_2.cc | 37 ------------
test_border_fill_image3d_3.cc | 38 -------------
test_border_fill_image3d_4.cc | 39 -------------
test_debug_iota_3d.cc | 50 +++++++++++++++++
20 files changed, 849 insertions(+), 238 deletions(-)
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc (revision 1146)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc (revision 1147)
@@ -30,47 +30,11 @@
* \brief Tests on mln::border::fill.
*/
+#include "debug_print_3d_with_border.hh"
#include "border_fill.hh"
#include <mln/core/image3d_b.hh>
#include <mln/value/int_u8.hh>
-namespace mln
-{
-
- namespace debug
- {
- template <typename I>
- void print_3d_with_border (const Fast_Image<I>& input_)
- {
- const I& ima = exact(input_);
- mln_precondition(ima.has_data());
-
- typedef mln_point(I) P;
-
- std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
- std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
- std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
- std::size_t border = ima.border ();
- std::size_t real_len_s = len_s + 2 * border;
- std::size_t real_len_r = len_r + 2 * border;
- std::size_t real_len_c = len_c + 2 * border;
-
- for (std::size_t k = 0; k < real_len_s; ++k)
- {
- for (std::size_t j = 0; j < real_len_c; ++j)
- {
- for (std::size_t i = 0; i < real_len_r; ++i)
- std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
- << " ";
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- }
-}
-
using namespace mln;
int
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc (revision 1146)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc (revision 1147)
@@ -30,47 +30,11 @@
* \brief Tests on mln::border::fill.
*/
+#include "debug_print_3d_with_border.hh"
#include "border_fill.hh"
#include <mln/core/image3d_b.hh>
#include <mln/value/int_u8.hh>
-namespace mln
-{
-
- namespace debug
- {
- template <typename I>
- void print_3d_with_border (const Fast_Image<I>& input_)
- {
- const I& ima = exact(input_);
- mln_precondition(ima.has_data());
-
- typedef mln_point(I) P;
-
- std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
- std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
- std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
- std::size_t border = ima.border ();
- std::size_t real_len_s = len_s + 2 * border;
- std::size_t real_len_r = len_r + 2 * border;
- std::size_t real_len_c = len_c + 2 * border;
-
- for (std::size_t k = 0; k < real_len_s; ++k)
- {
- for (std::size_t j = 0; j < real_len_c; ++j)
- {
- for (std::size_t i = 0; i < real_len_r; ++i)
- std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
- << " ";
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- }
-}
-
using namespace mln;
int
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_1.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_1.cc (revision 1147)
@@ -0,0 +1,54 @@
+// 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/test_border_duplicate_image1d_1.cc
+ *
+ * \brief Tests on mln::border::duplicate.
+ */
+
+#include "border_duplicate.hh"
+#include <mln/core/image1d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 1d size=5 with border=3 in value::int_u8"
+ << std::endl
+ << std::endl;
+ image1d_b<value::int_u8> ima(5);
+ debug::iota (ima);
+ border::duplicate (ima);
+ std::cout << std::endl;
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_1.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_1.cc (revision 1147)
@@ -0,0 +1,54 @@
+// 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/test_border_duplicate_image2d_1.cc
+ *
+ * \brief Tests on mln::border::duplicate.
+ */
+
+#include "border_duplicate.hh"
+#include <mln/core/image2d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 2d size=5x2 with border=3 in value::int_u8"
+ << std::endl
+ << std::endl;
+ image2d_b<value::int_u8> ima(5, 2, 3);
+ debug::iota (ima);
+ border::duplicate (ima);
+ std::cout << std::endl;
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_1.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_1.cc (revision 1147)
@@ -0,0 +1,53 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "debug_print_3d_with_border.hh"
+#include "border_duplicate.hh"
+#include <mln/core/image3d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 3d size=2x3x1 in value::int_u8 with border=2"
+ << std::endl
+ << std::endl;
+ image3d_b<value::int_u8> ima(2, 3, 1, 2);
+ debug::iota (ima);
+ border::duplicate (ima);
+ debug::print_3d_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_3.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_3.cc (revision 1147)
@@ -0,0 +1,57 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_duplicate.hh"
+#include <mln/core/image1d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 1d size= box [2 .. 4] with border=6 in int"
+ << std::endl
+ << std::endl;
+
+ box1d b(make::point1d(2), make::point1d(4));
+ image1d_b<int> ima(b, 6);
+ debug::iota (ima);
+ border::duplicate (ima);
+ std::cout << std::endl;
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_3.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_3.cc (revision 1147)
@@ -0,0 +1,54 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_duplicate.hh"
+#include <mln/core/image2d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 2d size=[(2,6) .. (3,8)] with border=3 in int"
+ << std::endl
+ << std::endl;
+ box2d b(make::point2d(2, 6), make::point2d(3, 8));
+ image2d_b<int> ima(b, 3);
+ debug::iota (ima);
+ border::duplicate (ima);
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/border_duplicate.hh
===================================================================
--- trunk/milena/sandbox/duhamel/border_duplicate.hh (revision 1146)
+++ trunk/milena/sandbox/duhamel/border_duplicate.hh (revision 1147)
@@ -34,7 +34,6 @@
*/
# include <mln/core/concept/image.hh>
-# include <mln/core/internal/fixme.hh>
# include <mln/level/memset_.hh>
//# include <mln/core/line_piter.hh>
#include <mln/geom/nrows.hh>
@@ -69,71 +68,6 @@
{
template <typename I>
- void duplicate_(const Fast_Image<I>& ima_)
- {
- const I& ima = exact(ima_);
- mln_precondition(ima.has_data());
-
- // internal::fixme();
- // FIX
- std::size_t border = ima.border ();
- std::size_t nbrows = geom::max_row(ima) - geom::min_row(ima);
- std::size_t nbcols = geom::max_col(ima) - geom::min_col(ima);
- std::size_t real_nbcols = (nbcols + 1) + 2 * border;
- std::size_t start = real_nbcols * border + border;
- std::size_t s = start;
-
- // duplicate top left corner
- for (std::size_t i = 0; i < border + 1; ++i)
- for (std::size_t j = 0; j < border + 1; ++j)
- const_cast<I&>(ima)[i * ((nbcols + 1) + 2 * border) + j] = ima[s];
-
- // duplicate top border
- s = start;
- for (std::size_t i = 1; i <= nbcols - 1; ++i)
- for (std::size_t j = 0; j <= border; ++j)
- const_cast<I&>(ima)[s + i - (j * real_nbcols)] = ima[s + i];
-
- // duplicate top left corner
- s = start + nbcols;
- for (std::size_t i = 0; i <= border; ++i)
- for (std::size_t j = 0; j <= border; ++j)
- const_cast<I&>(ima)[i * ((nbcols + 1) + 2 * border) + (nbcols + border + j)] = ima[s];
-
- // duplicate left border
- s = start;
- for (std::size_t i = 1; i <= nbrows - 1; ++i)
- for (std::size_t j = 1; j <= border; ++j)
- const_cast<I&>(ima)[s - j + (i * real_nbcols)] = ima[s + (i * real_nbcols)];
-
- // duplicate right border
- s = start;
- for (std::size_t i = 1; i <= nbrows - 1; ++i)
- for (std::size_t j = 1; j <= border; ++j)
- const_cast<I&>(ima)[s + (i * real_nbcols + nbcols) + j] = ima[s + (i * real_nbcols + nbcols)];
-
-
- // duplicate bottom left corner
- s = start + (nbrows * real_nbcols);
- for (std::size_t i = 0; i <= border; ++i)
- for (std::size_t j = 0; j <= border; ++j)
- const_cast<I&>(ima)[s - i + (j * (real_nbcols))] = ima[s];
-
- // duplicate bottom border
- s = start + (nbrows * real_nbcols);
- for (std::size_t i = 1; i <= nbcols - 1; ++i)
- for (std::size_t j = 0; j <= border; ++j)
- const_cast<I&>(ima)[s + i + (j * real_nbcols)] = ima[s + i];
-
- // duplicate bottom right corner
- s = start + (nbrows * real_nbcols) + nbcols;
- for (std::size_t i = 0; i <= border; ++i)
- for (std::size_t j = 0; j <= border; ++j)
- const_cast<I&>(ima)[s + i + (j * real_nbcols)] = ima[s];
- //END FIX
- }
-
- template <typename I>
void duplicate_1d_(const Fast_Image<I>& ima_)
{
const I& ima = exact(ima_);
@@ -162,30 +96,10 @@
typename I::line_piter pl(ima.domain());
std::size_t border = ima.border ();
std::size_t border_2x = 2 * ima.border ();
- std::size_t len_c = exact(ima).bbox().len(P::dim - 1);
- std::size_t len_r = exact(ima).bbox().len(P::dim - 2);
+ std::size_t len_c = exact(ima).bbox().len(1);
+ std::size_t len_r = exact(ima).bbox().len(0);
std::size_t real_len_c = len_c + border_2x;
-
-
- pl.start ();
-
- // Duplicate first line
- std::size_t st = ima.offset_at (pl);
- for (std::size_t i = 0; i < border; ++i)
- const_cast<I&>(ima)[i] = ima[st];
-
- std::size_t end = len_c + border;
- for (std::size_t i = 0; i < len_c; ++i)
- const_cast<I&>(ima)[border + i] = ima[st + i];
-
- end = len_c + border * 2;
- for (std::size_t i = len_c + border; i < end; ++i)
- const_cast<I&>(ima)[i] = ima[len_c + border - 1];
-
- // Duplicate n * border line
- for (std::size_t k = 1; k < border; ++k)
- for (std::size_t i = 0; i < real_len_c; ++i)
- const_cast<I&>(ima)[k * real_len_c + i] = ima[i];
+ std::size_t st;
// Duplicate
for_all (pl)
@@ -198,6 +112,12 @@
const_cast<I&>(ima)[st + i] = ima[st];
}
+ // Duplicate n first * border line
+ st = real_len_c * border;
+ for (std::size_t k = 0; k < border; ++k)
+ for (std::size_t i = 0; i < real_len_c; ++i)
+ const_cast<I&>(ima)[k * real_len_c + i] = ima[st + i];
+
// Duplicate n last * border line
st = real_len_c * (border + len_r - 1);
for (std::size_t k = 1; k <= border; ++k)
@@ -216,8 +136,8 @@
std::size_t border = ima.border ();
std::size_t border_2x = 2 * ima.border ();
std::size_t len_c = exact(ima).bbox().len(P::dim - 1);
- std::size_t len_r = exact(ima).bbox().len(P::dim - 2);
- std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
+ std::size_t len_r = exact(ima).bbox().len(1);
+ std::size_t len_s = exact(ima).bbox().len(0);
std::size_t real_len_c = len_c + border_2x;
std::size_t real_len_r = len_r + border_2x;
std::size_t face = real_len_c * real_len_r;
@@ -277,6 +197,11 @@
void duplicate(const Fast_Image<I>& ima_)
{
typedef mln_point(I) P;
+ const I& ima = exact(ima_);
+ mln_precondition(ima.has_data());
+
+ if (!ima.border ())
+ return;
if (P::dim == 1)
impl::duplicate_1d_(ima_);
if (P::dim == 2)
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_5.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_5.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_5.cc (revision 1147)
@@ -0,0 +1,56 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_duplicate.hh"
+#include <mln/core/image1d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 1d size= box [2 .. 4] with border=0 in int"
+ << std::endl
+ << std::endl;
+
+ box1d b(make::point1d(2), make::point1d(4));
+ image1d_b<int> ima(b, 0);
+ debug::iota (ima);
+ border::duplicate (ima);
+ std::cout << std::endl;
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_3.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_3.cc (revision 1147)
@@ -0,0 +1,56 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+
+#include "debug_print_3d_with_border.hh"
+#include "border_duplicate.hh"
+#include <mln/core/image3d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 3d size=[(2,6,1) .. (3,8,3)] border=1 in value::int_u8"
+ << std::endl
+ << std::endl;
+
+ box3d b(make::point3d(2, 6, 1), make::point3d(3, 8, 3));
+ image3d_b<value::int_u8> ima(b, 1);
+ debug::iota (ima);
+ border::duplicate (ima);
+ debug::print_3d_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/debug_print_3d_with_border.hh
===================================================================
--- trunk/milena/sandbox/duhamel/debug_print_3d_with_border.hh (revision 0)
+++ trunk/milena/sandbox/duhamel/debug_print_3d_with_border.hh (revision 1147)
@@ -0,0 +1,70 @@
+// 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 debug_print_3d_with_boder.cc
+ *
+ *
+ */
+
+#include <mln/core/image3d_b.hh>
+
+namespace mln
+{
+
+ namespace debug
+ {
+ template <typename I>
+ void print_3d_with_border (const Fast_Image<I>& input_)
+ {
+ const I& ima = exact(input_);
+ mln_precondition(ima.has_data());
+
+ typedef mln_point(I) P;
+
+ std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
+ std::size_t len_r = exact(ima).bbox().len(P::dim - 2);
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 1);
+ std::size_t border = ima.border ();
+ std::size_t real_len_s = len_s + 2 * border;
+ std::size_t real_len_r = len_r + 2 * border;
+ std::size_t real_len_c = len_c + 2 * border;
+
+ for (std::size_t k = 0; k < real_len_s; ++k)
+ {
+ for (std::size_t j = 0; j < real_len_r; ++j)
+ {
+ for (std::size_t i = 0; i < real_len_c; ++i)
+ std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_c + i]
+ << " ";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ }
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc (revision 1146)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc (revision 1147)
@@ -30,45 +30,10 @@
* \brief Tests on mln::border::fill.
*/
+#include "debug_print_3d_with_border.hh"
#include "border_fill.hh"
#include <mln/core/image3d_b.hh>
-namespace mln
-{
-
- namespace debug
- {
- template <typename I>
- void print_3d_with_border (const Fast_Image<I>& input_)
- {
- const I& ima = exact(input_);
- mln_precondition(ima.has_data());
-
- typedef mln_point(I) P;
-
- std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
- std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
- std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
- std::size_t border = ima.border ();
- std::size_t real_len_s = len_s + 2 * border;
- std::size_t real_len_r = len_r + 2 * border;
- std::size_t real_len_c = len_c + 2 * border;
-
- for (std::size_t k = 0; k < real_len_s; ++k)
- {
- for (std::size_t j = 0; j < real_len_c; ++j)
- {
- for (std::size_t i = 0; i < real_len_r; ++i)
- std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
- << " ";
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- }
-}
using namespace mln;
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc (revision 1146)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc (revision 1147)
@@ -30,46 +30,11 @@
* \brief Tests on mln::border::fill.
*/
+
+#include "debug_print_3d_with_border.hh"
#include "border_fill.hh"
#include <mln/core/image3d_b.hh>
-namespace mln
-{
-
- namespace debug
- {
- template <typename I>
- void print_3d_with_border (const Fast_Image<I>& input_)
- {
- const I& ima = exact(input_);
- mln_precondition(ima.has_data());
-
- typedef mln_point(I) P;
-
- std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
- std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
- std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
- std::size_t border = ima.border ();
- std::size_t real_len_s = len_s + 2 * border;
- std::size_t real_len_r = len_r + 2 * border;
- std::size_t real_len_c = len_c + 2 * border;
-
- for (std::size_t k = 0; k < real_len_s; ++k)
- {
- for (std::size_t j = 0; j < real_len_c; ++j)
- {
- for (std::size_t i = 0; i < real_len_r; ++i)
- std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
- << " ";
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- }
-}
-
using namespace mln;
int
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_2.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_2.cc (revision 1147)
@@ -0,0 +1,53 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_duplicate.hh"
+#include <mln/core/image1d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 1d size=8 with border=3 in int"
+ << std::endl
+ << std::endl;
+ image1d_b<int> ima(8, 3);
+ debug::iota (ima);
+ border::duplicate (ima);
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_2.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_2.cc (revision 1147)
@@ -0,0 +1,53 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_duplicate.hh"
+#include <mln/core/image2d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 2d size=2x3 in int with border=2"
+ << std::endl
+ << std::endl;
+ image2d_b<int> i2(2, 3, 2);
+ debug::iota (i2);
+ border::duplicate (i2);
+ debug::println_with_border(i2);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_4.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image1d_4.cc (revision 1147)
@@ -0,0 +1,56 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_duplicate.hh"
+#include <mln/core/image1d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 1d size= box [-6 .. -3] with border=6 in value::int_u8"
+ << std::endl
+ << std::endl;
+
+ box1d b(make::point1d(-6), make::point1d(-3));
+ image1d_b<value::int_u8> ima(b, 6);
+ debug::iota (ima);
+ border::duplicate (ima);
+ std::cout << std::endl;
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_2.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_2.cc (revision 1147)
@@ -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.
+
+/*! \file tests/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "debug_print_3d_with_border.hh"
+#include "border_duplicate.hh"
+#include <mln/core/image3d_b.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 3d size=2x3x1 with border=1 in int"
+ << std::endl
+ << std::endl;
+ image3d_b<int> ima(2, 3, 1, 1);
+ debug::iota (ima);
+ border::duplicate (ima);
+ debug::print_3d_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_4.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image2d_4.cc (revision 1147)
@@ -0,0 +1,56 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+
+#include "border_duplicate.hh"
+#include <mln/core/image2d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 2d size=[(-6,-3) .. (-2,-1)] with border=3 in value::int_u8"
+ << std::endl
+ << std::endl;
+
+ box2d b(make::point2d(-6, -3), make::point2d(-2, -1));
+ image2d_b<value::int_u8> ima(b, 3);
+ debug::iota (ima);
+ border::duplicate (ima);
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_4.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_duplicate_image3d_4.cc (revision 1147)
@@ -0,0 +1,54 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "debug_print_3d_with_border.hh"
+#include "border_duplicate.hh"
+#include <mln/core/image3d_b.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 3d size=[(-7,-8,-6) .. (-5,-4,-1 )] border=1 in int"
+ << std::endl
+ << std::endl;
+
+ box3d b(make::point3d(-7, -8, -6), make::point3d(-5, -4, -1));
+ image3d_b<int> ima(b, 1);
+ debug::iota (ima);
+ border::duplicate (ima);
+ debug::print_3d_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_debug_iota_3d.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_debug_iota_3d.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_debug_iota_3d.cc (revision 1147)
@@ -0,0 +1,50 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+
+#include "debug_print_3d_with_border.hh"
+#include <mln/core/image3d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/iota.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+
+ box3d b(make::point3d(2, 6, 1), make::point3d(3, 8, 3));
+ image3d_b<value::int_u8> ima(b, 1);
+ debug::iota (ima);
+ debug::print_3d_with_border(ima);
+
+}
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Change image base impl classes.
New intermediate classes.
* mln/core/internal/image_domain_morpher.hh: New.
* mln/core/internal/image_value_morpher.hh: New.
* mln/core/internal/image_morpher.hh: New.
* mln/core/internal/image_base.hh (owns_): New.
* mln/core/image2d_b.hh (init_with): Update.
* mln/core/cast_image.hh: Change inheritance.
* mln/core/sub_image.hh: Likewise.
cast_image.hh | 56 +++++------------
image2d_b.hh | 3
internal/image_base.hh | 14 +++-
internal/image_domain_morpher.hh | 122 +++++++++++++++++++++++++++++++++++++++
internal/image_morpher.hh | 120 ++++++++++++++++++++++++++++++++++++++
internal/image_value_morpher.hh | 104 +++++++++++++++++++++++++++++++++
sub_image.hh | 36 ++++++-----
7 files changed, 396 insertions(+), 59 deletions(-)
Index: mln/core/internal/image_domain_morpher.hh
--- mln/core/internal/image_domain_morpher.hh (revision 0)
+++ mln/core/internal/image_domain_morpher.hh (revision 0)
@@ -0,0 +1,122 @@
+// 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_INTERNAL_IMAGE_DOMAIN_MORPHER_HH
+# define MLN_CORE_INTERNAL_IMAGE_DOMAIN_MORPHER_HH
+
+/*! \file mln/core/internal/image_domain_morpher.hh
+ *
+ * \brief Definition of a base class for image morphers w.r.t. domain.
+ */
+
+# include <mln/core/internal/image_morpher.hh>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+
+ /*! \brief A base class for image morphers w.r.t. domain.
+ *
+ * Parameter \p S is a point set type.
+ *
+ * \internal
+ */
+ template <typename I, typename S, typename E>
+ class image_domain_morpher_ : public image_morpher_<I, S, E>
+ {
+ public:
+
+ /// Value_Set associated type.
+ typedef mln_vset(I) vset;
+
+ /// Value associated type.
+ typedef mln_value(I) value;
+
+ /// Return type of read-only access.
+ typedef mln_rvalue(I) rvalue;
+
+ /// Return type of read-write access.
+ typedef typename internal::morpher_lvalue_<I>::ret lvalue;
+
+
+ /// Give the set of values.
+ const vset& values() const;
+
+ /// Read-only access of pixel value at point site \p p.
+ rvalue operator()(const mln_psite(S)& p) const;
+
+ /// Read-write access of pixel value at point site \p p.
+ lvalue operator()(const mln_psite(S)& p);
+
+ protected:
+ image_domain_morpher_();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename S, typename E>
+ image_domain_morpher_<I,S,E>::image_domain_morpher_()
+ {
+ }
+
+ template <typename I, typename S, typename E>
+ const mln_vset(I)&
+ image_domain_morpher_<I,S,E>::values() const
+ {
+ mln_precondition(this->delegatee_() != 0);
+ return this->delegatee_()->values();
+ }
+
+ template <typename I, typename S, typename E>
+ mln_rvalue(I)
+ image_domain_morpher_<I,S,E>::operator()(const mln_psite(S)& p) const
+ {
+ mln_precondition(this->delegatee_() != 0);
+ return this->delegatee_()->operator()(p);
+ }
+
+ template <typename I, typename S, typename E>
+ typename image_domain_morpher_<I,S,E>::lvalue
+ image_domain_morpher_<I,S,E>::operator()(const mln_psite(S)& p)
+ {
+ mln_precondition(this->delegatee_() != 0);
+ return this->delegatee_()->operator()(p);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_IMAGE_DOMAIN_MORPHER_HH
Index: mln/core/internal/image_value_morpher.hh
--- mln/core/internal/image_value_morpher.hh (revision 0)
+++ mln/core/internal/image_value_morpher.hh (revision 0)
@@ -0,0 +1,104 @@
+// 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_INTERNAL_IMAGE_VALUE_MORPHER_HH
+# define MLN_CORE_INTERNAL_IMAGE_VALUE_MORPHER_HH
+
+/*! \file mln/core/internal/image_value_morpher.hh
+ *
+ * \brief Definition of a base class for image morphers w.r.t. value.
+ */
+
+# include <mln/core/internal/image_morpher.hh>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+
+ /*! \brief A base class for image morphers w.r.t. value.
+ *
+ * Parameter \p S is a point set type.
+ *
+ * \internal
+ */
+ template <typename I, typename E>
+ class image_value_morpher_ : public image_morpher_<I, mln_pset(I), E>
+ {
+ public:
+
+ const mln_pset(I)& domain() const;
+ bool owns_(const mln_psite(I)& p) const;
+
+ bool has_data() const; // Default impl.
+
+ protected:
+ image_value_morpher_();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename E>
+ image_value_morpher_<I,E>::image_value_morpher_()
+ {
+ }
+
+ template <typename I, typename E>
+ const mln_pset(I)&
+ image_value_morpher_<I,E>::domain() const
+ {
+ mln_precondition(this->delegatee_() != 0);
+ return this->delegatee_()->domain();
+ }
+
+ template <typename I, typename E>
+ bool
+ image_value_morpher_<I,E>::owns_(const mln_psite(I)& p) const
+ {
+ mln_precondition(this->delegatee_() != 0);
+ return this->delegatee_()->owns_(p);
+ }
+
+ template <typename I, typename E>
+ bool
+ image_value_morpher_<I,E>::has_data() const
+ {
+ return this->delegatee_() != 0 && this->delegatee_()->has_data();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_IMAGE_VALUE_MORPHER_HH
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 1145)
+++ mln/core/internal/image_base.hh (working copy)
@@ -123,15 +123,15 @@
/// Test if \p p belongs to the image domain.
bool has(const psite& p) const;
+ // FIXME: Keep this default (owns_ is based on has)?
+ bool owns_(const psite& p) const;
+
/// Give a bounding box of the image domain.
const box_<point>& bbox() const;
/// Give the number of points of the image domain.
std::size_t npoints() const;
-
- // FIXME: Add owns_(p) based on has(p)?
-
protected:
image_base_();
};
@@ -153,6 +153,14 @@
}
template <typename S, typename E>
+ bool
+ image_base_<S,E>::owns_(const psite& p) const
+ {
+ mln_precondition(exact(this)->has_data());
+ return exact(this)->has(p);
+ }
+
+ template <typename S, typename E>
const box_<mln_point(S)>&
image_base_<S,E>::bbox() const
{
Index: mln/core/internal/image_morpher.hh
--- mln/core/internal/image_morpher.hh (revision 0)
+++ mln/core/internal/image_morpher.hh (revision 0)
@@ -0,0 +1,120 @@
+// 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_INTERNAL_IMAGE_MORPHER_HH
+# define MLN_CORE_INTERNAL_IMAGE_MORPHER_HH
+
+/*! \file mln/core/internal/image_morpher.hh
+ *
+ * \brief Definition of a base class for image morphers.
+ */
+
+# include <mln/core/internal/image_base.hh>
+# include <mln/metal/const.hh>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ /*! \brief A base class for images that are morphers.
+ *
+ * Parameter \c I is the underlying-morphed image type.
+ *
+ * \internal
+ */
+ template <typename I, typename S, typename E>
+ class image_morpher_ : public image_base_<S, E>
+ {
+ public:
+
+ typedef I delegatee;
+
+ /// Return the delegatee_ pointer.
+ mlc_const(I)* delegatee_() const;
+
+ /// Return the delegatee_ pointer (non-const version).
+ I* delegatee_();
+
+ /// Convertion to the underlying (morphed) image.
+ operator I() const; // FIXME: Dangerous?
+
+ /// Default for has_data is "delegatee has data".
+ bool has_data() const;
+
+ protected:
+ image_morpher_();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename S, typename E>
+ image_morpher_<I,S,E>::image_morpher_()
+ {
+ }
+
+ template <typename I, typename S, typename E>
+ mlc_const(I)*
+ image_morpher_<I,S,E>::delegatee_() const
+ {
+ return exact(this)->impl_delegatee_();
+ }
+
+ template <typename I, typename S, typename E>
+ I*
+ image_morpher_<I,S,E>::delegatee_()
+ {
+ return exact(this)->impl_delegatee_();
+ }
+
+ template <typename I, typename S, typename E>
+ image_morpher_<I,S,E>::operator I() const
+ {
+ mln_precondition(exact(this)->has_data());
+ mln_precondition(this->delegatee_() != 0); // FIXME: Redundant?
+ return * this->delegatee_();
+ }
+
+ template <typename I, typename S, typename E>
+ bool
+ image_morpher_<I,S,E>::has_data() const
+ {
+ mln_precondition(this->delegatee_() != 0); // FIXME: Redundant?
+ return this->delegatee_()->has_data();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_IMAGE_MORPHER_HH
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1145)
+++ mln/core/image2d_b.hh (working copy)
@@ -145,7 +145,8 @@
void init_with(const Image<I>& other)
{
mln_precondition(data_ = 0);
- data_ = new image2d_b_data<T>(other.domain().bbox()); // FIXME: border?
+ mln_precondition(exact(other).has_data());
+ data_ = new image2d_b_data<T>(exact(other).bbox()); // FIXME: border?
}
Index: mln/core/cast_image.hh
--- mln/core/cast_image.hh (revision 1145)
+++ mln/core/cast_image.hh (working copy)
@@ -33,7 +33,7 @@
* \brief Definition of an image class FIXME
*/
-# include <mln/core/concept/image.hh>
+# include <mln/core/internal/image_value_morpher.hh>
# include <mln/value/set.hh>
# include <mln/value/cast.hh>
@@ -45,15 +45,10 @@
*
*/
template <typename T, typename I>
- class cast_image_ : public mln::internal::image_base_< mln_pset(I), cast_image_<T,I> >
+ class cast_image_ : public internal::image_value_morpher_< I, cast_image_<T,I> >
{
- typedef cast_image_<T,I> self_;
- typedef mln::internal::image_base_<mln_pset(I), self_> super_;
public:
- typedef mln_psite(super_) psite;
-
-
/// Value associated type.
typedef T value;
@@ -75,24 +70,18 @@
cast_image_(const Image<I>& ima);
- /// Test if this image has been initialized.
- bool has_data() const;
-
- /// Test if a pixel value is accessible at \p p.
- bool owns_(const psite& p) const;
-
- /// Give the definition domain.
- const mln_pset(I)& domain() const;
-
/// Read-only access of pixel value at point site \p p.
- T operator()(const psite& p) const;
+ T operator()(const mln_psite(I)& p) const;
/// Mutable access is only OK for reading (not writing).
- T operator()(const psite& p);
+ T operator()(const mln_psite(I)& p);
/// Give the set of values of the image.
const vset& values() const;
+ /// Access to delegatee pointer.
+ const I* impl_delegatee_() const;
+
protected:
const I& ima_;
};
@@ -120,28 +109,8 @@
}
template <typename T, typename I>
- bool cast_image_<T,I>::has_data() const
- {
- mln_invariant(ima_.has_data());
- return true;
- }
-
- template <typename T, typename I>
- bool cast_image_<T,I>::owns_(const psite& p) const
- {
- return ima_.owns_(p);
- }
-
- template <typename T, typename I>
- const mln_pset(I)&
- cast_image_<T,I>::domain() const
- {
- return ima_.domain();
- }
-
- template <typename T, typename I>
T
- cast_image_<T,I>::operator()(const psite& p) const
+ cast_image_<T,I>::operator()(const mln_psite(I)& p) const
{
mln_precondition(ima_.owns_(p));
return mln::value::cast<T>( ima_(p) );
@@ -149,7 +118,7 @@
template <typename T, typename I>
T
- cast_image_<T,I>::operator()(const psite& p)
+ cast_image_<T,I>::operator()(const mln_psite(I)& p)
{
return mln::value::cast<T>( ima_(p) );
}
@@ -161,6 +130,13 @@
return vset::the();
}
+ template <typename T, typename I>
+ const I*
+ cast_image_<T,I>::impl_delegatee_() const
+ {
+ return & ima_;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: mln/core/sub_image.hh
--- mln/core/sub_image.hh (revision 1145)
+++ mln/core/sub_image.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_SUB_IMAGE_HH
# define MLN_CORE_SUB_IMAGE_HH
-# include <mln/core/internal/image_adaptor.hh>
+# include <mln/core/internal/image_domain_morpher.hh>
namespace mln
@@ -37,11 +37,8 @@
// FIXME: Doc!
template <typename I, typename S>
- class sub_image : public internal::image_adaptor_< I,
- sub_image<I,S>,
- S >
+ class sub_image : public internal::image_domain_morpher_< I, S, sub_image<I,S> >
{
- typedef internal::image_adaptor_<I, sub_image<I,S>, S> super_;
public:
/// Skeleton.
@@ -49,14 +46,16 @@
sub_image(I& ima, const S& pset);
- bool owns_(const mln_psite(I)& p) const;
-
const S& domain() const;
/// Const promotion via convertion.
operator sub_image<const I, S>() const;
+ mlc_const(I)* impl_delegatee_() const;
+ I* impl_delegatee_();
+
protected:
+ I& ima_;
const S& pset_;
};
@@ -74,19 +73,12 @@
template <typename I, typename S>
sub_image<I,S>::sub_image(I& ima, const S& pset)
- : super_(ima),
+ : ima_(ima),
pset_(pset)
{
}
template <typename I, typename S>
- bool
- sub_image<I,S>::owns_(const mln_psite(I)& p) const
- {
- return this->domain().has(p);
- }
-
- template <typename I, typename S>
const S&
sub_image<I,S>::domain() const
{
@@ -100,6 +92,20 @@
return tmp;
}
+ template <typename I, typename S>
+ mlc_const(I)*
+ sub_image<I,S>::impl_delegatee_() const
+ {
+ return & ima_;
+ }
+
+ template <typename I, typename S>
+ I*
+ sub_image<I,S>::impl_delegatee_()
+ {
+ return & ima_;
+ }
+
// operator
template <typename I, typename S>
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-20 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add track pointer for stack & pw images.
* mln/pw/image.hh: Add some tests.
* mln/value/stack.hh: Update pw::image class for memory managment.
* tests/stack.cc: Update stack_image class for memory managment.
---
mln/pw/image.hh | 41 +++++++++++++++++++++++++++------
mln/value/stack.hh | 64 +++++++++++++++++++++++++++++++++++------------------
tests/stack.cc | 12 +++++++++
3 files changed, 87 insertions(+), 30 deletions(-)
Index: trunk/milena/tests/stack.cc
===================================================================
--- trunk/milena/tests/stack.cc (revision 1144)
+++ trunk/milena/tests/stack.cc (revision 1145)
@@ -42,7 +42,7 @@
typedef image2d_b<int> I;
- box2d b = make::box2d(1, 1);
+ box2d b = make::box2d(2, 2);
image2d_b<int> ima5(b), ima1(b);
point2d p = make::point2d(0, 0);
@@ -51,4 +51,14 @@
value::stack(ima5, ima1)(p) = v;
mln_assertion(value::stack(ima5, ima1)(p) == v);
mln_assertion(ima5(p) == 5 && ima1(p) == 1);
+
+ value::stack_image<2, image2d_b<int> > s1(value::stack(ima5, ima1));
+
+ value::stack_image<2, image2d_b<int> > s2;
+
+ p = make::point2d(1, 1);
+ s2 = s1;
+ s2(p) = v;
+ mln_assertion(s1(p) == v);
+ mln_assertion(ima5(p) == 5 && ima1(p) == 1);
}
Index: trunk/milena/mln/pw/image.hh
===================================================================
--- trunk/milena/mln/pw/image.hh (revision 1144)
+++ trunk/milena/mln/pw/image.hh (revision 1145)
@@ -35,6 +35,7 @@
# include <mln/core/internal/image_base.hh>
# include <mln/core/concept/function.hh>
+# include <mln/core/internal/tracked_ptr.hh>
# include <mln/value/set.hh>
@@ -51,6 +52,7 @@
*/
template <typename F, typename S>
pw::image<F,S>
+
operator | (const Function_p2v<F>& f, const Point_Set<S>& ps);
@@ -58,6 +60,25 @@
namespace pw
{
+ /*! \brief data structure for pw::image
+ *
+ */
+ template <typename F, typename S>
+ struct image_data
+ {
+ public:
+ image_data(const Function_p2v<F>& f, const Point_Set<S>& ps);
+ F f_;
+ S pset_;
+ };
+
+ template <typename F, typename S>
+ image_data<F, S>::image_data(const Function_p2v<F>& f, const Point_Set<S>& ps)
+ : f_(exact(f)),
+ pset_(exact(ps))
+ {
+ }
+
/*! \brief FIXME
*
*/
@@ -91,6 +112,7 @@
/// Constructor.
image(const Function_p2v<F>& f, const Point_Set<S>& ps);
+ image();
/// Test if this image has been initialized.
@@ -112,8 +134,7 @@
const vset& values() const;
protected:
- F f_;
- S pset_;
+ tracked_ptr< image_data<F, S> > data_;
};
} // end of namespace mln::pw
@@ -134,10 +155,14 @@
{
template <typename F, typename S>
+ image<F,S>::image()
+ {
+ }
+
+ template <typename F, typename S>
image<F,S>::image(const Function_p2v<F>& f, const Point_Set<S>& ps)
- : f_(exact(f)),
- pset_(exact(ps))
{
+ data_ = new image_data<F, S>(f, ps);
}
template <typename F, typename S>
@@ -149,22 +174,22 @@
template <typename F, typename S>
bool image<F,S>::owns_(const psite& p) const
{
- return pset_.has(p);
+ return data_->pset_.has(p);
}
template <typename F, typename S>
const S&
image<F,S>::domain() const
{
- return pset_;
+ return data_->pset_;
}
template <typename F, typename S>
mln_result(F)
image<F,S>::operator()(const psite& p) const
{
- mln_precondition(pset_.has(p));
- return f_(p);
+ mln_precondition(data_->pset_.has(p));
+ return data_->f_(p);
}
template <typename F, typename S>
Index: trunk/milena/mln/value/stack.hh
===================================================================
--- trunk/milena/mln/value/stack.hh (revision 1144)
+++ trunk/milena/mln/value/stack.hh (revision 1145)
@@ -34,6 +34,8 @@
*/
# include <mln/core/internal/image_base.hh>
+# include <mln/core/internal/tracked_ptr.hh>
+
# include <mln/metal/vec.hh>
# include <mln/value/set.hh>
# include <mln/value/proxy.hh>
@@ -76,6 +78,23 @@
} // end of namespace mln::value::internal
+ /*! \brief data structure for stack_image
+ *
+ */
+ template <unsigned n, typename I>
+ struct stack_image_data
+ {
+ public:
+ stack_image_data(const metal::vec<n,I>& imas);
+ metal::vec<n,I> imas_;
+ };
+
+ template <unsigned n, typename I>
+ stack_image_data<n,I>::stack_image_data(const metal::vec<n,I>& imas)
+ : imas_(imas)
+ {
+ }
+
/*! \brief FIXME
*
*/
@@ -106,7 +125,8 @@
/// Constructor.
- stack_image(const metal::vec<n,I*>& imas);
+ stack_image(const metal::vec<n,I>& imas);
+ stack_image();
/// Test if this image has been initialized.
@@ -130,7 +150,7 @@
const vset& values() const;
protected:
- metal::vec<n,I*> imas_;
+ tracked_ptr< stack_image_data<n, I> > data_;
};
@@ -151,13 +171,17 @@
// stack_image<n, I>
template <unsigned n, typename I>
- stack_image<n,I>::stack_image(const metal::vec<n,I*>& imas)
- : imas_(imas)
+ stack_image<n,I>::stack_image()
{
+ }
+
+ template <unsigned n, typename I>
+ stack_image<n,I>::stack_image(const metal::vec<n,I>& imas)
+ {
+ data_ = new stack_image_data<n,I>(imas);
for (unsigned i = 0; i < n; ++i)
{
- mln_precondition(imas[i] != 0);
- mln_precondition(imas[i]->has_data());
+ mln_precondition(imas[i].has_data());
}
}
@@ -165,7 +189,7 @@
bool stack_image<n,I>::has_data() const
{
for (unsigned i = 0; i < n; ++i)
- mln_invariant(imas_[i]->has_data());
+ mln_invariant(data_->imas_[i].has_data());
return true;
}
@@ -173,7 +197,7 @@
bool stack_image<n,I>::owns_(const psite& p) const
{
for (unsigned i = 0; i < n; ++i)
- if (! imas_[i]->owns_(p))
+ if (! data_->imas_[i].owns_(p))
return false;
return true;
}
@@ -182,7 +206,7 @@
const mln_pset(I)&
stack_image<n,I>::domain() const
{
- return imas_[0]->domain();
+ return data_->imas_[0].domain();
}
template <unsigned n, typename I>
@@ -192,7 +216,7 @@
mln_precondition(this->owns_(p));
metal::vec<n, mln_value(I)> tmp;
for (unsigned i = 0; i < n; ++i)
- tmp[i] = imas_[i]->operator()(p);
+ tmp[i] = data_->imas_[i].operator()(p);
return tmp;
}
@@ -210,7 +234,7 @@
mln_precondition(this->owns_(p));
// FIXME!!!
for (unsigned i = 0; i < n; ++i)
- imas_[i]->operator()(p) = v[i];
+ data_->imas_[i].operator()(p) = v[i];
}
template <unsigned n, typename I>
@@ -234,11 +258,10 @@
stack(const Image<I>& ima1, const Image<I>& ima2)
{
mln_precondition(exact(ima1).domain() == exact(ima2).domain());
- metal::vec<2, const I*> imas;
- imas[0] = & exact(ima1);
- imas[1] = & exact(ima2);
- stack_image<2, const I> tmp(imas);
- return tmp;
+ metal::vec<2, const I> imas;
+ imas[0] = exact(ima1);
+ imas[1] = exact(ima2);
+ return imas;
}
template <typename I>
@@ -246,11 +269,10 @@
stack(Image<I>& ima1, Image<I>& ima2)
{
mln_precondition(exact(ima1).domain() == exact(ima2).domain());
- metal::vec<2, I*> imas;
- imas[0] = & exact(ima1);
- imas[1] = & exact(ima2);
- stack_image<2, I> tmp(imas);
- return tmp;
+ metal::vec<2, I> imas;
+ imas[0] = exact(ima1);
+ imas[1] = exact(ima2);
+ return imas;
}
# endif // ! MLN_INCLUDE_ONLY
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-20 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add test for border fill.
* test_border_fill_image1d_1.cc,
* test_border_fill_image1d_2.cc,
* test_border_fill_image1d_3.cc,
* test_border_fill_image1d_4.cc,
* test_border_fill_image1d_5.cc,
* test_border_fill_image2d_1.cc,
* test_border_fill_image2d_2.cc,
* test_border_fill_image2d_3.cc,
* test_border_fill_image2d_4.cc,
* test_border_fill_image3d_1.cc,
* test_border_fill_image3d_2.cc,
* test_border_fill_image3d_3.cc,
* test_border_fill_image3d_4.cc: New tests.
* border_fill.cc: Update.
---
border_fill.cc | 8 ---
test_border_fill_image1d_1.cc | 51 ++++++++++++++++++++++++
test_border_fill_image1d_2.cc | 50 +++++++++++++++++++++++
test_border_fill_image1d_3.cc | 54 +++++++++++++++++++++++++
test_border_fill_image1d_4.cc | 55 +++++++++++++++++++++++++
test_border_fill_image1d_5.cc | 54 +++++++++++++++++++++++++
test_border_fill_image2d_1.cc | 51 ++++++++++++++++++++++++
test_border_fill_image2d_2.cc | 50 +++++++++++++++++++++++
test_border_fill_image2d_3.cc | 54 +++++++++++++++++++++++++
test_border_fill_image2d_4.cc | 54 +++++++++++++++++++++++++
test_border_fill_image3d_1.cc | 87 +++++++++++++++++++++++++++++++++++++++++
test_border_fill_image3d_2.cc | 86 ++++++++++++++++++++++++++++++++++++++++
test_border_fill_image3d_3.cc | 89 ++++++++++++++++++++++++++++++++++++++++++
test_border_fill_image3d_4.cc | 88 +++++++++++++++++++++++++++++++++++++++++
14 files changed, 823 insertions(+), 8 deletions(-)
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_1.cc (revision 1144)
@@ -0,0 +1,87 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image3d_b.hh>
+#include <mln/value/int_u8.hh>
+
+namespace mln
+{
+
+ namespace debug
+ {
+ template <typename I>
+ void print_3d_with_border (const Fast_Image<I>& input_)
+ {
+ const I& ima = exact(input_);
+ mln_precondition(ima.has_data());
+
+ typedef mln_point(I) P;
+
+ std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
+ std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
+ std::size_t border = ima.border ();
+ std::size_t real_len_s = len_s + 2 * border;
+ std::size_t real_len_r = len_r + 2 * border;
+ std::size_t real_len_c = len_c + 2 * border;
+
+ for (std::size_t k = 0; k < real_len_s; ++k)
+ {
+ for (std::size_t j = 0; j < real_len_c; ++j)
+ {
+ for (std::size_t i = 0; i < real_len_r; ++i)
+ std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
+ << " ";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ }
+}
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 3d size=2x3x1 in value::int_u8"
+ << std::endl
+ << std::endl;
+ image3d_b<value::int_u8> i4(2, 3, 1, 2);
+ border::fill (i4, 7);
+ debug::print_3d_with_border(i4);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image1d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image1d_3.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image1d_3.cc (revision 1144)
@@ -0,0 +1,54 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include <mln/core/image1d_b.hh>
+#include "border_fill.hh"
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl;
+ std::cout << "Test 1d size= box [2 .. 4] with border=6 in int"
+ << std::endl;
+
+ box1d b(make::point1d(2), make::point1d(4));
+ image1d_b<int> ima(b, 6);
+
+ border::fill (ima, 9);
+ std::cout << std::endl;
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image2d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image2d_3.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image2d_3.cc (revision 1144)
@@ -0,0 +1,54 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image2d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 2d size=[(2,6) .. (3,8)] with border=3 in int"
+ << std::endl
+ << std::endl;
+
+ box2d b(make::point2d(2, 6), make::point2d(3, 8));
+ image2d_b<int> ima(b, 3);
+
+ border::fill (ima, 8);
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image1d_5.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image1d_5.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image1d_5.cc (revision 1144)
@@ -0,0 +1,54 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include <mln/core/image1d_b.hh>
+#include "border_fill.hh"
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl;
+ std::cout << "Test 1d size= box [2 .. 4] with border=0 in int"
+ << std::endl;
+
+ box1d b(make::point1d(2), make::point1d(4));
+ image1d_b<int> ima(b, 0);
+
+ border::fill (ima, 9);
+ std::cout << std::endl;
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_3.cc (revision 1144)
@@ -0,0 +1,89 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image3d_b.hh>
+#include <mln/value/int_u8.hh>
+
+namespace mln
+{
+
+ namespace debug
+ {
+ template <typename I>
+ void print_3d_with_border (const Fast_Image<I>& input_)
+ {
+ const I& ima = exact(input_);
+ mln_precondition(ima.has_data());
+
+ typedef mln_point(I) P;
+
+ std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
+ std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
+ std::size_t border = ima.border ();
+ std::size_t real_len_s = len_s + 2 * border;
+ std::size_t real_len_r = len_r + 2 * border;
+ std::size_t real_len_c = len_c + 2 * border;
+
+ for (std::size_t k = 0; k < real_len_s; ++k)
+ {
+ for (std::size_t j = 0; j < real_len_c; ++j)
+ {
+ for (std::size_t i = 0; i < real_len_r; ++i)
+ std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
+ << " ";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ }
+}
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 3d size=[(2,6,1) .. (3,8,3)] border=1 in value::int_u8"
+ << std::endl
+ << std::endl;
+
+ box3d b(make::point3d(2, 6, 1), make::point3d(3, 8, 3));
+ image3d_b<value::int_u8> i4(b, 1);
+ border::fill (i4, 2);
+ debug::print_3d_with_border(i4);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image1d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image1d_2.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image1d_2.cc (revision 1144)
@@ -0,0 +1,50 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image1d_b.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl;
+ std::cout << "Test 1d size=8 with border=3 in int"
+ << std::endl;
+ std::cout << std::endl;
+ image1d_b<int> i5(8);
+ border::fill (i5, 1);
+ debug::println_with_border(i5);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image2d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image2d_2.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image2d_2.cc (revision 1144)
@@ -0,0 +1,50 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image2d_b.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 2d size=2x3 in int"
+ << std::endl
+ << std::endl;
+ image2d_b<int> i2(2, 3);
+ border::fill (i2, 5);
+ debug::println_with_border(i2);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_2.cc (revision 1144)
@@ -0,0 +1,86 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image3d_b.hh>
+
+namespace mln
+{
+
+ namespace debug
+ {
+ template <typename I>
+ void print_3d_with_border (const Fast_Image<I>& input_)
+ {
+ const I& ima = exact(input_);
+ mln_precondition(ima.has_data());
+
+ typedef mln_point(I) P;
+
+ std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
+ std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
+ std::size_t border = ima.border ();
+ std::size_t real_len_s = len_s + 2 * border;
+ std::size_t real_len_r = len_r + 2 * border;
+ std::size_t real_len_c = len_c + 2 * border;
+
+ for (std::size_t k = 0; k < real_len_s; ++k)
+ {
+ for (std::size_t j = 0; j < real_len_c; ++j)
+ {
+ for (std::size_t i = 0; i < real_len_r; ++i)
+ std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
+ << " ";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ }
+}
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 3d size=2x3x1 with border=1 in int"
+ << std::endl
+ << std::endl;
+ image3d_b<int> i3(2, 3, 1, 1);
+ border::fill (i3, 6);
+ debug::print_3d_with_border(i3);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image1d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image1d_4.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image1d_4.cc (revision 1144)
@@ -0,0 +1,55 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include <mln/core/image1d_b.hh>
+#include "border_fill.hh"
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl;
+ std::cout << "Test 1d size= box [-6 .. -3] with border=6 in value::int_u8"
+ << std::endl;
+
+ box1d b(make::point1d(-6), make::point1d(-3));
+ image1d_b<value::int_u8> ima(b, 6);
+
+// image1d_b<value::int_u8> ima(5);
+ border::fill (ima, 7);
+ std::cout << std::endl;
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image2d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image2d_4.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image2d_4.cc (revision 1144)
@@ -0,0 +1,54 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image2d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 2d size=[(-6,-3) .. (-2,-1)] with border=3 in value::int_u8"
+ << std::endl
+ << std::endl;
+
+ box2d b(make::point2d(-6, -3), make::point2d(-2, -1));
+ image2d_b<value::int_u8> ima(b, 3);
+
+ border::fill (ima, 3);
+ debug::println_with_border(ima);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image3d_4.cc (revision 1144)
@@ -0,0 +1,88 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image3d_b.hh>
+
+namespace mln
+{
+
+ namespace debug
+ {
+ template <typename I>
+ void print_3d_with_border (const Fast_Image<I>& input_)
+ {
+ const I& ima = exact(input_);
+ mln_precondition(ima.has_data());
+
+ typedef mln_point(I) P;
+
+ std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
+ std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
+ std::size_t border = ima.border ();
+ std::size_t real_len_s = len_s + 2 * border;
+ std::size_t real_len_r = len_r + 2 * border;
+ std::size_t real_len_c = len_c + 2 * border;
+
+ for (std::size_t k = 0; k < real_len_s; ++k)
+ {
+ for (std::size_t j = 0; j < real_len_c; ++j)
+ {
+ for (std::size_t i = 0; i < real_len_r; ++i)
+ std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
+ << " ";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ }
+}
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 3d size=[(-7,-8,-6) .. (-5,-4,-1 )] border=1 in int"
+ << std::endl
+ << std::endl;
+
+ box3d b(make::point3d(-7, -8, -6), make::point3d(-5, -4, -1));
+ image3d_b<int> i4(b, 1);
+ border::fill (i4, 2);
+ debug::print_3d_with_border(i4);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/border_fill.cc
===================================================================
--- trunk/milena/sandbox/duhamel/border_fill.cc (revision 1143)
+++ trunk/milena/sandbox/duhamel/border_fill.cc (revision 1144)
@@ -74,14 +74,6 @@
main (void)
{
-
-
- std::cout << "Test 2d size=2x3 in value::int_u8"
- << std::endl;
- image2d_b<value::int_u8> i1(2, 3);
- border::fill (i1, 8);
- debug::println_with_border(i1);
-
std::cout << "Test 2d size=2x3 in int"
<< std::endl;
image2d_b<int> i2(2, 3);
Index: trunk/milena/sandbox/duhamel/test_border_fill_image1d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image1d_1.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image1d_1.cc (revision 1144)
@@ -0,0 +1,51 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image1d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl;
+ std::cout << "Test 1d size=5 with border=3 in value::int_u8"
+ << std::endl;
+ image1d_b<value::int_u8> i6(5);
+ border::fill (i6, 9);
+ std::cout << std::endl;
+ debug::println_with_border(i6);
+ std::cout << std::endl;
+}
Index: trunk/milena/sandbox/duhamel/test_border_fill_image2d_1.cc
===================================================================
--- trunk/milena/sandbox/duhamel/test_border_fill_image2d_1.cc (revision 0)
+++ trunk/milena/sandbox/duhamel/test_border_fill_image2d_1.cc (revision 1144)
@@ -0,0 +1,51 @@
+// 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/border_fill.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include "border_fill.hh"
+#include <mln/core/image2d_b.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ std::cout << std::endl
+ << "Test 2d size=2x3 in value::int_u8"
+ << std::endl
+ << std::endl;
+ image2d_b<value::int_u8> i1(2, 3);
+ border::fill (i1, 8);
+ debug::println_with_border(i1);
+ std::cout << std::endl;
+}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-20 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Fix duplicate border.
* border_duplicate.cc: Test for duplicate 3d.
* border_duplicate.hh: Fix for 1d and 3d.
* labeling_level_fast.cc: Update.
---
border_duplicate.cc | 61 +++++++++++++++----
border_duplicate.hh | 156 ++++++++++++++++++++++++++++++++++++++++++++++++-
labeling_level_fast.cc | 6 +
3 files changed, 207 insertions(+), 16 deletions(-)
Index: trunk/milena/sandbox/duhamel/border_duplicate.cc
===================================================================
--- trunk/milena/sandbox/duhamel/border_duplicate.cc (revision 1142)
+++ trunk/milena/sandbox/duhamel/border_duplicate.cc (revision 1143)
@@ -31,31 +31,68 @@
*/
#include "border_duplicate.hh"
+#include "border_fill.hh"
+#include <mln/core/image3d_b.hh>
#include <mln/core/image2d_b.hh>
+#include <mln/core/image1d_b.hh>
#include <mln/value/int_u8.hh>
#include <mln/pw/all.hh>
#include <mln/debug/println_with_border.hh>
+#include <mln/debug/iota.hh>
using namespace mln;
+template <typename I>
+void print_3d_with_border (const Fast_Image<I>& input_)
+{
+ const I& ima = exact(input_);
+ mln_precondition(ima.has_data());
+
+ typedef mln_point(I) P;
+
+ std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
+ std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 2);
+ std::size_t border = ima.border ();
+ std::size_t real_len_s = len_s + 2 * border;
+ std::size_t real_len_r = len_r + 2 * border;
+ std::size_t real_len_c = len_c + 2 * border;
+
+ for (std::size_t k = 0; k < real_len_s; ++k)
+ {
+ for (std::size_t j = 0; j < real_len_c; ++j)
+ {
+ for (std::size_t i = 0; i < real_len_r; ++i)
+ std::cout << ima[k * (real_len_r * real_len_c) + j * real_len_r + i]
+ << " ";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+}
+
int
main (void)
{
- image2d_b<value::int_u8> i1(10000, 1000);
- // Fill with randomized value.
-// for (unsigned int i = 0; i < i1.ncells (); ++i)
-// i1[i] = i;//(i * 4452) % 10;
-// std::cout << "before duplicate"
-// << std::endl
-// << std::endl;
-// debug::println_with_border(i1);
+ image3d_b<value::int_u8> i1(2, 3, 4, 2);
+ std::cerr << i1.ncells ()
+ << std::endl;
+ for (std::size_t i = 0; i < i1.ncells (); ++i)
+ i1[i] = i % 9 + 1;
+
+ border::fill (i1, 0);
+ std::cout << "before duplicate"
+ << std::endl
+ << std::endl;
+ print_3d_with_border(i1);
border::duplicate (i1);
-// std::cout << "after duplicate"
-// << std::endl
-// << std::endl;
-// debug::println_with_border(i1);
+ std::cout << "after duplicate"
+ << std::endl
+ << std::endl;
+ print_3d_with_border(i1);
}
Index: trunk/milena/sandbox/duhamel/border_duplicate.hh
===================================================================
--- trunk/milena/sandbox/duhamel/border_duplicate.hh (revision 1142)
+++ trunk/milena/sandbox/duhamel/border_duplicate.hh (revision 1143)
@@ -65,8 +65,11 @@
# ifndef MLN_INCLUDE_ONLY
+ namespace impl
+ {
+
template <typename I>
- void duplicate(const Fast_Image<I>& ima_)
+ void duplicate_(const Fast_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -127,10 +130,159 @@
for (std::size_t i = 0; i <= border; ++i)
for (std::size_t j = 0; j <= border; ++j)
const_cast<I&>(ima)[s + i + (j * real_nbcols)] = ima[s];
+ //END FIX
+ }
+
+ template <typename I>
+ void duplicate_1d_(const Fast_Image<I>& ima_)
+ {
+ const I& ima = exact(ima_);
+ mln_precondition(ima.has_data());
+ typedef mln_point(I) P;
+ typename I::line_piter pl(ima.domain());
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 1);
+ std::size_t border = ima.border ();
+ for (std::size_t i = 0; i < border; ++i)
+ const_cast<I&>(ima)[i] = ima[border];
- //END FIX
+ std::size_t st = border + len_c - 1;
+ for (std::size_t i = st + 1; i < ima.ncells (); ++i)
+ const_cast<I&>(ima)[i] = ima[st];
+ }
+
+ template <typename I>
+ void duplicate_2d_(const Fast_Image<I>& ima_)
+ {
+ const I& ima = exact(ima_);
+ mln_precondition(ima.has_data());
+
+ typedef mln_point(I) P;
+ typename I::line_piter pl(ima.domain());
+ std::size_t border = ima.border ();
+ std::size_t border_2x = 2 * ima.border ();
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_r = exact(ima).bbox().len(P::dim - 2);
+ std::size_t real_len_c = len_c + border_2x;
+
+
+ pl.start ();
+
+ // Duplicate first line
+ std::size_t st = ima.offset_at (pl);
+ for (std::size_t i = 0; i < border; ++i)
+ const_cast<I&>(ima)[i] = ima[st];
+
+ std::size_t end = len_c + border;
+ for (std::size_t i = 0; i < len_c; ++i)
+ const_cast<I&>(ima)[border + i] = ima[st + i];
+
+ end = len_c + border * 2;
+ for (std::size_t i = len_c + border; i < end; ++i)
+ const_cast<I&>(ima)[i] = ima[len_c + border - 1];
+
+ // Duplicate n * border line
+ for (std::size_t k = 1; k < border; ++k)
+ for (std::size_t i = 0; i < real_len_c; ++i)
+ const_cast<I&>(ima)[k * real_len_c + i] = ima[i];
+
+ // Duplicate
+ for_all (pl)
+ {
+ st = ima.offset_at (pl);
+ for (std::size_t i = 1; i <= border; ++i)
+ const_cast<I&>(ima)[st - i] = ima[st];
+ st = st + len_c - 1;
+ for (std::size_t i = 1; i <= border; ++i)
+ const_cast<I&>(ima)[st + i] = ima[st];
+ }
+
+ // Duplicate n last * border line
+ st = real_len_c * (border + len_r - 1);
+ for (std::size_t k = 1; k <= border; ++k)
+ for (std::size_t i = st; i < st + real_len_c; ++i)
+ const_cast<I&>(ima)[k * real_len_c + i] = ima[i];
+ }
+
+ template <typename I>
+ void duplicate_3d_(const Fast_Image<I>& ima_)
+ {
+ const I& ima = exact(ima_);
+ mln_precondition(ima.has_data());
+
+ typedef mln_point(I) P;
+ typename I::line_piter pl(ima.domain());
+ std::size_t border = ima.border ();
+ std::size_t border_2x = 2 * ima.border ();
+ std::size_t len_c = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_r = exact(ima).bbox().len(P::dim - 2);
+ std::size_t len_s = exact(ima).bbox().len(P::dim - 3);
+ std::size_t real_len_c = len_c + border_2x;
+ std::size_t real_len_r = len_r + border_2x;
+ std::size_t face = real_len_c * real_len_r;
+ std::size_t st;
+
+ pl.start ();
+
+ for (std::size_t k = 0; k < len_s; ++k)
+ {
+
+ // Duplicate
+ for (std::size_t j = 0; j < len_r; ++j)
+ {
+ st = ima.offset_at (pl);
+ for (std::size_t i = 1; i <= border; ++i)
+ const_cast<I&>(ima)[st - i] = ima[st];
+ st = st + len_c - 1;
+ for (std::size_t i = 1; i <= border; ++i)
+ const_cast<I&>(ima)[st + i] = ima[st];
+ pl.next ();
+ }
+
+ // Duplicate n last * border line
+ st = border * face + k * face + border * real_len_c ;
+ for (std::size_t j = 1; j <= border; ++j)
+ for (std::size_t i = 0; i < real_len_c; ++i)
+ const_cast<I&>(ima)[st - j * real_len_c + i] = ima[st + i];
+
+ // Duplicate n last * border line
+ st = border * face + k * face + (len_r + border - 1) * real_len_c ;
+ for (std::size_t j = 1; j <= border; ++j)
+ for (std::size_t i = 0; i < real_len_c; ++i)
+ const_cast<I&>(ima)[st + j * real_len_c + i] = ima[st + i];
+ }
+
+ // Duplicate n first * border face
+ st = border * face;
+ for (std::size_t k = 0; k < border; ++k)
+ for (std::size_t i = 0; i < face; ++i)
+ const_cast<I&>(ima)[k * face + i] = ima[st + i];
+
+ // Duplicate n last * border face
+ st = (len_s + border - 1) * face;
+ for (std::size_t k = 1; k <= border; ++k)
+ for (std::size_t i = 0; i < face; ++i)
+ const_cast<I&>(ima)[st + k * face + i] = ima[st + i];
+ }
+
+
+
+ } // end of namespace mln::border::impl
+
+
+ // Facade.
+
+ template <typename I>
+ void duplicate(const Fast_Image<I>& ima_)
+ {
+ typedef mln_point(I) P;
+ if (P::dim == 1)
+ impl::duplicate_1d_(ima_);
+ if (P::dim == 2)
+ impl::duplicate_2d_(ima_);
+ if (P::dim == 3)
+ impl::duplicate_3d_(ima_);
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/sandbox/duhamel/labeling_level_fast.cc
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_level_fast.cc (revision 1142)
+++ trunk/milena/sandbox/duhamel/labeling_level_fast.cc (revision 1143)
@@ -31,6 +31,7 @@
*/
#include <mln/core/image2d_b.hh>
+#include <mln/core/image1d_b.hh>
#include <mln/core/neighb2d.hh>
#include <mln/value/int_u8.hh>
#include <mln/pw/all.hh>
@@ -52,9 +53,10 @@
unsigned border = 1;
- image2d_b<value::int_u8> i1(3, 3, border);
+ image2d_b<value::int_u8> i1(5, 5, border);
debug::iota(i1);
- i1[12] = i1[18] = 2;
+ i1[10] = i1[17] = i1[18] = i1[25] = i1[26] = i1[22] = i1[29] = 2;
+ // i1[5] = i1[6] = 2;
debug::println_with_border(i1);
unsigned n;
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-20 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Add props for vector and matrix
* mln/make/vec.hh: The new constructor fill any vector.
* mln/value/props.hh: Update.
---
make/vec.hh | 20 +++++++++++---------
value/props.hh | 28 +++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 10 deletions(-)
Index: trunk/milena/mln/value/props.hh
===================================================================
--- trunk/milena/mln/value/props.hh (revision 1141)
+++ trunk/milena/mln/value/props.hh (revision 1142)
@@ -41,6 +41,9 @@
# include <mln/core/macros.hh>
# include <mln/value/kind.hh>
# include <mln/metal/bool.hh>
+# include <mln/metal/vec.hh>
+# include <mln/metal/mat.hh>
+# include <mln/metal/binary_arith_trait.hh>
/// Get the minimum value of type \c T.
@@ -154,7 +157,7 @@
{
static const signed short min() { return -32768; }
static const signed short max() { return 32767; }
- static const std::size_t card_ = 655356;
+ static const std::size_t card_ = 65536;
typedef data_kind kind;
typedef float sum;
};
@@ -224,6 +227,29 @@
typedef double sum;
};
+ // records
+
+ template <>
+ template <unsigned n, typename T>
+ struct props<metal::vec<n,T> >
+ {
+ static const metal::vec<n,T> min() { return make::vec<n>(mln_min(T)); }
+ static const metal::vec<n,T> max() { return make::vec<n>(mln_max(T)); }
+ typedef data_kind kind;
+ static const std::size_t card_ = n * mln_card_(T);
+ typedef binary_arith_trait<float,T> sum;
+ };
+
+ template <unsigned n, unsigned m, typename T>
+ struct props<metal::mat<n,m,T> >
+ {
+ static const metal::mat<n,m,T> min() { return make::mat<n,m>(mln_min(T)); }
+ static const metal::mat<n,m,T> max() { return make::mat<n,m>(mln_max(T)); }
+ typedef data_kind kind;
+ static const std::size_t card_ = n * m * mln_card_(T);
+ typedef binary_arith_trait<float,T> sum;
+ };
+
} // end of namespace mln::value
} // end of namespace mln
Index: trunk/milena/mln/make/vec.hh
===================================================================
--- trunk/milena/mln/make/vec.hh (revision 1141)
+++ trunk/milena/mln/make/vec.hh (revision 1142)
@@ -41,14 +41,15 @@
namespace make
{
- /*! \brief Create an mln::metal::vec<1,T>.
+
+ /*! \brief Create an mln::metal::vec<n,T>.
*
- * \param[in] v_0 First coordinate.
+ * \param[in] v Value.
*
- * \return A 1D vector.
+ * \return A nD vector filled with \p v.
*/
- template <typename T>
- metal::vec<1, T> vec(const T& v_0);
+ template <unsigned n, typename T>
+ metal::vec<n, T> vec(const T& v);
/*! \brief Create an mln::metal::vec<2,T>.
*
@@ -86,11 +87,12 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename T>
- metal::vec<1, T> vec(const T& v_0)
+ template <unsigned n, typename T>
+ metal::vec<n, T> vec(const T& v)
{
- metal::vec<1, T> tmp;
- tmp[0] = v_0;
+ metal::vec<n, T> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ tmp[i] = v;
return tmp;
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-19 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Add matrix handling and rewrite of vectors
* mln/make/mat.hh,
* mln/metal/mat.hh: Matrix handling.
* mln/make/vec.hh,
* mln/metal/vec.hh: Rewrite.
* tests/metal_mat.cc: New.
---
mln/make/mat.hh | 72 +++++++++++
mln/make/vec.hh | 24 +--
mln/metal/mat.hh | 321 +++++++++++++++++++++++++++++++++++++++++++++++++++++
mln/metal/vec.hh | 50 ++++++--
tests/metal_mat.cc | 53 ++++++++
5 files changed, 498 insertions(+), 22 deletions(-)
Index: trunk/milena/tests/metal_mat.cc
===================================================================
--- trunk/milena/tests/metal_mat.cc (revision 0)
+++ trunk/milena/tests/metal_mat.cc (revision 1141)
@@ -0,0 +1,53 @@
+// 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/level_median.cc
+ *
+ * \brief Test on mln::median::median_dir.
+ */
+
+#include <mln/metal/mat.hh>
+
+int main()
+{
+ using namespace mln;
+
+ const int
+ tab1[18] = {3, 6, 5, 2, 4, 8,
+ 5, 7, 4, 6, 9, 2,
+ 2, 7, 1, 1, 5, 3},
+ tab2[6] = {2, 5, 1, 0, 7, 2},
+ tab3[6] = {3, 1, 6, 2, 1, 0};
+
+ metal::mat<3,6,int> mat36 = make::mat<3,6,18>(tab1);
+ metal::mat<2,3,int> mat23_1 = make::mat<2,3,6>(tab2);
+ metal::mat<2,3,int> mat23_2 = make::mat<2,3,6>(tab3);
+
+ metal::mat<2,3,float> mat23_3 = mat23_1 - mat23_2;
+
+ std::cout << mat23_3 << std::endl << mat23_3 * mat36 << std::endl;
+}
Index: trunk/milena/mln/metal/mat.hh
===================================================================
--- trunk/milena/mln/metal/mat.hh (revision 0)
+++ trunk/milena/mln/metal/mat.hh (revision 1141)
@@ -0,0 +1,321 @@
+// Copyright (C) 2006 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_METAL_MAT_HH
+# define MLN_METAL_MAT_HH
+
+# include <iostream>
+
+# include <mln/core/contract.hh>
+# include <mln/metal/binary_arith_trait.hh>
+
+// FIXME: Document.
+
+namespace mln
+{
+
+ namespace metal
+ {
+
+ template <unsigned n, unsigned m, typename T>
+ class mat
+ {
+ public:
+
+ typedef T value_type;
+ enum {N = n, M = m};
+
+ mat()
+ {
+ }
+
+ template <typename U>
+ mat(const mat<n,m,U>& rhs);
+
+ template <typename U>
+ mat& operator=(const mat<n,m,U>& rhs);
+
+ const T& operator()(unsigned i, unsigned j) const;
+
+ T& operator()(unsigned i, unsigned j);
+
+ void set_all(const T& val);
+
+ unsigned size() const;
+
+ private:
+ T data_[n][m];
+ };
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned n, unsigned m, typename T>
+ template <typename U>
+ mat<n,m,T>::mat(const mat<n,m,U>& rhs)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ data_[i][j] = rhs(i, j);
+ }
+
+ template <unsigned n, unsigned m, typename T>
+ template <typename U>
+ mat<n,m,T>&
+ mat<n,m,T>::operator=(const mat<n,m,U>& rhs)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ data_[i][j] = rhs(i, j);
+ return *this;
+ }
+
+ template <unsigned n, unsigned m, typename T>
+ const T&
+ mat<n,m,T>::operator()(unsigned i, unsigned j) const
+ {
+ mln_precondition(i < n && j < m);
+ return data_[i][j];
+ }
+
+ template <unsigned n, unsigned m, typename T>
+ T&
+ mat<n,m,T>::operator()(unsigned i, unsigned j)
+ {
+ mln_precondition(i < n && j < m);
+ return data_[i][j];
+ }
+
+ template <unsigned n, unsigned m, typename T>
+ void mat<n,m,T>::set_all(const T& val)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ data_[i][j] = val;
+ }
+
+ template <unsigned n, unsigned m, typename T>
+ unsigned mat<n,m,T>::size() const
+ {
+ return n * m;
+ }
+
+ // eq
+
+ template <unsigned n, unsigned m, typename T, typename U>
+ bool
+ operator==(const mat<n,m,T>& lhs, const mat<n,m,U>& rhs)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ if (lhs(i, j) != rhs(i, j))
+ return false;
+ return true;
+ }
+
+ template <unsigned n, unsigned m, typename T, typename U>
+ bool
+ operator!=(const mat<n,m,T>& lhs, const mat<n,m,U>& rhs)
+ {
+ return not (lhs == rhs);
+ }
+
+ // +
+
+ template <unsigned n, unsigned m, typename T, typename U>
+ mat<n,m,T>&
+ operator+=(mat<n,m,T>& lhs, const mat<n,m,U>& rhs)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ lhs(i, j) += rhs(i, j);
+ return lhs;
+ }
+ template <unsigned n, unsigned m, typename T, typename U>
+ mat<n,m,typename binary_arith_trait<T,U>::ret>
+ operator+(mat<n,m,T>& lhs, const mat<n,m,U>& rhs)
+ {
+ mat<n,m,typename binary_arith_trait<T,U>::ret> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ tmp[i][j] = lhs(i, j) + rhs(i, j);
+ return tmp;
+ }
+
+ // -
+
+ template <unsigned n, unsigned m, typename T, typename U>
+ mat<n,m,T>&
+ operator-=(mat<n,m,T>& lhs, const mat<n,m,U>& rhs)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ lhs(i, j) -= rhs(i, j);
+ return lhs;
+ }
+ template <unsigned n, unsigned m, typename T, typename U>
+ mat<n,m,typename binary_arith_trait<T,U>::ret>
+ operator-(mat<n,m,T>& lhs, const mat<n,m,U>& rhs)
+ {
+ mat<n,m,typename binary_arith_trait<T,U>::ret> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ tmp(i, j) = lhs(i, j) - rhs(i, j);
+ return tmp;
+ }
+
+ template <unsigned n, unsigned m, typename T>
+ mat<n,m,T>
+ operator-(const mat<n,m,T>& lhs)
+ {
+ mat<n,m,T> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; i < m; ++i)
+ tmp(i, j) = - lhs(i, j);
+ return tmp;
+ }
+
+ // *
+
+ template <unsigned n, unsigned m, typename T, typename U>
+ mat<n,m,T>&
+ operator*=(mat<n,m,T>& lhs, const U& scalar)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ lhs(i, j) *= scalar;
+ return lhs;
+ }
+ template <unsigned n, unsigned m, typename T, typename U>
+ mat<n,m,typename binary_arith_trait<T,U>::ret>
+ operator*(mat<n,m,T>& lhs, const U& scalar)
+ {
+ mat<n,m,typename binary_arith_trait<T,U>::ret> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ tmp[i][j] = lhs(i, j) * scalar;
+ return tmp;
+ }
+
+ template <unsigned n, unsigned m, unsigned o, typename T, typename U>
+ mat<n,m,T>&
+ operator*=(mat<n,o,T>& lhs, mat<o,m,U>& rhs)
+ {
+ lhs = lhs * rhs;
+ return lhs;
+ }
+ template <unsigned n, unsigned m, unsigned o, typename T, typename U>
+ mat<n,m,typename binary_arith_trait<T,U>::ret>
+ operator*(mat<n,o,T>& lhs, mat<o,m,U>& rhs)
+ {
+ mat<n,m,typename binary_arith_trait<T,U>::ret> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ {
+ tmp(i, j) = 0;
+ for (unsigned k = 0; k < o; ++k)
+ tmp(i, j) += lhs(i, k) * rhs(k, j);
+ }
+ return tmp;
+ }
+
+ // /
+
+ template <unsigned n, unsigned m, typename T, typename U>
+ mat<n,m,T>
+ operator/=(mat<n,m,T>& lhs, const U& scalar)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ lhs(i, j) /= scalar;
+ return lhs;
+ }
+ template <unsigned n, unsigned m, typename T, typename U>
+ mat<n,m,typename binary_arith_trait<T,U>::ret>
+ operator/(mat<n,m,T>& lhs, const U& scalar)
+ {
+ mat<n,m,typename binary_arith_trait<T,U>::ret> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ for (unsigned j = 0; j < m; ++j)
+ tmp[i][j] = lhs(i, j) / scalar;
+ return tmp;
+ }
+
+ // <<
+
+ template <unsigned n, unsigned m, typename T>
+ std::ostream&
+ operator<<(std::ostream& ostr, const mat<n,m,T>& v)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ {
+ ostr << '(';
+ for (unsigned j = 0; j < m; ++j)
+ ostr << v(i, j) << (j == m - 1 ? ")" : ", ");
+ ostr << std::endl;
+ }
+ return ostr;
+ }
+
+ template <unsigned n, unsigned m>
+ std::ostream&
+ operator<<(std::ostream& ostr, const mat<n,m,unsigned char>& v)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ {
+ ostr << '(';
+ for (unsigned j = 0; j < m; ++j)
+ ostr << (unsigned int)(v[i][j]) << (j == m - 1 ? ")" : ", ");
+ ostr << std::endl;
+ }
+ return ostr;
+ }
+
+ template <unsigned n, unsigned m>
+ std::ostream&
+ operator<<(std::ostream& ostr, const mat<n,m,signed char>& v)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ {
+ ostr << '(';
+ for (unsigned j = 0; j < m; ++j)
+ ostr << (signed int)(v[i][j]) << (j == m - 1 ? ")" : ", ");
+ ostr << std::endl;
+ }
+ return ostr;
+ }
+
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::metal
+
+} // end of namespace mln
+
+# include <mln/make/mat.hh>
+
+#endif // ! MLN_METAL_MAT_HH
Index: trunk/milena/mln/metal/vec.hh
===================================================================
--- trunk/milena/mln/metal/vec.hh (revision 1140)
+++ trunk/milena/mln/metal/vec.hh (revision 1141)
@@ -126,48 +126,78 @@
{
}
+ vec(const vec<n, T>& rhs);
+
+ template <typename U>
+ vec(const vec<n, U>& rhs);
+
+ template <typename U>
+ vec& operator=(const vec<n, U>& rhs);
+
+ const T& operator[](unsigned i) const;
+
+ T& operator[](unsigned i);
+
+ void set_all(const T& val);
+
+ unsigned size() const;
+
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned n, typename T>
+ vec<n,T>::vec(const vec<n,T>& rhs)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ data_[i] = rhs[i];
+ }
+
+ template <unsigned n, typename T>
template <typename U>
- vec(const vec<n, U>& rhs)
+ vec<n,T>::vec(const vec<n, U>& rhs)
{
for (unsigned i = 0; i < n; ++i)
data_[i] = rhs[i];
}
+ template <unsigned n, typename T>
template <typename U>
- vec& operator=(const vec<n, U>& rhs)
+ vec<n,T>& vec<n,T>::operator=(const vec<n, U>& rhs)
{
for (unsigned i = 0; i < n; ++i)
data_[i] = rhs[i];
return *this;
}
- const T& operator[](unsigned i) const
+ template <unsigned n, typename T>
+ const T& vec<n,T>::operator[](unsigned i) const
{
mln_precondition(i < dim);
return data_[i];
}
- T& operator[](unsigned i)
+ template <unsigned n, typename T>
+ T& vec<n,T>::operator[](unsigned i)
{
mln_precondition(i < dim);
return data_[i];
}
- void set_all(const T& val)
+ template <unsigned n, typename T>
+ void vec<n,T>::set_all(const T& val)
{
for (unsigned i = 0; i < n; ++i)
data_[i] = val;
}
- unsigned size() const
+ template <unsigned n, typename T>
+ unsigned vec<n,T>::size() const
{
return n;
}
- };
-
-
-# ifndef MLN_INCLUDE_ONLY
// eq
Index: trunk/milena/mln/make/mat.hh
===================================================================
--- trunk/milena/mln/make/mat.hh (revision 0)
+++ trunk/milena/mln/make/mat.hh (revision 1141)
@@ -0,0 +1,72 @@
+// Copyright (C) 2006 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_MAKE_MAT_HH
+# define MLN_MAKE_MAT_HH
+
+/*! \file mln/make/mat.hh
+ *
+ * \brief Routine to construct an mln::metal::mat.
+ */
+
+# include <mln/metal/mat.hh>
+
+namespace mln
+{
+
+ namespace make
+ {
+ /*! \brief Create an mln::metal::mat<n,m,T>.
+ *
+ * \param[in] tab Tab of value.
+ *
+ * \pre The dimension table N is such as N = n * m
+ * with n and m, the dimensions oh the matrix.
+ */
+ template <unsigned n, unsigned m, unsigned N, typename T>
+ metal::mat<n,m,T> mat(const T tab[N]);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned n, unsigned m, unsigned N, typename T>
+ metal::mat<n,m,T> mat(const T tab[N])
+ {
+ mln_precondition(n * m == N);
+ metal::mat<n,m,T> tmp;
+ for (unsigned i = 0; i < N; ++i)
+ tmp(i / m, i % m) = tab[i];
+ return tmp;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::make
+
+} // end of namespace mln
+
+#endif // ! MLN_MAKE_MAT_HH
Index: trunk/milena/mln/make/vec.hh
===================================================================
--- trunk/milena/mln/make/vec.hh (revision 1140)
+++ trunk/milena/mln/make/vec.hh (revision 1141)
@@ -48,7 +48,7 @@
* \return A 1D vector.
*/
template <typename T>
- mln::metal::vec<1, T> vec(const T& v_0);
+ metal::vec<1, T> vec(const T& v_0);
/*! \brief Create an mln::metal::vec<2,T>.
*
@@ -58,7 +58,7 @@
* \return A 2D vector.
*/
template <typename T>
- mln::metal::vec<2, T> vec(const T& v_0, const T& v_1);
+ metal::vec<2, T> vec(const T& v_0, const T& v_1);
/*! \brief Create an mln::metal::vec<3,T>.
*
@@ -69,7 +69,7 @@
* \return A 3D vector.
*/
template <typename T>
- mln::metal::vec<3, T> vec(const T& v_0, const T& v_1, const T& v_2);
+ metal::vec<3, T> vec(const T& v_0, const T& v_1, const T& v_2);
/*! \brief Create an mln::metal::vec<4,T>.
*
@@ -81,32 +81,32 @@
* \return A 4D vector.
*/
template <typename T>
- mln::metal::vec<4, T> vec(const T& v_0, const T& v_1, const T& v_2, const T& v_3);
+ metal::vec<4, T> vec(const T& v_0, const T& v_1, const T& v_2, const T& v_3);
# ifndef MLN_INCLUDE_ONLY
template <typename T>
- mln::metal::vec<1, T> vec(const T& v_0)
+ metal::vec<1, T> vec(const T& v_0)
{
- mln::metal::vec<1, T> tmp;
+ metal::vec<1, T> tmp;
tmp[0] = v_0;
return tmp;
}
template <typename T>
- mln::metal::vec<2, T> vec(const T& v_0, const T& v_1)
+ metal::vec<2, T> vec(const T& v_0, const T& v_1)
{
- mln::metal::vec<2, T> tmp;
+ metal::vec<2, T> tmp;
tmp[0] = v_0;
tmp[1] = v_1;
return tmp;
}
template <typename T>
- mln::metal::vec<3, T> vec(const T& v_0, const T& v_1, const T& v_2)
+ metal::vec<3, T> vec(const T& v_0, const T& v_1, const T& v_2)
{
- mln::metal::vec<3, T> tmp;
+ metal::vec<3, T> tmp;
tmp[0] = v_0;
tmp[1] = v_1;
tmp[2] = v_2;
@@ -114,9 +114,9 @@
}
template <typename T>
- mln::metal::vec<4, T> vec(const T& v_0, const T& v_1, const T& v_2, const T& v_3)
+ metal::vec<4, T> vec(const T& v_0, const T& v_1, const T& v_2, const T& v_3)
{
- mln::metal::vec<4, T> tmp;
+ metal::vec<4, T> tmp;
tmp[0] = v_0;
tmp[1] = v_1;
tmp[2] = v_2;
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fixes.
* mln/trait/ch_value.hh: Fix version with unsigned.
* mln/value/stack.hh: Update.
* mln/core/internal/tracked_ptr.hh: Comply with g++-2.95.
* mln/core/interpolated.hh (skeleton): New.
(change_value): Remove.
* mln/core/image2d_b.hh (init_with): New overload.
* mln/core/cast_image.hh: Fix typo.
* mln/core/macros.hh (ch_value): Move include...
* mln/core/concept/object.hh: ...here.
* mln/core/concept/image.hh: Fix include.
* mln/level/paste.hh: Fix.
* mln/metal/make/vec.hh: Remove; redundant with mln/make/vec.hh.
* tests/stack.cc: Update.
mln/core/cast_image.hh | 2 +-
mln/core/concept/image.hh | 2 +-
mln/core/concept/object.hh | 1 +
mln/core/image2d_b.hh | 9 +++++++++
mln/core/internal/tracked_ptr.hh | 6 +++---
mln/core/interpolated.hh | 10 +++-------
mln/core/macros.hh | 3 ---
mln/level/paste.hh | 2 +-
mln/trait/ch_value.hh | 4 ++--
mln/value/stack.hh | 2 +-
tests/stack.cc | 2 +-
11 files changed, 23 insertions(+), 20 deletions(-)
Index: tests/stack.cc
--- tests/stack.cc (revision 1139)
+++ tests/stack.cc (working copy)
@@ -46,7 +46,7 @@
image2d_b<int> ima5(b), ima1(b);
point2d p = make::point2d(0, 0);
- metal::vec<2, int> v = metal::make::vec(5, 1);
+ metal::vec<2, int> v = make::vec(5, 1);
value::stack(ima5, ima1)(p) = v;
mln_assertion(value::stack(ima5, ima1)(p) = v);
Index: mln/trait/ch_value.hh
--- mln/trait/ch_value.hh (revision 1139)
+++ mln/trait/ch_value.hh (working copy)
@@ -85,9 +85,9 @@
typedef M< P, V > ret;
};
- template < template <class, class> class M, unsigned n, typename I,
+ template < template <unsigned, class> class M, unsigned n, typename I,
typename V >
- struct ch_value_< M< tag::unsigned_<n>, tag::image<I> >, V > // value::stack !
+ struct ch_value_< M< n, tag::image<I> >, V > // For mln::value::stack_image<n,I> !
{
typedef metal::vec<n, V> value;
typedef mln_ch_value(I, value) ret;
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 1139)
+++ mln/core/macros.hh (working copy)
@@ -205,8 +205,5 @@
-# include <mln/trait/ch_value.hh>
-
-
#endif // ! MLN_CORE_MACROS_HH
Index: mln/core/internal/tracked_ptr.hh
--- mln/core/internal/tracked_ptr.hh (revision 1139)
+++ mln/core/internal/tracked_ptr.hh (working copy)
@@ -50,7 +50,7 @@
operator bool() const;
/// Negation (for arithmetical tests).
- bool operator not() const;
+ bool operator !() const;
/*! \brief Mimics the behavior of op-> for a pointer in the const case.
**
@@ -102,10 +102,10 @@
template <typename T>
/// Negation (for arithmetical tests).
- bool tracked_ptr<T>::operator not() const
+ bool tracked_ptr<T>::operator !() const
{
mln_invariant(run_());
- return not bool(*this);
+ return ! bool(*this);
}
template <typename T>
Index: mln/core/interpolated.hh
--- mln/core/interpolated.hh (revision 1139)
+++ mln/core/interpolated.hh (working copy)
@@ -64,6 +64,9 @@
typedef mln::value::set<value> vset;
+ /// Skeleton.
+ typedef interpolated< tag::image<I> > skeleton;
+
/// Constructor.
interpolated(I& ima);
@@ -91,13 +94,6 @@
/// Give the set of values of the image.
const vset& values() const;
- /// Change value type.
- template <typename U>
- struct change_value
- {
- typedef mln_ch_value(I, U) ret;
- };
-
protected:
I& ima_;
};
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1139)
+++ mln/core/image2d_b.hh (working copy)
@@ -140,6 +140,15 @@
void init_with(const box2d& b, unsigned bdr = border::thickness);
+ /// Initialize an empty image.
+ template <typename I>
+ void init_with(const Image<I>& other)
+ {
+ mln_precondition(data_ = 0);
+ data_ = new image2d_b_data<T>(other.domain().bbox()); // FIXME: border?
+ }
+
+
/// Test if \p p is valid.
bool owns_(const point2d& p) const;
Index: mln/core/cast_image.hh
--- mln/core/cast_image.hh (revision 1139)
+++ mln/core/cast_image.hh (working copy)
@@ -68,7 +68,7 @@
/// Skeleton.
- typedef cast_image< tag::value<T>, tag::image<I> > skeleton;
+ typedef cast_image_< tag::value<T>, tag::image<I> > skeleton;
/// Constructor.
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 1139)
+++ mln/core/concept/image.hh (working copy)
@@ -36,7 +36,7 @@
# include <mln/core/concept/mesh.hh>
# include <mln/core/trait/all.hh> // FIXME: Move out of core!
-# include <mln/trait/ch_value.hh> // FIXME: Should be in all.hh!
+# include <mln/trait/concrete.hh> // FIXME: Should be in all.hh!
# include <mln/metal/is_a.hh>
Index: mln/core/concept/object.hh
--- mln/core/concept/object.hh (revision 1139)
+++ mln/core/concept/object.hh (working copy)
@@ -82,6 +82,7 @@
# include <mln/core/exact.hh>
# include <mln/core/ops.hh>
+# include <mln/trait/ch_value.hh>
#endif // ! MLN_CORE_CONCEPT_OBJECT_HH
Index: mln/level/paste.hh
--- mln/level/paste.hh (revision 1139)
+++ mln/level/paste.hh (working copy)
@@ -101,7 +101,7 @@
template <typename I, typename J>
void paste_(const Image<I>& data, Image<J>& destination)
{
- paste_pw_(data, destination);
+ paste_generic_(data, destination);
}
template <typename I, typename J>
Index: mln/value/stack.hh
--- mln/value/stack.hh (revision 1139)
+++ mln/value/stack.hh (working copy)
@@ -102,7 +102,7 @@
/// Skeleton.
- typedef stack_image< tag::unsigned_<n>, tag::image<I> > skeleton;
+ typedef stack_image< n, tag::image<I> > skeleton;
/// Constructor.
1
0