27 #ifndef MLN_LABELING_PACK_HH
28 # define MLN_LABELING_PACK_HH
35 # include <mln/core/concept/image.hh>
37 # include <mln/make/relabelfun.hh>
39 # include <mln/data/compute.hh>
40 # include <mln/data/transform.hh>
42 # include <mln/accu/label_used.hh>
65 pack(const Image<I>& label, mln_value(I)& new_nlabels,
66 fun::i2v::array<mln_value(I)>& repack_fun);
82 pack(const Image<I>& label, mln_value(I)& new_nlabels);
96 fun::i2v::array<mln_value(I)>& repack_fun);
100 template <typename I>
102 pack_inplace(Image<I>& label, mln_value(I)& new_nlabels);
106 # ifndef MLN_INCLUDE_ONLY
112 template <
typename I>
114 pack_tests(
const Image<I>& label, mln_value(I)& new_nlabels)
118 mln_precondition(
exact(label).is_valid());
127 template <
typename I>
129 pack(const Image<I>& label, mln_value(I)& new_nlabels)
131 fun::i2v::array<mln_value(I)> repack_fun;
132 return pack(label, new_nlabels, repack_fun);
136 template <
typename I>
138 pack(const Image<I>& label, mln_value(I)& new_nlabels,
139 fun::i2v::array<mln_value(I)>& repack_fun)
141 mln_trace(
"labeling::pack");
143 internal::pack_tests(label, new_nlabels);
145 fun::i2v::array<bool>
148 mln_value(I) tmp_nlabels = fv2b.size() - 1;
150 repack_fun = make::relabelfun(fv2b, tmp_nlabels, new_nlabels);
159 template <typename I>
161 pack_inplace(Image<I>& label, mln_value(I)& new_nlabels)
163 fun::i2v::array<mln_value(I)> repack_fun;
168 template <
typename I>
170 pack_inplace(Image<I>& label, mln_value(I)& new_nlabels,
171 fun::i2v::array<mln_value(I)>& repack_fun)
173 mln_trace(
"labeling::pack_inplace");
175 internal::pack_tests(label, new_nlabels);
177 fun::i2v::array<bool>
180 mln_value(I) tmp_nlabels = fv2b.size() - 1;
181 repack_fun = make::relabelfun(fv2b, tmp_nlabels, new_nlabels);
188 # endif // ! MLN_INCLUDE_ONLY
195 #endif // ! MLN_LABELING_PACK_HH