last-svn-commit-21-g495dd2d 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. --- milena/ChangeLog | 9 +++++++ milena/mln/core/image/imorph/labeled_image.hh | 2 + milena/mln/core/internal/labeled_image_base.hh | 29 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 0 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index bcaf644..39c2d80 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,12 @@ +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> * mln/draw/dashed_line.hh: New draw line routine. diff --git a/milena/mln/core/image/imorph/labeled_image.hh b/milena/mln/core/image/imorph/labeled_image.hh index 438f6ae..fc151e8 100644 --- a/milena/mln/core/image/imorph/labeled_image.hh +++ b/milena/mln/core/image/imorph/labeled_image.hh @@ -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> diff --git a/milena/mln/core/internal/labeled_image_base.hh b/milena/mln/core/internal/labeled_image_base.hh index e79bb12..9e2d314 100644 --- a/milena/mln/core/internal/labeled_image_base.hh +++ b/milena/mln/core/internal/labeled_image_base.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 -- 1.5.6.5
participants (1)
-
Guillaume Lazzara