26 #ifndef MLN_ACCU_IMAGE_TO_RESULT_HH
27 # define MLN_ACCU_IMAGE_TO_RESULT_HH
33 # include <mln/core/concept/accumulator.hh>
34 # include <mln/core/concept/image.hh>
47 mln_ch_value(I, mln_deduce(I, value, result))
48 to_result(const Image<I>& input);
52 # ifndef MLN_INCLUDE_ONLY
63 mln_ch_value(I, mln_deduce(I, value, result))
64 to_result(const Image<I>& input_)
66 trace::entering(
"accu::impl::image::generic::to_result");
68 mlc_is_a(mln_value(I), Accumulator)::check();
70 const I& input = exact(input_);
71 mln_precondition(input.is_valid());
73 typedef mln_deduce(I, value, result) R;
74 mln_ch_value(I, R) output;
77 mln_piter(I) p(input.domain());
79 output(p) = input(p).to_result();
81 trace::exiting("accu::impl::image::generic::to_result");
91 mln_ch_value(I, mln_deduce(I, value, result))
92 to_result_fastest(const Image<I>& input_)
94 trace::entering(
"accu::impl::image::to_result_fastest");
96 mlc_is_a(mln_value(I), Accumulator)::check();
98 const I& input = exact(input_);
99 mln_precondition(input.is_valid());
101 typedef mln_deduce(I, value, result) R;
102 typedef mln_ch_value(I, R) O;
106 mln_pixter(const I) p_in(input);
107 mln_pixter(O) p_out(output);
108 for_all_2(p_in, p_out)
109 p_out.val() = p_in.val().to_result();
111 trace::exiting("accu::impl::image::to_result_fastest");
124 template <
typename I>
125 mln_ch_value(I, mln_deduce(I, value, result))
126 to_result_dispatch(trait::image::speed::any,
127 const Image<I>& input)
129 return impl::generic::to_result(input);
132 template <
typename I>
133 mln_ch_value(I, mln_deduce(I, value, result))
134 to_result_dispatch(trait::image::speed::fastest,
135 const Image<I>& input)
137 return impl::to_result_fastest(input);
140 template <
typename I>
141 mln_ch_value(I, mln_deduce(I, value, result))
142 to_result_dispatch(const Image<I>& input)
144 return to_result_dispatch(mln_trait_image_speed(I)(),
153 template <
typename I>
154 mln_ch_value(I, mln_deduce(I, value, result))
155 to_result(const Image<I>& input)
157 trace::entering(
"accu::image::to_result");
159 mlc_is_a(mln_value(I), Accumulator)::check();
161 mln_precondition(exact(input).is_valid());
163 typedef mln_deduce(I, value, result) R;
164 mln_ch_value(I, R) output;
165 output = internal::to_result_dispatch(input);
167 trace::exiting("accu::image::to_result");
171 # endif // ! MLN_INCLUDE_ONLY
180 #endif // ! MLN_ACCU_IMAGE_TO_RESULT_HH