27 #ifndef MLN_CORE_IMAGE_IMORPH_LABELED_IMAGE_HH
28 # define MLN_CORE_IMAGE_IMORPH_LABELED_IMAGE_HH
34 # include <mln/core/internal/labeled_image_base.hh>
36 # include <mln/core/routine/duplicate.hh>
38 # include <mln/data/compute.hh>
40 # include <mln/util/array.hh>
42 # include <mln/accu/center.hh>
43 # include <mln/accu/shape/bbox.hh>
44 # include <mln/accu/stat/max.hh>
46 # include <mln/data/compute.hh>
48 # include <mln/labeling/compute.hh>
57 template <
typename T>
struct nil;
58 template <
typename T>
struct bbox;
70 :
data< labeled_image_base<I, labeled_image<I> > >
74 data(
const I& ima,
const mln_value(I)& nlabels);
75 data(
const I& ima,
const mln_value(I)& nlabels,
76 const util::array<mln_box(I)>& bboxes);
87 : image_< labeled_image_base<I, labeled_image<I> > >
107 template <
typename I>
137 void init_(
const I& ima,
const mln_value(I)& nlabels);
152 template <
typename I,
typename J>
161 template <
typename I>
170 # ifndef MLN_INCLUDE_ONLY
181 template <
typename I>
184 : super_(ima, nlabels)
188 template <
typename I>
191 const util::array<mln_box(I)>& bboxes)
192 : super_(ima, nlabels, bboxes)
200 template <
typename I>
202 labeled_image<I>::labeled_image()
206 template <
typename I>
208 labeled_image<I>::labeled_image(
const I& ima,
const mln_value(I)& nlabels)
213 template <
typename I>
215 labeled_image<I>::labeled_image(
const I& ima,
const mln_value(I)& nlabels,
216 const util::array<mln_box(I)>& bboxes)
219 this->data_ =
new internal::data< labeled_image<I> >(ima, nlabels, bboxes);
223 template <
typename I>
226 labeled_image<I>::init_(
const I& ima,
const mln_value(I)& nlabels)
229 this->data_ =
new internal::data< labeled_image<I> >(ima, nlabels);
232 this->data_->nlabels_);
235 template <
typename I>
238 labeled_image<I>::init_from_(
const labeled_image<I>& model)
241 =
new internal::data< labeled_image<I> >(
duplicate(model.hook_data_()->ima_),
243 this->data_->bboxes_ = model.hook_data_()->bboxes_;
248 template <
typename I,
typename J>
249 void init_(tag::image_t, labeled_image<I>& target,
250 const labeled_image<J>& model)
253 init_(tag::image, ima, model);
254 target.init_(ima, model.nlabels());
263 template <
typename I>
265 labeled_image(
const Image<I>& ima,
const mln_value(I)& nlabels)
267 mln_precondition(
exact(ima).is_valid());
275 # endif // ! MLN_INCLUDE_ONLY
280 #endif // ! MLN_CORE_IMAGE_IMORPH_LABELED_IMAGE_HH