* mln/border/get.hh: Add a new implementation for handling morphed
images.
* mln/data/compute.hh: Initialize correctly the accumulator.
* mln/debug/println_with_border.hh,
* mln/debug/println_with_border.spe.hh: Add support for morphed
images.
* mln/value/intsub.hh,
* mln/world/k2/fill_non_primary_from_primary_2_faces.hh: Cleanup code.
* mln/world/k2/immerse.hh: Cast to image value type.
* mln/world/k2/is_non_primary_2_face_center.hh: Fix invalid test.
* mln/world/kn/border/adjust_duplicate_2_faces.hh: Fix doc.
* mln/world/kn/border/fill_1_from_aux_2_faces.hh: Add missing
safe_cast.
* mln/world/kn/compute_tree_of_shapes.hh: Disable debug.
* mln/world/kn/fill_0_from_1_faces.hh,
* mln/world/kn/is_0_or_1_face.hh: Fix ambiguous namespace.
* mln/world/kn/safe_cast.hh: Add a new specialization and fix
another one.
* tests/value/intsub.cc,
* tests/world/k2/un_immerse.cc: Add more tests.
---
milena/ChangeLog | 36 ++++++
milena/mln/border/get.hh | 7 +
milena/mln/data/compute.hh | 5 +-
milena/mln/debug/println_with_border.hh | 30 ++++-
milena/mln/debug/println_with_border.spe.hh | 44 ++++++--
milena/mln/value/intsub.hh | 4 +-
.../k2/fill_non_primary_from_primary_2_faces.hh | 2 -
milena/mln/world/k2/immerse.hh | 12 +-
.../mln/world/k2/is_non_primary_2_face_center.hh | 5 +-
.../world/kn/border/adjust_duplicate_2_faces.hh | 2 +-
.../mln/world/kn/border/fill_1_from_aux_2_faces.hh | 17 ++--
milena/mln/world/kn/compute_tree_of_shapes.hh | 9 +-
milena/mln/world/kn/fill_0_from_1_faces.hh | 4 +-
milena/mln/world/kn/is_0_or_1_face.hh | 2 +-
milena/mln/world/kn/safe_cast.hh | 19 ++-
milena/tests/value/intsub.cc | 9 ++
milena/tests/world/k2/un_immerse.cc | 126 +++++++++++++++++---
17 files changed, 268 insertions(+), 65 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 078df3a..d3e2f30 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,41 @@
2013-01-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Small fixes.
+
+ * mln/border/get.hh: Add a new implementation for handling morphed
+ images.
+
+ * mln/data/compute.hh: Initialize correctly the accumulator.
+
+ * mln/debug/println_with_border.hh,
+ * mln/debug/println_with_border.spe.hh: Add support for morphed
+ images.
+
+ * mln/value/intsub.hh,
+ * mln/world/k2/fill_non_primary_from_primary_2_faces.hh: Cleanup code.
+
+ * mln/world/k2/immerse.hh: Cast to image value type.
+
+ * mln/world/k2/is_non_primary_2_face_center.hh: Fix invalid test.
+
+ * mln/world/kn/border/adjust_duplicate_2_faces.hh: Fix doc.
+
+ * mln/world/kn/border/fill_1_from_aux_2_faces.hh: Add missing
+ safe_cast.
+
+ * mln/world/kn/compute_tree_of_shapes.hh: Disable debug.
+
+ * mln/world/kn/fill_0_from_1_faces.hh,
+ * mln/world/kn/is_0_or_1_face.hh: Fix ambiguous namespace.
+
+ * mln/world/kn/safe_cast.hh: Add a new specialization and fix
+ another one.
+
+ * tests/value/intsub.cc,
+ * tests/world/k2/un_immerse.cc: Add more tests.
+
+2013-01-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Make use of data::transform in arith::revert.
* mln/arith/revert.hh: Here.
diff --git a/milena/mln/border/get.hh b/milena/mln/border/get.hh
index 3ff713a..8311bc1 100644
--- a/milena/mln/border/get.hh
+++ b/milena/mln/border/get.hh
@@ -71,6 +71,13 @@ namespace mln
return border::get(*ima.delegatee_());
}
+ template <typename I>
+ inline
+ unsigned get_(trait::image::ext_domain::none, trait::image::category::morpher,
+ const I& ima)
+ {
+ return border::get(*ima.delegatee_());
+ }
template <typename I>
inline
diff --git a/milena/mln/data/compute.hh b/milena/mln/data/compute.hh
index 0ab146e..ea6f0b8 100644
--- a/milena/mln/data/compute.hh
+++ b/milena/mln/data/compute.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Copyright (C) 2007, 2008, 2009, 2012 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -92,8 +92,7 @@ namespace mln
mln_result(A)
compute(const Accumulator<A>& a_, const Image<I>& input)
{
- (void) a_;
- A a;
+ A a(exact(a_));
return compute(a, input);
}
diff --git a/milena/mln/debug/println_with_border.hh
b/milena/mln/debug/println_with_border.hh
index 0099e57..ee6fe16 100644
--- a/milena/mln/debug/println_with_border.hh
+++ b/milena/mln/debug/println_with_border.hh
@@ -48,7 +48,14 @@ namespace mln
namespace debug
{
- /// Print the image \p input on the standard output.
+ /// Print the image \p input on the standard output and display
+ /// text \p msg.
+ template <typename I>
+ inline
+ void
+ println_with_border(const std::string& msg, const Image<I>& input);
+
+ /// \overload
template <typename I>
void println_with_border(const Image<I>& input);
@@ -73,16 +80,31 @@ namespace mln
// Facade.
+
template <typename I>
inline
void
- println_with_border(const Image<I>& input)
+ println_with_border(const Image<I>& input_)
{
- mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
+ const I& input = exact(input_);
+ //mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
+ mln_precondition(input.is_valid());
+ impl::println_with_border(geom::bbox(input), input);
+ }
- impl::println_with_border(geom::bbox(exact(input)), exact(input));
+ template <typename I>
+ inline
+ void
+ println_with_border(const std::string& msg, const Image<I>& input)
+ {
+ if (!quiet)
+ {
+ std::cout << msg << std::endl;
+ println_with_border(input);
+ }
}
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::debug
diff --git a/milena/mln/debug/println_with_border.spe.hh
b/milena/mln/debug/println_with_border.spe.hh
index f59f45b..722baad 100644
--- a/milena/mln/debug/println_with_border.spe.hh
+++ b/milena/mln/debug/println_with_border.spe.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011, 2012 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -39,6 +39,7 @@
# include <mln/core/concept/window.hh>
# include <mln/debug/format.hh>
# include <mln/opt/element.hh>
+# include <mln/border/get.hh>
namespace mln
{
@@ -59,13 +60,40 @@ namespace mln
void
println_with_border(const box2d& b, const I& input)
{
- const unsigned ncols = b.ncols() + 2 * input.border();
- for (size_t i = 0; i < opt::nelements(input); i++)
- {
- std::cout << format(input.buffer()[i]) << ' ';
- if (((i + 1) % ncols) == 0)
+ accu::stat::max<unsigned> len_;
+ box2d b_ext = b;
+ b_ext.enlarge(border::get(input));
+
+ mln_piter(box2d) p(b_ext);
+ for_all(p)
+ if (input.domain().has(p) || ! b.has(p))
+ {
+ std::ostringstream o;
+ o << format(input(p));
+ len_.take(o.str().length());
+ }
+ unsigned len = len_ + 1;
+
+ image2d<char> output(b_ext.nrows(), b_ext.ncols() * len, 0);
+ data::fill(output, ' ');
+ for_all(p)
+ if (input.domain().has(p) || ! b.has(p))
+ {
+ std::ostringstream oss;
+ oss << format(input(p));
+ def::coord
+ row = static_cast<def::coord>(p.row() - b_ext.min_row()),
+ col = static_cast<def::coord>((p.col() - b_ext.min_col()) * len);
+ point2d w(row, col);
+ put_word(output, w, oss.str());
+ }
+
+ for (def::coord row = 0; row < def::coord(b_ext.nrows()); ++row)
+ {
+ for (def::coord col = 0; col < def::coord(b_ext.ncols() * len); ++col)
+ std::cout << opt::at(output, row, col);
std::cout << std::endl;
- }
+ }
std::cout << std::endl;
}
# endif // MLN_CORE_ALIAS_BOX2D_HH
diff --git a/milena/mln/value/intsub.hh b/milena/mln/value/intsub.hh
index 721b4bd..2b40f89 100644
--- a/milena/mln/value/intsub.hh
+++ b/milena/mln/value/intsub.hh
@@ -311,6 +311,8 @@ namespace mln
intsub<n>::intsub(const intsub<m>& rhs)
{
mln_precondition(m < n);
+ if (m < n)
+ abort();
this->v_ = rhs.to_enc() * (n / m);
}
@@ -516,7 +518,7 @@ namespace mln
mln_trait_routine_mean(2,intsub<n>)
mean_(const intsub<n>& v1, const intsub<n>& v2)
{
- return intsub<2*n>::make_from_enc_((v1.to_enc() + v2.to_enc()));
+ return intsub<2*n>::make_from_enc_(v1.to_enc() + v2.to_enc());
}
template <unsigned n>
diff --git a/milena/mln/world/k2/fill_non_primary_from_primary_2_faces.hh
b/milena/mln/world/k2/fill_non_primary_from_primary_2_faces.hh
index 37b76a5..f8000ad 100644
--- a/milena/mln/world/k2/fill_non_primary_from_primary_2_faces.hh
+++ b/milena/mln/world/k2/fill_non_primary_from_primary_2_faces.hh
@@ -137,13 +137,11 @@ namespace mln
kn::safe_cast(ima(p + 2 * down))));
}
else if (is_non_primary_2_face_center(p))
- {
ima(p) = kn::safe_cast_to<V>(
f_center(kn::safe_cast(ima(p + 2 * up_left)),
kn::safe_cast(ima(p + 2 * up_right)),
kn::safe_cast(ima(p + 2 * down_left)),
kn::safe_cast(ima(p + 2 * down_right))));
- }
// Initialize border.
kn::border::adjust_duplicate_2_faces(ima, 1);
diff --git a/milena/mln/world/k2/immerse.hh b/milena/mln/world/k2/immerse.hh
index af3c18d..7ef9b3c 100644
--- a/milena/mln/world/k2/immerse.hh
+++ b/milena/mln/world/k2/immerse.hh
@@ -32,6 +32,7 @@
# include <mln/core/concept/image.hh>
# include <mln/world/kn/immerse.hh>
+# include <mln/metal/converts_to.hh>
namespace mln
{
@@ -76,10 +77,10 @@ namespace mln
/// \overload
/// 0, 1 and non-primary 2-faces values are set to \p
/// default_value.
- template <typename I, typename V>
+ template <typename I, typename V, typename U>
mln_ch_value(I, V)
immerse(const Image<I>& ima, const V& new_value_type,
- const V& default_value);
+ const U& default_value);
# ifndef MLN_INCLUDE_ONLY
@@ -114,16 +115,17 @@ namespace mln
}
- template <typename I, typename V>
+ template <typename I, typename V, typename U>
mln_ch_value(I,V)
immerse(const Image<I>& ima, const V& new_value_type,
- const V& default_value)
+ const U& default_value)
{
trace::entering("mln::world::k2::immerse");
mln_precondition(exact(ima).is_valid());
+ mlc_converts_to(U,V)::check();
mln_ch_value(I,V)
- output = kn::immerse(ima, 2, new_value_type, default_value);
+ output = kn::immerse(ima, 2, new_value_type, V(default_value));
trace::exiting("mln::world::k2::immerse");
return output;
diff --git a/milena/mln/world/k2/is_non_primary_2_face_center.hh
b/milena/mln/world/k2/is_non_primary_2_face_center.hh
index 79d5d37..3bc2467 100644
--- a/milena/mln/world/k2/is_non_primary_2_face_center.hh
+++ b/milena/mln/world/k2/is_non_primary_2_face_center.hh
@@ -31,6 +31,7 @@
# define MLN_WORLD_K2_IS_NON_PRIMARY_2_FACE_CENTER_HH
# include <mln/core/alias/point2d.hh>
+# include <mln/math/abs.hh>
namespace mln
@@ -71,9 +72,9 @@ namespace mln
inline
bool is_non_primary_2_face_center(const mln::def::coord& row,
- const mln::def::coord& col)
+ const mln::def::coord& col)
{
- return (row % 4 == 2) && (col % 4 == 2);
+ return (math::abs(col) % 4 == 2) && (math::abs(row) % 4 == 2);
}
diff --git a/milena/mln/world/kn/border/adjust_duplicate_2_faces.hh
b/milena/mln/world/kn/border/adjust_duplicate_2_faces.hh
index bb7f43c..9a0843d 100644
--- a/milena/mln/world/kn/border/adjust_duplicate_2_faces.hh
+++ b/milena/mln/world/kn/border/adjust_duplicate_2_faces.hh
@@ -50,7 +50,7 @@ namespace mln
/*! \brief Adjust border size and duplicate 2 faces in Kn 2D
* images borders.
- \param[in,out] inout A 2D image immersed in KN.
+ \param[in,out] inout A 2D image immersed in Kn.
\param[in] min_thickness The minimum border thickness of \p
inout.
diff --git a/milena/mln/world/kn/border/fill_1_from_aux_2_faces.hh
b/milena/mln/world/kn/border/fill_1_from_aux_2_faces.hh
index 629a11d..2377298 100644
--- a/milena/mln/world/kn/border/fill_1_from_aux_2_faces.hh
+++ b/milena/mln/world/kn/border/fill_1_from_aux_2_faces.hh
@@ -85,6 +85,7 @@ namespace mln
I& inout = const_cast<I&>(exact(inout_));
J& aux = const_cast<J&>(exact(aux_));
const F& f = exact(f_);
+ typedef mln_value(I) V;
def::coord
min_row_1 = geom::min_row(inout) - 1,
@@ -97,11 +98,11 @@ namespace mln
if (is_1_face_vertical(min_row_1, col))
{
// First row
- inout.at_(min_row_1, col) = f(aux.at_(min_row_1, col - 1),
- aux.at_(min_row_1, col + 1));
+ inout.at_(min_row_1, col) = safe_cast_to<V>(f(safe_cast(aux.at_(min_row_1,
col - 1)),
+ safe_cast(aux.at_(min_row_1, col + 1))));
// Last row
- inout.at_(max_row_1, col) = f(aux.at_(max_row_1, col - 1),
- aux.at_(max_row_1, col + 1));
+ inout.at_(max_row_1, col) = safe_cast_to<V>(f(safe_cast(aux.at_(max_row_1,
col - 1)),
+ safe_cast(aux.at_(max_row_1, col + 1))));
}
// Fill vertical border
@@ -109,11 +110,11 @@ namespace mln
if (is_1_face_horizontal(row, min_col_1))
{
// First col
- inout.at_(row, min_col_1) = f(aux.at_(row - 1, min_col_1),
- aux.at_(row + 1, min_col_1));
+ inout.at_(row, min_col_1) = safe_cast_to<V>(f(safe_cast(aux.at_(row - 1,
min_col_1)),
+ safe_cast(aux.at_(row + 1, min_col_1))));
// Last col
- inout.at_(row, max_col_1) = f(aux.at_(row - 1, max_col_1),
- aux.at_(row + 1, max_col_1));
+ inout.at_(row, max_col_1) = safe_cast_to<V>(f(safe_cast(aux.at_(row - 1,
max_col_1)),
+ safe_cast(aux.at_(row + 1, max_col_1))));
}
trace::exiting("mln::world::kn::fill_1_from_aux_2_faces");
diff --git a/milena/mln/world/kn/compute_tree_of_shapes.hh
b/milena/mln/world/kn/compute_tree_of_shapes.hh
index 4a3b226..c29be4d 100644
--- a/milena/mln/world/kn/compute_tree_of_shapes.hh
+++ b/milena/mln/world/kn/compute_tree_of_shapes.hh
@@ -44,6 +44,7 @@
# include <mln/world/kn/hqueue.hh>
# include <mln/util/tree_of_shapes.hh>
# include <mln/world/kn/is_2_face.hh>
+# include <mln/world/kn/safe_cast.hh>
# include <mln/world/k2/is_primary_2_face.hh>
@@ -219,8 +220,8 @@ namespace mln
if (t.level_changes_at(i))
{
- std::cout << "union-find: done with level " << t.level(p)
<< std::endl;
- kn::debug::println(done);
+ //std::cout << "union-find: done with level " << t.level(p)
<< std::endl;
+ //kn::debug::println(done);
}
}
@@ -402,8 +403,8 @@ namespace mln
if (q.is_empty_at(lcur))
{
- std::cout << "sort: done with level " << lcur <<
std::endl;
- kn::debug::println(done);
+ //std::cout << "sort: done with level " << lcur <<
std::endl;
+ //kn::debug::println(done);
}
}
while (i != N);
diff --git a/milena/mln/world/kn/fill_0_from_1_faces.hh
b/milena/mln/world/kn/fill_0_from_1_faces.hh
index 999ddaf..8452136 100644
--- a/milena/mln/world/kn/fill_0_from_1_faces.hh
+++ b/milena/mln/world/kn/fill_0_from_1_faces.hh
@@ -94,7 +94,7 @@ namespace mln
typedef mln_argument(A) arg;
mln_piter(I) p(inout.domain());
for_all(p)
- if (is_0_face(p))
+ if (kn::is_0_face(p))
{
accu.init();
if (inout.domain().has(p + left))
@@ -125,7 +125,7 @@ namespace mln
mln_piter(I) p(inout.domain());
for_all(p)
- if (is_0_face(p))
+ if (kn::is_0_face(p))
inout(p) = safe_cast(f(safe_cast(inout(p + left)),
safe_cast(inout(p + right)),
safe_cast(inout(p + up)),
diff --git a/milena/mln/world/kn/is_0_or_1_face.hh
b/milena/mln/world/kn/is_0_or_1_face.hh
index b05f279..8f14c2b 100644
--- a/milena/mln/world/kn/is_0_or_1_face.hh
+++ b/milena/mln/world/kn/is_0_or_1_face.hh
@@ -55,7 +55,7 @@ namespace mln
inline
bool is_0_or_1_face(const point2d& p)
{
- unsigned dim = face_dim(p);
+ unsigned dim = kn::face_dim(p);
return dim == 0 || dim == 1;
}
diff --git a/milena/mln/world/kn/safe_cast.hh b/milena/mln/world/kn/safe_cast.hh
index 9d5202d..39fc7d7 100644
--- a/milena/mln/world/kn/safe_cast.hh
+++ b/milena/mln/world/kn/safe_cast.hh
@@ -256,18 +256,21 @@ namespace mln
to = from;
}
- // From intsub<n>
+ // From float
template <unsigned n>
- void safe_cast_(const intsub<n>& from, intsub<2*n>& to)
+ void safe_cast_(const float& from, intsub<n>& to)
{
- to = static_cast<intsub<2*n> >(from.to_int());
+ to = from;
}
+
+ // From intsub<n>
+
template <unsigned n>
- void safe_cast_(const intsub<n>& from, intsub<n/2>& to)
+ void safe_cast_(const intsub<n>& from, intsub<2*n>& to)
{
- to = static_cast<intsub<n/2> >(from.to_int());
+ to = static_cast<intsub<2*n> >(from.to_int());
}
template <unsigned n, unsigned m>
@@ -290,6 +293,12 @@ namespace mln
to = from;
}
+ template <unsigned n>
+ void safe_cast_(const intsub<n>& from, float& to)
+ {
+ to = from;
+ }
+
template <unsigned n, unsigned m>
void safe_cast_(const intsub<n>& from, interval<int_u<m> >&
to)
{
diff --git a/milena/tests/value/intsub.cc b/milena/tests/value/intsub.cc
index 2ec4671..248af6c 100644
--- a/milena/tests/value/intsub.cc
+++ b/milena/tests/value/intsub.cc
@@ -117,4 +117,13 @@ int main()
// 2.5 * 10.25
mln_assertion((l * k) == 25.625);
+
+ // Mean with 2 intsub
+ mln_assertion(math::mean(intsub<2>(2), intsub<2>(4)) == 3);
+
+ // Mean with 4 intsub
+ mln_assertion(math::mean(intsub<2>(2), intsub<2>(4), intsub<2>(6),
intsub<2>(8)) == 5);
+
+ // Add 2 intsub
+ mln_assertion((intsub<2>(2) + intsub<2>(3)) == 5);
}
diff --git a/milena/tests/world/k2/un_immerse.cc b/milena/tests/world/k2/un_immerse.cc
index acb7012..0c4a23d 100644
--- a/milena/tests/world/k2/un_immerse.cc
+++ b/milena/tests/world/k2/un_immerse.cc
@@ -33,23 +33,111 @@ int main()
{
using namespace mln;
- int refvals[2][2] = {
- {1, 2},
- {3, 4}
- };
- image2d<int> ref = make::image(refvals);
-
- int vals[][7] = {
- {0, 0, 0, 0, 0, 0, 0},
- {0, 1, 0, 0, 0, 2, 0},
- {0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0},
- {0, 3, 0, 0, 0, 4, 0},
- {0, 0, 0, 0, 0, 0, 0}
- };
- image2d<int> imak2 = make::image(vals, point2d(-1, -1));
-
- image2d<int> imak0 = world::k2::un_immerse(imak2);
- mln_assertion(imak0 == ref);
+ {
+ int refvals[2][2] = {
+ {1, 2},
+ {4, 5}
+ };
+ image2d<int> ref = make::image(refvals);
+
+ int vals[9][9] = {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 1, 0, 0, 0, 2, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 4, 0, 0, 0, 5, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0}
+ };
+ image2d<int> imak2 = make::image(vals, point2d(-1, -1));
+
+ image2d<int> imak0 = world::k2::un_immerse(imak2);
+ mln_assertion(imak0 == ref);
+ }
+
+
+ {
+ int refvals[3][3] = {
+ {1, 2, 3},
+ {4, 5, 6},
+ {7, 8, 9}
+ };
+ image2d<int> ref = make::image(refvals);
+
+ int vals[13][13] = {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 7, 0, 0, 0, 8, 0, 0, 0, 9, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ };
+ image2d<int> imak2 = make::image(vals, point2d(-1, -1));
+
+ image2d<int> imak0 = world::k2::un_immerse(imak2);
+ mln_assertion(imak0 == ref);
+ }
+
+ {
+ int refvals[2][3] = {
+ {1, 2, 3},
+ {4, 5, 6}
+ };
+ image2d<int> ref = make::image(refvals);
+
+ int vals[9][13] = {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ };
+ image2d<int> imak2 = make::image(vals, point2d(-1, -1));
+
+ image2d<int> imak0 = world::k2::un_immerse(imak2);
+ mln_assertion(imak0 == ref);
+ }
+
+ {
+ int refvals[3][2] = {
+ {1, 2},
+ {4, 5},
+ {7, 8}
+ };
+ image2d<int> ref = make::image(refvals);
+
+ int vals[13][9] = {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 1, 0, 0, 0, 2, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 4, 0, 0, 0, 5, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 7, 0, 0, 0, 8, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ };
+ image2d<int> imak2 = make::image(vals, point2d(-1, -1));
+
+ image2d<int> imak0 = world::k2::un_immerse(imak2);
+ mln_assertion(imak0 == ref);
+ }
+
}
--
1.7.2.5