Commit 6270c8c9 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

core/component_set.hh: Add a new internal member valid_comps_image_().

parent 290ccbee
2010-08-04 Guillaume Lazzara <z@lrde.epita.fr>
* core/component_set.hh: Add a new internal member
valid_comps_image_().
2010-08-04 Guillaume Lazzara <z@lrde.epita.fr> 2010-08-04 Guillaume Lazzara <z@lrde.epita.fr>
* filter/object_groups_with_holes.hh: Fix an invalid mismatch * filter/object_groups_with_holes.hh: Fix an invalid mismatch
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
# include <mln/accu/shape/bbox.hh> # include <mln/accu/shape/bbox.hh>
# include <mln/labeling/compute.hh> # include <mln/labeling/compute.hh>
# include <mln/labeling/relabel.hh>
# include <mln/convert/from_to.hh> # include <mln/convert/from_to.hh>
...@@ -198,6 +199,13 @@ namespace scribo ...@@ -198,6 +199,13 @@ namespace scribo
// //
L& labeled_image_(); 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: private:
...@@ -493,6 +501,28 @@ namespace scribo ...@@ -493,6 +501,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> template <typename L>
inline inline
bool bool
......
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