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>
54 template <
typename I>
class labeled_image;
57 template <
typename T>
struct nil;
58 template <
typename T>
struct bbox;
67 struct data< labeled_image<I> >
68 :
data< labeled_image_base<I, labeled_image<I> > >
72 data(
const I& ima,
const mln_value(I)& nlabels);
73 data(
const I& ima,
const mln_value(I)& nlabels,
74 const util::array<mln_box(I)>& bboxes);
84 struct image_< labeled_image<I> >
85 : image_< labeled_image_base<I, labeled_image<I> > >
105 template <
typename I>
132 void init_(
const I& ima,
const mln_value(I)& nlabels);
144 template <
typename I,
typename J>
153 template <
typename I>
162 # ifndef MLN_INCLUDE_ONLY
173 template <
typename I>
176 : super_(ima, nlabels)
180 template <
typename I>
183 const util::array<mln_box(I)>& bboxes)
184 : super_(ima, nlabels, bboxes)
192 template <
typename I>
198 template <
typename I>
205 template <
typename I>
211 this->data_ =
new internal::data< labeled_image<I> >(ima, nlabels, bboxes);
215 template <
typename I>
221 this->data_ =
new internal::data< labeled_image<I> >(ima, nlabels);
224 this->data_->nlabels_);
227 template <
typename I>
230 labeled_image<I>::init_from_(
const labeled_image<I>& model)
233 =
new internal::data< labeled_image<I> >(duplicate(model.hook_data_()->ima_),
235 this->data_->bboxes_ = model.hook_data_()->bboxes_;
240 template <
typename I,
typename J>
241 void init_(tag::image_t, labeled_image<I>& target,
242 const labeled_image<J>& model)
245 init_(tag::image, ima, model);
246 target.init_(ima, model.nlabels());
255 template <
typename I>
257 labeled_image(
const Image<I>& ima,
const mln_value(I)& nlabels)
259 mln_precondition(exact(ima).is_valid());
267 # endif // ! MLN_INCLUDE_ONLY
272 #endif // ! MLN_CORE_IMAGE_IMORPH_LABELED_IMAGE_HH