Commit f70c8e0a authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Add hooks for subclasses in labeled_image_base.

	* mln/core/internal/labeled_image_base.hh: New methods which can
	be overridden in subclasses.

	* mln/core/image/imorph/labeled_image.hh: Add a missing header.
parent 542fcf95
2009-12-14 Guillaume Lazzara <z@lrde.epita.fr>
Add hooks for subclasses in labeled_image_base.
* mln/core/internal/labeled_image_base.hh: New methods which can
be overridden in subclasses.
* mln/core/image/imorph/labeled_image.hh: Add a missing header.
2010-03-11 Guillaume Lazzara <z@lrde.epita.fr>
 
Small fixes.
......@@ -34,6 +34,8 @@
# include <mln/core/routine/duplicate.hh>
# include <mln/data/compute.hh>
# include <mln/util/array.hh>
# include <mln/accu/center.hh>
......
......@@ -168,7 +168,13 @@ namespace mln
template <typename F>
void relabel_(const Function_v2b<F>& f);
/// Called during relabeling.
/// @{
void init_update_data_();
void prepare_update_data_(const mln_value(I)& lbl,
const mln_value(I)& new_lbl);
void update_data_(const fun::i2v::array<mln_value(I)>& relabel_fun);
/// @}
};
......@@ -275,9 +281,14 @@ namespace mln
util::array<accu::shape::bbox<mln_psite(I)> >
new_bboxes(static_cast<unsigned>(this->data_->nlabels_) + 1);
exact(this)->init_update_data_();
for (unsigned i = 1; i < this->data_->bboxes_.size(); ++i)
if (relabel_fun(i) != 0)
{
new_bboxes[relabel_fun(i)].take(this->data_->bboxes_[i]);
exact(this)->prepare_update_data_(i, relabel_fun(i));
}
convert::from_to(new_bboxes, this->data_->bboxes_);
......@@ -341,6 +352,24 @@ namespace mln
// No-Op.
}
template <typename I, typename E>
void
labeled_image_base<I,E>::prepare_update_data_(const mln_value(I)& lbl,
const mln_value(I)& new_lbl)
{
(void) lbl;
(void) new_lbl;
// No-Op.
}
template <typename I, typename E>
void
labeled_image_base<I,E>::init_update_data_()
{
// No-Op.
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment