27 #ifndef MLN_CORE_IMAGE_EDGE_IMAGE_HH
28 # define MLN_CORE_IMAGE_EDGE_IMAGE_HH
34 # include <mln/core/concept/graph.hh>
35 # include <mln/core/site_set/p_edges.hh>
36 # include <mln/core/image/graph_elt_window.hh>
37 # include <mln/core/image/graph_elt_neighborhood.hh>
38 # include <mln/pw/internal/image_base.hh>
39 # include <mln/fun/i2v/array.hh>
46 template <
typename P,
typename V,
typename G>
class edge_image;
47 namespace util {
class graph; }
55 template <
typename P,
typename V,
typename G>
57 : pw_image_<fun::i2v::array<V>,
58 p_edges<util::graph, fun::i2v::array<P> >,
73 template <
typename P,
typename V,
typename G>
76 typedef typename edge_image<P,V,G>::site_function_t site_function_t;
78 data(
const fun::i2v::array<V>& edge_values,
79 const p_edges<G,site_function_t>& pe);
81 fun::i2v::array<V> f_;
82 p_edges<G,site_function_t> domain_;
92 template <
typename V,
typename G,
typename P>
94 operator | (
const fun::i2v::array<V>& edge_values,
95 const p_edges<G,fun::i2v::array<P> >& pe);
103 template <
typename P,
typename G>
111 template <
typename G>
125 template <
typename P,
typename V,
typename G = util::graph>
128 p_edges<G, typename internal::efsite_selector<P,G>::site_function_t >,
176 template <typename FP, typename FV>
181 template <typename FV>
188 rvalue operator()(
unsigned e_id) const;
189 lvalue operator()(
unsigned e_id);
201 template <typename P, typename V, typename G, typename J>
206 # ifndef MLN_INCLUDE_ONLY
208 template <
typename P,
typename V,
typename G,
typename J>
220 template <
typename V,
typename G,
typename P>
237 template <
typename P,
typename V,
typename G>
240 const p_edges<G,site_function_t>& ps)
252 template <
typename P,
typename V,
typename G>
254 edge_image<P,V,G>::edge_image()
258 template <
typename P,
typename V,
typename G>
260 edge_image<P,V,G>::edge_image(
const p_edges<G,site_function_t>& pe)
261 : super_(fun::i2v::array<V>(pe.
nsites()), pe)
265 template <
typename P,
typename V,
typename G>
268 const Function_v2v< site_function_t >& edge_sites,
269 const Function_v2v< fun::i2v::array<V> >& edge_values)
270 : super_(
exact(edge_values),
271 p_edges<G,site_function_t>(g,
exact(edge_sites)))
275 template <
typename P,
typename V,
typename G>
278 const Function_v2v< fun::i2v::array<V> >& edge_values)
279 : super_(
exact(edge_values), pe)
283 template <
typename P,
typename V,
typename G>
284 template <
typename FP,
typename FV>
287 const Function_v2v<FP>& edge_sites,
288 const Function_v2v<FV>& edge_values)
290 p_edges<G,site_function_t>(g,
exact(edge_sites)))
292 mlc_equal(mln_result(FP),P)::check();
293 mlc_equal(mln_result(FV),V)::check();
296 template <
typename P,
typename V,
typename G>
297 template <
typename FV>
300 const Function_v2v<FV>& edge_values)
301 : super_(
convert::
to<fun::i2v::array<V> >(
exact(edge_values)), pe)
303 mlc_equal(mln_result(FV),V)::check();
306 template <
typename P,
typename V,
typename G>
307 typename edge_image<P,V,G>::rvalue
310 return this->data_->f_(e_id);
313 template <
typename P,
typename V,
typename G>
314 typename edge_image<P,V,G>::lvalue
317 return this->data_->f_(e_id);
320 template <
typename P,
typename V,
typename G>
321 typename edge_image<P,V,G>::rvalue
324 return this->super_::operator()(p);
327 template <
typename P,
typename V,
typename G>
328 typename edge_image<P,V,G>::lvalue
331 return this->super_::operator()(p);
334 # endif // ! MLN_INCLUDE_ONLY
339 #endif // ! MLN_CORE_IMAGE_EDGE_IMAGE_HH