27 #ifndef MLN_LABELING_FLAT_ZONES_HH
28 # define MLN_LABELING_FLAT_ZONES_HH
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/neighborhood.hh>
36 # include <mln/canvas/labeling/video.hh>
54 template <
typename I,
typename N,
typename L>
56 flat_zones(const Image<I>& input, const Neighborhood<N>& nbh,
61 # ifndef MLN_INCLUDE_ONLY
68 template <
typename I,
typename L>
69 struct flat_zones_functor
75 typedef mln_psite(I) P;
78 bool handles(
const P&)
const {
return true; }
80 bool equiv(
const P& n,
const P&
p)
const
81 {
return input(n) == input(p); }
83 bool labels(
const P&)
const {
return true; }
84 void do_no_union(
const P&,
const P&) {}
85 void init_attr(
const P&) {}
86 void merge_attr(
const P&,
const P&) {}
87 void set_new_label(
const P&,
const L&){}
88 void set_label(
const P&,
const L&) {}
96 bool handles_(
unsigned)
const
99 bool equiv_(
unsigned n,
unsigned p)
const
100 {
return input.element(n) == input.element(p); }
102 bool labels_(
unsigned)
const {
return true; }
103 void do_no_union_(
unsigned,
unsigned) {}
104 void init_attr_(
unsigned) {}
105 void merge_attr_(
unsigned,
unsigned) {}
106 void set_new_label_(
unsigned,
const L&) {}
107 void set_label_(
unsigned,
const L&) {}
112 flat_zones_functor(
const I& input)
124 template <
typename I,
typename N,
typename L>
126 flat_zones(const Image<I>& input_, const Neighborhood<N>& nbh_,
129 mln_trace(
"labeling::flat_zones");
131 const I& input =
exact(input_);
132 const N& nbh =
exact(nbh_);
133 mln_precondition(input.is_valid());
136 typedef impl::flat_zones_functor<I,L> F;
138 mln_ch_value(I, L) output =
144 # endif // ! MLN_INCLUDE_ONLY
151 #endif // ! MLN_LABELING_FLAT_ZONES_HH