27 #ifndef MLN_DATA_COMPUTE_IN_WINDOW_HH
28 # define MLN_DATA_COMPUTE_IN_WINDOW_HH
35 # include <mln/accu/image/init.hh>
36 # include <mln/accu/image/to_result.hh>
37 # include <mln/core/concept/meta_accumulator.hh>
38 # include <mln/border/mirror.hh>
39 # include <mln/extension/adjust.hh>
41 # include <mln/debug/println_with_border.hh>
60 template <
typename A,
typename I,
typename W>
61 mln_ch_value(I, mln_result(A))
63 const Window<W>& win);
75 template <typename A, typename I, typename W>
76 mln_ch_value(I, mln_result(A))
78 const Window<W>& win);
82 # ifndef MLN_INCLUDE_ONLY
87 template <
typename A,
typename I,
typename W>
89 compute_in_window_tests(
const Accumulator<A>& a,
const Image<I>& input_,
90 const Window<W>& win_)
92 const W& win =
exact(win_);
93 const I& input =
exact(input_);
99 mln_assertion(win.is_valid());
100 mln_assertion(input.is_valid());
112 template <
typename A,
typename I,
typename W>
113 mln_ch_value(I, mln_result(A))
115 const Image<I>& input_,
116 const Window<W>& win_)
118 mln_trace(
"mln::impl::generic::compute_in_window");
120 const I& input =
exact(input_);
121 const W& win =
exact(win_);
123 internal::compute_in_window_tests(a, input, win);
125 mln_ch_value(I, A) accu;
128 accu::image::init(accu);
130 mln_piter(I)
p(accu.domain());
131 mln_qiter(W) q(win,
p);
135 if (input.domain().has(q))
136 accu(p).take(input(q));
138 mln_ch_value(I, mln_result(A))
139 output = accu::image::to_result(accu);
147 template <typename A, typename I, typename W>
148 mln_ch_value(I, mln_result(A))
149 compute_in_window_fastest(const Accumulator<A>& a,
150 const Image<I>& input_,
151 const Window<W>& win_)
153 mln_trace(
"mln::impl::generic::compute_in_window_fastest");
155 const W& win =
exact(win_);
156 const I& input =
exact(input_);
158 internal::compute_in_window_tests(a, input, win);
163 typedef mln_ch_value(I, A) J;
167 accu::image::init(accu);
169 mln_pixter(J) p(accu);
170 mln_qixter(J, W) q(p, win);
174 p.val().take(input.element(q.offset()));
176 mln_ch_value(I, mln_result(A))
177 output = accu::image::to_result(accu);
191 template <
typename A,
typename I,
typename W>
192 mln_ch_value(I, mln_result(A))
193 compute_in_window_dispatch(const Accumulator<A>& a,
194 const Image<I>& input,
195 const Window<W>& win,
196 trait::image::speed::fastest)
198 return impl::compute_in_window_fastest(a, input, win);
201 template <
typename A,
typename I,
typename W>
202 mln_ch_value(I, mln_result(A))
203 compute_in_window_dispatch(const Accumulator<A>& a,
204 const Image<I>& input,
205 const Window<W>& win,
206 trait::image::speed::any)
211 template <
typename A,
typename I,
typename W>
212 mln_ch_value(I, mln_result(A))
213 compute_in_window_dispatch(const Accumulator<A>& a,
214 const Image<I>& input,
215 const Window<W>& win)
217 return compute_in_window_dispatch(a, input, win,
218 mln_trait_image_speed(I)());
227 template <
typename A,
typename I,
typename W>
228 mln_ch_value(I, mln_result(A))
230 const Window<W>& win)
232 mln_trace(
"data::compute_in_window");
234 internal::compute_in_window_tests(a, input, win);
236 mln_ch_value(I, mln_result(A))
237 output =
data::internal::compute_in_window_dispatch(a, input, win);
243 template <typename A, typename I, typename W>
244 mln_ch_value(I, mln_result(A))
246 const Window<W>& win)
248 typedef mln_accu_with(A, mln_value(I)) A_;
249 A_ a_ = accu::unmeta(
exact(a), mln_value(I)());
254 # endif // ! MLN_INCLUDE_ONLY
261 #endif // ! MLN_DATA_COMPUTE_IN_WINDOW_HH