27 #ifndef MLN_DEBUG_MOSAIC_HH
28 # define MLN_DEBUG_MOSAIC_HH
36 # include <mln/core/image/image2d.hh>
38 # include <mln/core/image/image3d.hh>
39 # include <mln/core/image/dmorph/slice_image.hh>
41 # include <mln/core/image/dmorph/p2p_image.hh>
42 # include <mln/fun/p2p/translation.hh>
44 # include <mln/data/paste.hh>
45 # include <mln/data/fill.hh>
69 mosaic(const util::array<I>& input,
70 unsigned n_horizontal,
71 const mln_value(I)& bg);
75 # ifndef MLN_INCLUDE_ONLY
80 mosaic(const util::array<I>& input,
81 unsigned n_horizontal,
82 const mln_value(I)& bg)
84 mln_trace(
"debug::mosaic");
86 mlc_is_a(I, Image)::check();
87 mlc_equal(mln_domain(I), box2d)::check();
88 mln_precondition(n_horizontal > 0);
91 unsigned max_ncols = 0, max_nrows = 0;
92 for (
unsigned i = 0; i < input.nelements(); ++i)
94 const I& ima =
exact(input[i]);
95 mln_precondition(ima.is_valid());
97 if (ima.ncols() > max_ncols)
98 max_ncols = ima.ncols();
100 if (ima.nrows() > max_nrows)
101 max_nrows = ima.nrows();
105 mln_concrete(I) output(max_nrows
106 * (input.nelements() / (
float)n_horizontal
108 max_ncols * n_horizontal);
111 unsigned brow = 0, bcol = 0;
112 for (
unsigned i = 0; i < input.nelements(); ++i)
114 const I& ima =
exact(input[i]);
115 mln_precondition(ima.is_valid());
117 dpoint2d
dp(brow * max_nrows
118 + ((max_nrows - ima.domain().height()) / 2),
120 + ((max_ncols - ima.domain().width()) / 2));
125 if (! (bcol < n_horizontal))
136 # endif // ! MLN_INCLUDE_ONLY
143 #endif // ! MLN_DEBUG_MOSAIC_HH