27 # define MLN_OPT_AT_HH
33 # include <mln/core/concept/image.hh>
34 # include <mln/trait/images.hh>
35 # include <mln/trace/all.hh>
37 # include <mln/core/alias/point1d.hh>
38 # include <mln/core/alias/point2d.hh>
39 # include <mln/core/alias/point3d.hh>
50 mln_rvalue(I)
at(const Image<I>& ima, def::coord ind);
54 mln_lvalue(I)
at(Image<I>& ima, def::coord ind);
60 mln_rvalue(I)
at(const Image<I>& ima, def::coord row, def::coord col);
64 mln_lvalue(I)
at(Image<I>& ima, def::coord row, def::coord col);
70 mln_rvalue(I)
at(const Image<I>& ima,
71 def::coord sli, def::coord row, def::coord col);
78 mln_lvalue(I)
at(Image<I>& ima,
79 def::coord sli, def::coord row, def::coord col);
82 # ifndef MLN_INCLUDE_ONLY
91 mln_rvalue(I) at_1d_impl(trait::image::category::domain_morpher,
92 const Image<I>& ima, def::coord ind)
100 mln_rvalue(I) at_1d_impl(trait::image::category::morpher,
101 const Image<I>& ima, def::coord ind)
105 return at(*exact(ima).delegatee_(), ind);
108 template <
typename I>
110 mln_rvalue(I) at_1d_impl(trait::image::category::
primary,
111 const Image<I>& ima, def::coord ind)
113 return exact(ima).at_(ind);
117 template <
typename I>
119 mln_lvalue(I) at_1d_impl(trait::image::category::domain_morpher,
120 Image<I>& ima, def::coord ind)
122 mlc_is(mln_trait_image_pw_io(I),
123 trait::image::pw_io::read_write)::check();
126 return exact(ima)(p);
129 template <
typename I>
131 mln_lvalue(I) at_1d_impl(trait::image::category::morpher,
132 Image<I>& ima, def::coord ind)
136 return at(*exact(ima).delegatee_(), ind);
139 template <
typename I>
141 mln_lvalue(I) at_1d_impl(trait::image::category::primary,
142 Image<I>& ima, def::coord ind)
144 return exact(ima).at_(ind);
149 template <
typename I>
151 mln_rvalue(I)
at(const
Image<I>& ima, def::coord ind)
153 mlc_is(mln_trait_image_dimension(I),
154 trait::image::dimension::one_d)::check();
156 return impl::at_1d_impl(mln_trait_image_category(I)(), ima, ind);
159 template <
typename I>
160 mln_lvalue(I)
at(
Image<I>& ima, def::coord ind)
162 mlc_is(mln_trait_image_dimension(I),
163 trait::image::dimension::one_d)::check();
165 return impl::at_1d_impl(mln_trait_image_category(I)(), ima, ind);
174 template <
typename I>
176 mln_rvalue(I) at_2d_impl(trait::image::category::domain_morpher,
177 const
Image<I>& ima, def::coord row, def::coord col)
180 return exact(ima)(p);
183 template <
typename I>
185 mln_rvalue(I) at_2d_impl(trait::image::category::morpher,
186 const Image<I>& ima, def::coord row, def::coord col)
190 return at(*exact(ima).delegatee_(), row, col);
193 template <
typename I>
195 mln_rvalue(I) at_2d_impl(trait::image::category::primary,
196 const Image<I>& ima, def::coord row, def::coord col)
198 return exact(ima).at_(row, col);
202 template <
typename I>
204 mln_lvalue(I) at_2d_impl(trait::image::category::domain_morpher,
205 Image<I>& ima, def::coord row, def::coord col)
207 mlc_is(mln_trait_image_pw_io(I),
208 trait::image::pw_io::read_write)::check();
211 return exact(ima)(p);
214 template <
typename I>
216 mln_lvalue(I) at_2d_impl(trait::image::category::morpher,
217 Image<I>& ima, def::coord row, def::coord col)
221 return at(*exact(ima).delegatee_(), row, col);
224 template <
typename I>
226 mln_lvalue(I) at_2d_impl(trait::image::category::primary,
227 Image<I>& ima, def::coord row, def::coord col)
229 return exact(ima).at_(row, col);
234 template <
typename I>
236 mln_rvalue(I)
at(const
Image<I>& ima, def::coord row, def::coord col)
238 mlc_is(mln_trait_image_dimension(I),
239 trait::image::dimension::two_d)::check();
241 return impl::at_2d_impl(mln_trait_image_category(I)(), ima, row, col);
244 template <
typename I>
245 mln_lvalue(I)
at(
Image<I>& ima, def::coord row, def::coord col)
247 mlc_is(mln_trait_image_dimension(I),
248 trait::image::dimension::two_d)::check();
250 return impl::at_2d_impl(mln_trait_image_category(I)(), ima, row, col);
258 template <
typename I>
260 mln_rvalue(I) at_3d_impl(trait::image::category::domain_morpher,
261 const
Image<I>& ima, def::coord sli, def::coord row, def::coord col)
264 return exact(ima)(p);
267 template <
typename I>
269 mln_rvalue(I) at_3d_impl(trait::image::category::morpher,
270 const Image<I>& ima, def::coord sli, def::coord row, def::coord col)
274 return at(*exact(ima).delegatee_(), sli, row, col);
277 template <
typename I>
279 mln_rvalue(I) at_3d_impl(trait::image::category::primary,
280 const Image<I>& ima, def::coord sli, def::coord row, def::coord col)
282 return exact(ima).at_(sli, row, col);
286 template <
typename I>
288 mln_lvalue(I) at_3d_impl(trait::image::category::domain_morpher,
289 Image<I>& ima, def::coord sli, def::coord row, def::coord col)
291 mlc_is(mln_trait_image_pw_io(I),
292 trait::image::pw_io::read_write)::check();
295 return exact(ima)(p);
298 template <
typename I>
300 mln_lvalue(I) at_3d_impl(trait::image::category::morpher,
301 Image<I>& ima, def::coord sli, def::coord row, def::coord col)
305 return at(*exact(ima).delegatee_(), sli, row, col);
308 template <
typename I>
310 mln_lvalue(I) at_3d_impl(trait::image::category::primary,
311 Image<I>& ima, def::coord sli, def::coord row, def::coord col)
313 return exact(ima).at_(sli, row, col);
318 template <
typename I>
320 mln_rvalue(I)
at(const
Image<I>& ima, def::coord sli, def::coord row, def::coord col)
322 mlc_is(mln_trait_image_dimension(I),
323 trait::image::dimension::three_d)::check();
325 return impl::at_3d_impl(mln_trait_image_category(I)(),
329 template <
typename I>
330 mln_lvalue(I)
at(
Image<I>& ima, def::coord sli, def::coord row, def::coord col)
332 mlc_is(mln_trait_image_dimension(I),
333 trait::image::dimension::three_d)::check();
335 return impl::at_3d_impl(mln_trait_image_category(I)(),
339 # endif // ! MLN_INCLUDE_ONLY
346 #endif // ! MLN_OPT_AT_HH