2954: Fix a bug in fill_with_image routine.

https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Nicolas Ballas <ballas@lrde.epita.fr> Fix a bug in fill_with_image routine. * mln/level/transform.spe.hh, * mln/level/fill_with_value.spe.hh: Minor updates. * mln/level/fill_with_image.spe.hh: Fix an instantiation error. * mln/morpho/tree/compute_attribute_image.hh: Update. level/fill_with_image.spe.hh | 8 +++++--- level/fill_with_value.spe.hh | 11 +---------- level/transform.spe.hh | 4 +--- morpho/tree/compute_attribute_image.hh | 3 +-- 4 files changed, 8 insertions(+), 18 deletions(-) Index: mln/level/transform.spe.hh --- mln/level/transform.spe.hh (revision 2953) +++ mln/level/transform.spe.hh (working copy) @@ -290,7 +290,7 @@ inline mln_ch_value(I, mln_result(F)) transform_dispatch(trait::image::vw_set::uni, - trait::image::quant::any, + trait::image::quant::low, const Image<I>& input, const Function_v2v<F>& f) { return level::impl::transform_taken(input, f); @@ -308,7 +308,6 @@ } - /// FIXME check that is right template <typename I, typename F> inline mln_ch_value(I, mln_result(F)) @@ -319,7 +318,6 @@ return level::impl::transform_fast(input, f); } - /// FIXME check that is right template <typename I, typename F> inline mln_ch_value(I, mln_result(F)) Index: mln/level/fill_with_value.spe.hh --- mln/level/fill_with_value.spe.hh (revision 2953) +++ mln/level/fill_with_value.spe.hh (working copy) @@ -118,13 +118,10 @@ I& ima = exact(ima_); internal::fill_with_value_tests(ima, val); - mlc_and( mlc_or(mlc_is(mln_trait_image_pw_io(I), trait::image::pw_io::read_write), mlc_is(mln_trait_image_vw_io(I), - trait::image::vw_io::read_write)), - mlc_is(mln_trait_image_value_access(I), - trait::image::value_access::direct))::check(); + trait::image::vw_io::read_write))::check(); ima.val() = val; @@ -145,13 +142,7 @@ void fill_with_value_dispatch(trait::image::value_access::direct, Image<I>& ima, const V& val) { - if (mlc_is(mln_trait_image_pw_io(I), - trait::image::pw_io::read_write)::value || - mlc_is(mln_trait_image_vw_io(I), - trait::image::vw_io::read_write)::value) impl::fill_with_value_one_block(ima, val); - else - impl::generic::fill_with_value(ima, val); } template <typename I, typename V> Index: mln/level/fill_with_image.spe.hh --- mln/level/fill_with_image.spe.hh (revision 2953) +++ mln/level/fill_with_image.spe.hh (working copy) @@ -83,8 +83,8 @@ level::internal::fill_with_image_tests(ima, data); - pixel<const I> src (data); - pixel<J> dst(ima); + pixel<const J> src (data); + pixel<I> dst(ima); *(src.address_()) = data.buffer(); *(dst.address_()) = ima.buffer(); @@ -129,7 +129,7 @@ mln_box_runstart_piter(I) p(ima.domain()); for_all(p) { - pixel<J> dst(ima, p); + pixel<I> dst(ima, p); memcpy_(dst, make::pixel(data, p), p.run_length()); } @@ -143,6 +143,8 @@ trace::entering("level::impl::fill_with_image_singleton"); const J& data = exact(data_); + level::internal::fill_with_image_tests(ima_, data); + level::fill_with_value(ima_, data.val()); trace::exiting("level::impl::fill_with_image_singleton"); Index: mln/morpho/tree/compute_attribute_image.hh --- mln/morpho/tree/compute_attribute_image.hh (revision 2953) +++ mln/morpho/tree/compute_attribute_image.hh (working copy) @@ -105,8 +105,7 @@ typedef typename T::function I; mln_ch_value(I, mln_result(A)) output; initialize(output, acc); - // level::fill(output, acc); - level::paste(acc, output); + level::fill(output, acc); trace::exiting("morpho::tree::compute_attribute_image"); return output;
participants (1)
-
Nicolas Ballas