27 #ifndef MLN_LABELING_RELABEL_HH
28 # define MLN_LABELING_RELABEL_HH
35 # include <mln/core/concept/image.hh>
37 # include <mln/make/relabelfun.hh>
39 # include <mln/data/transform.hh>
40 # include <mln/data/transform_inplace.hh>
62 template <
typename I,
typename F>
65 const mln_value(I)& nlabels,
66 mln_value(I)& new_nlabels,
67 const Function_v2b<F>& fv2b);
80 template <typename I, typename F>
83 const mln_value(I)& nlabels,
84 const Function_v2v<F>& fv2v);
96 template <typename I, typename F>
99 const mln_value(I)& nlabels,
100 const Function_v2b<F>& fv2b);
112 template <typename I, typename F>
115 const mln_value(I)& nlabels,
116 const Function_v2v<F>& fv2v);
119 # ifndef MLN_INCLUDE_ONLY
126 template <
typename I>
128 relabel_tests(
const Image<I>& label,
129 mln_value(I)& new_nlabels)
133 mln_precondition(
exact(label).is_valid());
138 template <
typename I,
typename F>
140 relabel_tests(
const Image<I>& label,
141 const mln_value(I)& nlabels,
142 mln_value(I)& new_nlabels,
143 const Function<F>& f)
147 mln_precondition(
exact(label).is_valid());
154 template <
typename I,
typename F>
156 relabel_tests(
const Image<I>& label,
157 const mln_value(I)& nlabels,
158 const Function<F>& f)
162 mln_precondition(
exact(label).is_valid());
168 template <
typename I,
typename F>
171 relabel_inplace_tests(Image<I>& label,
172 const mln_value(I)& nlabels,
173 const Function<F>& f)
177 mln_precondition(
exact(label).is_valid());
187 template <
typename I,
typename F>
191 const mln_value(I)& nlabels,
192 const Function_v2v<F>& fv2v)
194 mln_trace(
"labeling::relabel");
197 mlc_not_equal(mln_result(F),
bool)::check();
198 internal::relabel_tests(label, nlabels, fv2v);
207 template <typename I, typename F>
211 const mln_value(I)& nlabels,
212 mln_value(I)& new_nlabels,
213 const Function_v2b<F>& fv2b)
215 mln_trace(
"labeling::relabel");
217 internal::relabel_tests(label, nlabels, new_nlabels, fv2b);
219 typedef fun::i2v::array<mln_value(I)> fv2v_t;
227 template <typename I, typename F>
231 const mln_value(I)& nlabels,
232 const Function_v2v<F>& fv2v)
234 mln_trace(
"labeling::relabel_inplace");
236 mlc_not_equal(mln_result(F),
bool)::check();
237 internal::relabel_inplace_tests(label, nlabels, fv2v);
245 template <
typename I,
typename F>
249 const mln_value(I)& nlabels,
250 const Function_v2b<F>& fv2b)
252 mln_trace(
"labeling::relabel_inplace");
254 internal::relabel_inplace_tests(label, nlabels, fv2b);
256 typedef fun::i2v::array<mln_value(I)> fv2v_t;
258 fv2v_t fv2v = make::relabelfun(fv2b, nlabels, tmp);
263 # endif // ! MLN_INCLUDE_ONLY
270 #endif // ! MLN_LABELING_RELABEL_HH