26 #ifndef MLN_ACCU_TRANSFORM_STOP_HH
27 # define MLN_ACCU_TRANSFORM_STOP_HH
34 # include <mln/core/concept/meta_accumulator.hh>
35 # include <mln/core/concept/image.hh>
36 # include <mln/core/concept/window.hh>
37 # include <mln/extension/adjust.hh>
46 template <
typename I,
typename A,
typename W>
47 mln_ch_value(I, mln_result(A))
48 transform_stop(const Image<I>& input, const Accumulator<A>& a, const Window<W>& win);
50 template <typename I, typename A, typename W>
52 transform_stop(const Image<I>& input, const Meta_Accumulator<A>& a, const Window<W>& win);
56 # ifndef MLN_INCLUDE_ONLY
67 template <
typename I,
typename A,
typename W>
68 mln_ch_value(I, mln_result(A))
69 transform_stop(const Image<I>& input_,
70 const Accumulator<A>& a_,
71 const Window<W>& win_)
73 trace::entering(
"accu::impl::generic::transform_stop");
75 const I& input = exact(input_);
76 const W& win = exact(win_);
79 mln_precondition(input.is_valid());
80 mln_precondition(win.is_valid());
84 mln_ch_value(I, mln_result(A)) output;
87 mln_piter(I) p(input.domain());
88 mln_qiter(W) q(win, p);
92 for_all(q) if (input.has(q))
98 output(p) = a.to_result();
101 trace::exiting(
"accu::impl::generic::transform_stop");
110 template <
typename I,
typename A,
typename W>
111 mln_ch_value(I, mln_result(A))
112 transform_stop_fastest(const Image<I>& input_, const Accumulator<A>& a_, const Window<W>& win_)
114 trace::entering(
"accu::impl::transform_stop_fastest");
116 const I& input = exact(input_);
117 const W& win = exact(win_);
120 mln_precondition(input.is_valid());
121 mln_precondition(win.is_valid());
125 typedef mln_ch_value(I, mln_result(A)) O;
128 mln_pixter(O) o(output);
130 mln_pixter(const I) p(input);
131 mln_qixter(const I, W) q(p, win);
141 o.val() = a.to_result();
144 trace::exiting(
"accu::impl::transform_stop_fastest");
157 template <
typename I,
typename A,
typename W>
158 mln_ch_value(I, mln_result(A))
159 transform_stop_dispatch(metal::false_,
160 const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
162 return impl::generic::transform_stop(input, a, win);
165 template <
typename I,
typename A,
typename W>
166 mln_ch_value(I, mln_result(A))
167 transform_stop_dispatch(metal::true_,
168 const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
170 return impl::transform_stop_fastest(input, a, win);
173 template <
typename I,
typename A,
typename W>
174 mln_ch_value(I, mln_result(A))
175 transform_stop_dispatch(const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
177 return transform_stop_dispatch(mln_is_fastest_IW(I, W)(),
186 template <
typename I,
typename A,
typename W>
188 mln_ch_value(I, mln_result(A))
189 transform_stop(const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
191 trace::entering(
"accu::transform_stop");
193 mln_precondition(exact(input).is_valid());
194 mln_precondition(exact(win).is_valid());
196 mln_ch_value(I, mln_result(A)) output;
197 output = internal::transform_stop_dispatch(input, a, win);
199 trace::exiting("accu::transform_stop");
203 template <typename I, typename A, typename W>
205 transform_stop(const Image<I>& input, const Meta_Accumulator<A>& a, const Window<W>& win)
207 trace::entering(
"accu::transform_stop");
209 mln_precondition(exact(input).is_valid());
210 mln_precondition(exact(win).is_valid());
212 typedef mln_accu_with(A, mln_value(I)) A_;
213 A_ a_ = accu::unmeta(exact(a), mln_value(I)());
215 mln_ch_value(I, mln_result(A_)) output;
216 output = internal::transform_stop_dispatch(input, a_, win);
218 trace::exiting("accu::transform_stop");
222 # endif // ! MLN_INCLUDE_ONLY
229 #endif // ! MLN_ACCU_TRANSFORM_STOP_HH