26 #ifndef MLN_MORPHO_DILATION_HH
27 # define MLN_MORPHO_DILATION_HH
35 # include <mln/morpho/includes.hh>
36 # include <mln/morpho/general.hh>
37 # include <mln/accu/logic/lor.hh>
38 # include <mln/accu/logic/lor_basic.hh>
39 # include <mln/accu/stat/max.hh>
40 # include <mln/accu/stat/max_h.hh>
50 template <
typename I,
typename W>
52 dilation(const Image<I>& input, const Window<W>& win);
55 # ifndef MLN_INCLUDE_ONLY
62 mln_morpho_select_accu(I, logic::lor_basic, stat::max)
63 accu(const Image<I>&)
const
65 mln_morpho_select_accu(I, logic::lor_basic, stat::max) tmp;
70 mln_morpho_select_accu(I, logic::lor, stat::max_h)
71 accu_incr(const Image<I>&)
const
73 mln_morpho_select_accu(I, logic::lor, stat::max_h) tmp;
78 mln_value(I) neutral(const Image<I>&)
const
80 return internal::neutral<I>::infimum();
92 template <
typename I,
typename W>
94 general_on_set_centered(const dilation_op&,
95 const Image<I>& input_, const Window<W>& win_)
97 trace::entering(
"morpho::impl::general_on_set_centered__dilation");
99 typedef mln_concrete(I) O;
100 const I& input = exact(input_);
101 const W& win = exact(win_);
103 extension::adjust_fill(input, win, false);
108 mln_piter(I) p(input.domain());
109 mln_qiter(W) q(win, p);
111 if (input(p) == false)
112 for_all(q) if (input.has(q))
113 if (input(q) == true)
119 trace::exiting(
"morpho::impl::general_on_set_centered__dilation");
124 template <
typename I,
typename W>
126 general_on_set_centered_fastest(const dilation_op&,
127 const Image<I>& input_, const Window<W>& win_)
129 trace::entering(
"morpho::impl::general_on_set_centered_fastest__dilation");
131 typedef mln_concrete(I) O;
132 const I& input = exact(input_);
133 const W& win = exact(win_);
135 extension::adjust_fill(input, win, false);
140 mln_pixter(const I) p(input);
141 mln_qixter(const I, W) q(p, win);
142 mln_pixter(O) p_out(output);
144 if (p.val() == false)
152 trace::exiting(
"morpho::impl::general_on_set_centered_fastest__dilation");
159 template <
typename I,
typename W>
164 trace::entering(
"morpho::dilation");
165 mln_precondition(exact(input).is_valid());
166 mln_precondition(! exact(win).is_empty());
168 mln_concrete(I) output =
general(dilation_op(), input, win);
170 if (exact(win).is_centered())
171 mln_postcondition(output >= input);
173 trace::exiting(
"morpho::dilation");
177 # endif // ! MLN_INCLUDE_ONLY
184 #endif // ! MLN_MORPHO_DILATION_HH