26 #ifndef MLN_MAKE_EDGE_IMAGE_HH
27 # define MLN_MAKE_EDGE_IMAGE_HH
33 # include <mln/core/image/edge_image.hh>
34 # include <mln/core/image/vertex_image.hh>
35 # include <mln/core/concept/function.hh>
36 # include <mln/util/internal/id2element.hh>
37 # include <mln/data/fill.hh>
54 template <
typename V,
typename G>
56 edge_image(
const Graph<G>& g,
const fun::i2v::array<V>& fv);
65 template <
typename FV,
typename G>
67 edge_image(
const Graph<G>& g,
const Function_v2v<FV>& fv);
78 template <
typename FP,
typename FV,
typename G>
81 const Function_v2v<FP>& fp,
82 const Function_v2v<FV>& fv);
95 template <
typename P,
typename V,
typename G,
typename FP,
typename FV>
98 const p_edges<G,FP> pe,
99 const Function_vv2v<FV>& fv_);
112 template <
typename P,
typename V,
typename G,
typename FV>
115 const Function_vv2v<FV>& fv_);
128 template <
typename P,
typename V,
typename G,
typename F>
131 const Function_v2b<F>& fv_);
134 # ifndef MLN_INCLUDE_ONLY
138 template <
typename V,
typename G>
141 edge_image(
const Graph<G>& g,
const fun::i2v::array<V>& fv)
143 mln_trace(
"make::edge_image");
144 mln_precondition(
exact(g).is_valid());
152 template <
typename FV,
typename G>
155 const Function_v2v<FV>& fv)
157 mln_trace(
"make::edge_image");
158 const G& g =
exact(g_);
159 const FV& f =
exact(fv);
160 mln_precondition(g.is_valid());
166 mln_piter(ima_t) e(ima.domain());
174 template <typename FP, typename FV, typename G>
176 mln::
edge_image<mln_result(FP),mln_result(FV),G>
178 const Function_v2v<FP>& fp,
179 const Function_v2v<FV>& fv)
181 mln_trace(
"make::edge_image");
182 const G& g =
exact(g_);
183 mln_precondition(g.is_valid());
185 p_edges<G,FP> pe(g,fp);
193 template <
typename P,
typename V,
typename G,
typename FP,
typename FV>
197 const p_edges<G,FP> pe,
198 const Function_vv2v<FV>& fv_)
200 mln_trace(
"make::edge_image");
202 const FV& fv =
exact(fv_);
207 edge_ima_t ima_e(pe);
209 mln_piter(edge_ima_t) e(ima_e.domain());
211 ima_e(e) = fv(e.element().v1(), e.element().v2());
218 template <typename P, typename V, typename G, typename FV>
222 const Function_vv2v<FV>& fv_)
224 mln_trace(
"make::edge_image");
226 const FV& fv =
exact(fv_);
230 p_edges<G> pe(v_ima.
domain().graph());
232 edge_ima_t ima_e(pe);
234 mln_piter(edge_ima_t) e(ima_e.domain());
236 ima_e(e) = fv(v_ima(e.element().v1()), v_ima(e.element().v2()));
242 template <typename P, typename V, typename G, typename F>
246 const Function_v2b<F>& fv_)
248 mln_trace(
"make::edge_image");
250 const F& fv =
exact(fv_);
252 const v_ima_t& v_ima =
exact(v_ima_);
253 mln_precondition(v_ima.is_valid());
255 p_edges<G> pe(v_ima.domain().graph());
257 edge_ima_t ima_e(pe);
260 mln_piter(v_ima_t)
p(v_ima.domain());
264 typename v_ima_t::edge_win_t
win;
265 mln_qiter(v_ima_t::edge_win_t) q(win, p);
275 # endif // ! MLN_INCLUDE_ONLY
282 #endif // ! MLN_MAKE_EDGE_IMAGE_HH