--- milena/mln/labeling/{value.hh => values.hh} | 38 ++++++++++++--------------- 1 files changed, 17 insertions(+), 21 deletions(-) copy milena/mln/labeling/{value.hh => values.hh} (78%)
diff --git a/milena/mln/labeling/value.hh b/milena/mln/labeling/values.hh similarity index 78% copy from milena/mln/labeling/value.hh copy to milena/mln/labeling/values.hh index 069b2a1..0031eae 100644 --- a/milena/mln/labeling/value.hh +++ b/milena/mln/labeling/values.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development +// Copyright (C) 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -24,8 +24,8 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License.
-#ifndef MLN_LABELING_VALUE_HH -# define MLN_LABELING_VALUE_HH +#ifndef MLN_LABELING_VALUES_HH +# define MLN_LABELING_VALUES_HH
/// \file /// @@ -45,17 +45,16 @@ namespace mln {
/// \brief Connected component labeling of the image sites at a given - /// value. + /// values. /// /// \param[in] input The input image. - /// \param[in] val The value to consider. /// \param[in] nbh The connectivity of components. /// \param[out] nlabels The number of labels. /// \return The label image. // template <typename I, typename N, typename L> mln_ch_value(I, L) - value(const Image<I>& input, const mln_value(I)& val, + values(const Image<I>& input, const Neighborhood<N>& nbh, L& nlabels);
@@ -69,14 +68,13 @@ namespace mln
template <typename I, typename N, typename L> void - value_tests(const Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh, + values_tests(const Image<I>& input, const Neighborhood<N>& nbh, L& nlabels) { mln_precondition(exact(input).is_valid()); mln_precondition(exact(nbh).is_valid());
(void) input; - (void) val; (void) nbh; (void) nlabels; } @@ -91,12 +89,11 @@ namespace mln // Generic functor.
template <typename I, typename L> - struct value_functor + struct values_functor { typedef mln_psite(I) P;
const I& input; - const mln_value(I)& val;
// Requirements from mln::canvas::labeling.
@@ -105,8 +102,8 @@ namespace mln // Generic implementation
void init() {} - bool handles(const P& p) const { return input(p) == val; } - bool equiv(const P& n, const P&) const { return input(n) == val; } + bool handles(const P& p) const { return true; } + bool equiv(const P& n, const P& p) const { return input(n) == input(p); } bool labels(const P&) const { return true; } void do_no_union(const P&, const P&) {} void init_attr(const P&) {} @@ -118,8 +115,8 @@ namespace mln // Fastest implementation
void init_() {} - bool handles_(unsigned p) const { return input.element(p) == val; } - bool equiv_(unsigned n, unsigned) const { return input.element(n) == val; } + bool handles_(unsigned p) const { return true; } + bool equiv_(unsigned n, unsigned p) const { return input.element(n) == input.element(p); } bool labels_(unsigned) const { return true; } void do_no_union_(unsigned, unsigned) {} void init_attr_(unsigned) {} @@ -130,9 +127,8 @@ namespace mln
// end of Requirements.
- value_functor(const Image<I>& input_, const mln_value(I)& val) - : input(exact(input_)), - val(val) + values_functor(const Image<I>& input_) + : input(exact(input_)) { } }; @@ -146,15 +142,15 @@ namespace mln
template <typename I, typename N, typename L> mln_ch_value(I, L) - value(const Image<I>& input, const mln_value(I)& val, + values(const Image<I>& input, const Neighborhood<N>& nbh, L& nlabels) { mln_trace("labeling::value");
- internal::value_tests(input, val, nbh, nlabels); + internal::values_tests(input, nbh, nlabels);
mln_ch_value(I, L) output; - impl::value_functor<I,L> f(input, val); + impl::values_functor<I,L> f(input); output = canvas::labeling::video(input, nbh, nlabels, f);
return output; @@ -167,4 +163,4 @@ namespace mln } // end of namespace mln
-#endif // ! MLN_LABELING_VALUE_HH +#endif // ! MLN_LABELING_VALUES_HH