26 #ifndef MLN_TRANSFORM_INTERNAL_INFLUENCE_ZONE_FUNCTOR_HH
27 # define MLN_TRANSFORM_INTERNAL_INFLUENCE_ZONE_FUNCTOR_HH
33 # include <mln/core/routine/duplicate.hh>
47 struct influence_zone_functor
49 typedef mln_value(I) V;
50 typedef mln_psite(I) P;
52 influence_zone_functor();
53 influence_zone_functor(const V& background_value);
55 mln_concrete(I) output;
57 void init(const I& input);
58 bool inqueue_p_wrt_input_p(const V& input_p);
59 bool inqueue_p_wrt_input_n(const V& input_n);
60 void init_p(const P&);
61 void process(const P& p, const P& n);
63 void init_(const I& input);
64 bool inqueue_p_wrt_input_p_(const V& input_p);
65 bool inqueue_p_wrt_input_n_(const V& input_n);
66 void init_p_(
unsigned);
67 void process_(
unsigned p,
unsigned n);
73 # ifndef MLN_INCLUDE_ONLY
78 influence_zone_functor<I>::influence_zone_functor()
86 influence_zone_functor<I>::influence_zone_functor(
const V& background_value)
88 background_value_ = background_value;
97 influence_zone_functor<I>::init(
const I& input)
102 template <
typename I>
105 influence_zone_functor<I>::inqueue_p_wrt_input_p(
const V& input_p)
107 return input_p != background_value_;
110 template <
typename I>
113 influence_zone_functor<I>::inqueue_p_wrt_input_n(
const V& input_n)
115 return input_n == background_value_;
118 template <
typename I>
121 influence_zone_functor<I>::init_p(
const P&)
125 template <
typename I>
127 void influence_zone_functor<I>::process(
const P& p,
const P& n)
129 output(n) = output(p);
136 template <
typename I>
139 influence_zone_functor<I>::init_(
const I& input)
144 template <
typename I>
147 influence_zone_functor<I>::inqueue_p_wrt_input_p_(
const V& input_p)
149 return input_p != background_value_;
152 template <
typename I>
155 influence_zone_functor<I>::inqueue_p_wrt_input_n_(
const V& input_n)
157 return input_n == background_value_;
160 template <
typename I>
163 influence_zone_functor<I>::init_p_(
unsigned)
167 template <
typename I>
169 void influence_zone_functor<I>::process_(
unsigned p,
unsigned n)
171 output.element(n) = output.element(p);
175 # endif // ! MLN_INCLUDE_ONLY
184 #endif // ! MLN_TRANSFORM_INTERNAL_INFLUENCE_ZONE_FUNCTOR_HH