26 #include <mln/core/image/image3d.hh>
27 #include <mln/canvas/browsing/snake_generic.hh>
28 #include <mln/fun/p2v/iota.hh>
29 #include <mln/debug/println.hh>
32 template <
typename I,
typename F>
33 struct assign_browsing_functor
35 typedef mln_site(I) S;
36 enum { dim = S::dim };
38 typedef assign_browsing_functor<I, F>
self;
40 typedef
void (assign_browsing_functor<I,F>::*move_fun)();
44 std::vector<move_fun> moves;
45 std::vector<dpsite> dps;
47 assign_browsing_functor(I& input, F f = F())
53 dps[0] = dpsite(1, 0, 0);
54 dps[1] = dpsite(0, 1, 0);
55 dps[2] = dpsite(0, -1, 0);
56 dps[3] = dpsite(0, 0, 1);
57 dps[4] = dpsite(0, 0, -1);
59 moves[0] = &self::thr;
60 moves[1] = &self::down;
62 moves[3] = &self::fwd;
63 moves[4] = &self::bkd;
74 void fwd() { std::cout <<
"fwd" << std::endl;
next(); }
75 void bkd() { std::cout <<
"bkd" << std::endl;
next(); }
76 void down() { std::cout <<
"down" << std::endl;
next(); }
77 void up() { std::cout <<
"up" << std::endl;
next(); }
78 void thr() { std::cout <<
"thr" << std::endl;
next(); }
84 template <
typename I,
typename F,
typename B>
86 const Function_v2v<F>& f_,
87 const Browsing<B>& browse_)
90 const F& f =
exact(f_);
91 const B& browse =
exact(browse_);
93 assign_browsing_functor<I, F> fun(ima, f);
106 std::cout << ima.bbox() << std::endl;