---
scribo/ChangeLog | 5 +++++
scribo/core/component_set.hh | 30 ++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 8d151f4..8ae04f3 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,10 @@
2010-08-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * core/component_set.hh: Add a new internal member
+ valid_comps_image_().
+
+2010-08-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
* filter/object_groups_with_holes.hh: Fix an invalid mismatch
between groups ids and their related component ids and add more
comments.
diff --git a/scribo/core/component_set.hh b/scribo/core/component_set.hh
index ef7ae4e..b8445eb 100644
--- a/scribo/core/component_set.hh
+++ b/scribo/core/component_set.hh
@@ -43,6 +43,7 @@
# include <mln/accu/shape/bbox.hh>
# include <mln/labeling/compute.hh>
+# include <mln/labeling/relabel.hh>
# include <mln/convert/from_to.hh>
@@ -198,6 +199,13 @@ namespace scribo
//
L& labeled_image_();
+ /// Return the underlying labeled image where invalid components
+ /// have been erased.
+ ///
+ /// WARNING: this image is computed on the fly...!
+ //
+ mln_concrete(L) valid_comps_image_() const;
+
/// @}
private:
@@ -495,6 +503,28 @@ namespace scribo
template <typename L>
inline
+ mln_concrete(L)
+ component_set<L>::valid_comps_image_() const
+ {
+ mln::util::array<bool> f(unsigned(this->data_->ncomps_) + 1);
+ f(0) = true;
+
+ for_all_comps(c, (*this))
+ f(c) = (*this)(c).is_valid();
+
+ mln_value(L) new_ncomps;
+ mln_concrete(L)
+ output = mln::labeling::relabel(this->data_->ima_,
+ this->data_->ncomps_,
+ new_ncomps,
+ f);
+
+ return output;
+ }
+
+
+ template <typename L>
+ inline
bool
component_set<L>::has_separators() const
{
--
1.5.6.5
Show replies by date