* mln/fun/l2l/all.hh
* mln/fun/l2l/essential.hh: new headers.
* mln/value/all.hh,
* mln/accu/bbox.hh: Fix comments.
* mln/fun/i2v/array.hh: add missing constructor implementation.
* mln/value/essential.hh,
* mln/value/aliases.hh,
* mln/level/essential.hh,
* mln/labeling/essential.hh: update includes.
* mln/make/relabelfun.hh: Fix a bug. New component ids were not set
correclty.
* mln/value/label.hh: Fix a duplicate attribute.
* mln/labeling/compute.hh,
* mln/debug/colorize.hh: use label::next() instead of operator '+' to
get the next label.
---
milena/ChangeLog | 26 ++++++++++++++++
milena/mln/accu/bbox.hh | 6 ++--
milena/mln/debug/colorize.hh | 9 ++++--
milena/mln/fun/i2v/array.hh | 7 ++++
milena/mln/{value/aliases.hh => fun/l2l/all.hh} | 34 ++++++++++++++-------
milena/mln/{labeling => fun/l2l}/essential.hh | 18 +++++------
milena/mln/labeling/compute.hh | 6 ++-
milena/mln/labeling/essential.hh | 10 +++---
milena/mln/level/essential.hh | 1 +
milena/mln/make/relabelfun.hh | 3 +-
milena/mln/value/aliases.hh | 19 +++++++++---
milena/mln/value/all.hh | 9 ++---
milena/mln/value/essential.hh | 12 ++++---
milena/mln/value/label.hh | 36 +++++++----------------
14 files changed, 120 insertions(+), 76 deletions(-)
copy milena/mln/{value/aliases.hh => fun/l2l/all.hh} (75%)
copy milena/mln/{labeling => fun/l2l}/essential.hh (78%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d149788..404e42b 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,31 @@
2008-11-24 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Various small fixes.
+
+ * mln/fun/l2l/all.hh
+ * mln/fun/l2l/essential.hh: new headers.
+
+ * mln/value/all.hh,
+ * mln/accu/bbox.hh: Fix comments.
+
+ * mln/fun/i2v/array.hh: add missing constructor implementation.
+
+ * mln/value/essential.hh,
+ * mln/value/aliases.hh,
+ * mln/level/essential.hh,
+ * mln/labeling/essential.hh: update includes.
+
+ * mln/make/relabelfun.hh: Fix a bug. New component ids were not set
+ correclty.
+
+ * mln/value/label.hh: Fix a duplicate attribute.
+
+ * mln/labeling/compute.hh,
+ * mln/debug/colorize.hh: use label::next() instead of operator '+' to
+ get the next label.
+
+2008-11-24 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Update rank_filter.
* mln/accu/rank_bool.hh: Add untake() and remove unnecessary
diff --git a/milena/mln/accu/bbox.hh b/milena/mln/accu/bbox.hh
index 90c2e5d..7c3e35f 100644
--- a/milena/mln/accu/bbox.hh
+++ b/milena/mln/accu/bbox.hh
@@ -45,9 +45,9 @@ namespace mln
/// Generic bbox accumulator class.
- /*!
- * The parameter \c P is the type of points.
- */
+ ///
+ /// The parameter \c P is the type of points.
+ ///
template <typename P>
struct bbox : public mln::accu::internal::base< const box<P>& ,
bbox<P> >
{
diff --git a/milena/mln/debug/colorize.hh b/milena/mln/debug/colorize.hh
index f764278..cf99383 100644
--- a/milena/mln/debug/colorize.hh
+++ b/milena/mln/debug/colorize.hh
@@ -100,12 +100,15 @@ namespace mln
{
trace::entering("debug::colorize");
mln_precondition(exact(input).has_data());
+ // FIXME: we want to be sure that this is a label.
+ mlc_is_a(mln_value(L), mln::value::Symbolic)::check();
+ unsigned label_count = nlabels.next();
static fun::i2v::array<mln_value(I)> f(0);
- int diff_size = f.size() - (nlabels + 1);
+ int diff_size = f.size() - label_count;
if (diff_size < 0)
{
- f.resize(nlabels + 1);
+ f.resize(label_count);
unsigned i = f.size() + diff_size;
// We want to treat comp 0 differently since it is the background.
if (i == 0)
@@ -116,7 +119,7 @@ namespace mln
for (; i < f.size(); ++i)
f(i) = internal::random_color();
}
- mln_precondition(f.size() == (nlabels + 1));
+ mln_precondition(f.size() == (label_count));
mln_concrete(I) output = level::transform(input, f);
trace::exiting("debug::colorize");
diff --git a/milena/mln/fun/i2v/array.hh b/milena/mln/fun/i2v/array.hh
index ee9b1bb..630675e 100644
--- a/milena/mln/fun/i2v/array.hh
+++ b/milena/mln/fun/i2v/array.hh
@@ -166,6 +166,13 @@ namespace mln
template <typename T>
inline
+ array<T>::array(unsigned n, const T& val)
+ : super_base_(n, val)
+ {
+ }
+
+ template <typename T>
+ inline
array<T>::array(const util::array<T>& from)
: super_base_(from)
{
diff --git a/milena/mln/value/aliases.hh b/milena/mln/fun/l2l/all.hh
similarity index 75%
copy from milena/mln/value/aliases.hh
copy to milena/mln/fun/l2l/all.hh
index c3790b8..c763ca7 100644
--- a/milena/mln/value/aliases.hh
+++ b/milena/mln/fun/l2l/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,19 +25,31 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_ALIASES_HH
-# define MLN_VALUE_ALIASES_HH
+#ifndef MLN_FUN_L2L_ALL_HH
+# define MLN_FUN_L2L_ALL_HH
-/*! \file mln/value/aliases.hh
- *
- * \brief File that includes all aliases of value types.
- */
+/// \file mln/fun/l2l/all.hh
+///
+/// File that includes all functions from index to value.
-# include <mln/value/int_u8.hh>
-# include <mln/value/int_u16.hh>
+namespace mln
+{
-# include <mln/value/int_s8.hh>
+ namespace fun
+ {
+ /// Namespace of functions from label to label.
+ namespace l2l
+ {
+ }
+ }
-#endif // ! MLN_VALUE_ALIASES_HH
+}
+
+
+# include <mln/fun/l2l/relabel.hh>
+
+
+
+#endif // ! MLN_FUN_L2L_ALL_HH
diff --git a/milena/mln/labeling/essential.hh b/milena/mln/fun/l2l/essential.hh
similarity index 78%
copy from milena/mln/labeling/essential.hh
copy to milena/mln/fun/l2l/essential.hh
index 940f2c2..6ca53c0 100644
--- a/milena/mln/labeling/essential.hh
+++ b/milena/mln/fun/l2l/essential.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,15 +25,13 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LABELING_ESSENTIAL_HH
-# define MLN_LABELING_ESSENTIAL_HH
+#ifndef MLN_FUN_L2L_ESSENTIAL_HH
+# define MLN_FUN_L2L_ESSENTIAL_HH
-/*! \file mln/labeling/essential.hh
- *
- * \brief File that includes essential labeling routines.
- */
+/// \file mln/fun/l2l/essential.hh
+///
+/// File that includes essential functions from label to label.
-# include <mln/labeling/blobs.hh>
-# include <mln/labeling/compute.hh>
+# include <mln/fun/l2l/all.hh>
-#endif // ! MLN_LABELING_ESSENTIAL_HH
+#endif // ! MLN_FUN_L2L_ESSENTIAL_HH
diff --git a/milena/mln/labeling/compute.hh b/milena/mln/labeling/compute.hh
index 6233979..dfc95f1 100644
--- a/milena/mln/labeling/compute.hh
+++ b/milena/mln/labeling/compute.hh
@@ -32,6 +32,8 @@
///
/// Compute accumulators onto sites/values of each labeled component
/// of an image.
+///
+/// \todo write fastest version.
# include <mln/core/concept/image.hh>
# include <mln/core/concept/accumulator.hh>
@@ -171,7 +173,7 @@ namespace mln
const A& a = exact(a_);
const L& label = exact(label_);
- util::array<A> accus(nlabels + 1, a);
+ util::array<A> accus(nlabels.next(), a);
mln_piter(L) p(label.domain());
for_all(p)
@@ -197,7 +199,7 @@ namespace mln
const I& input = exact(input_);
const L& label = exact(label_);
- util::array<A> accus (nlabels + 1, a);
+ util::array<A> accus (nlabels.next(), a);
mln_piter(I) p(input.domain());
for_all(p)
diff --git a/milena/mln/labeling/essential.hh b/milena/mln/labeling/essential.hh
index 940f2c2..3a5544d 100644
--- a/milena/mln/labeling/essential.hh
+++ b/milena/mln/labeling/essential.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,12 +28,12 @@
#ifndef MLN_LABELING_ESSENTIAL_HH
# define MLN_LABELING_ESSENTIAL_HH
-/*! \file mln/labeling/essential.hh
- *
- * \brief File that includes essential labeling routines.
- */
+/// \file mln/labeling/essential.hh
+///
+/// File that includes essential labeling routines.
# include <mln/labeling/blobs.hh>
# include <mln/labeling/compute.hh>
+# include <mln/labeling/relabel.hh>
#endif // ! MLN_LABELING_ESSENTIAL_HH
diff --git a/milena/mln/level/essential.hh b/milena/mln/level/essential.hh
index f545c0e..e89031e 100644
--- a/milena/mln/level/essential.hh
+++ b/milena/mln/level/essential.hh
@@ -47,6 +47,7 @@
# include <mln/level/replace.hh>
# include <mln/level/saturate.hh>
# include <mln/level/transform.hh>
+# include <mln/level/transform_inplace.hh>
# include <mln/level/update.hh>
# include <mln/level/approx/essential.hh>
diff --git a/milena/mln/make/relabelfun.hh b/milena/mln/make/relabelfun.hh
index d02dd88..abbba80 100644
--- a/milena/mln/make/relabelfun.hh
+++ b/milena/mln/make/relabelfun.hh
@@ -75,8 +75,7 @@ namespace mln
for (label_t i = 1; i <= nlabels; ++i)
if (fl2b(i))
{
- fl2l(i) = i;
- ++tmp_nlabels;
+ fl2l(i) = ++tmp_nlabels;
}
new_nlabels = tmp_nlabels;
trace::exiting("mln::make::relabelfun");
diff --git a/milena/mln/value/aliases.hh b/milena/mln/value/aliases.hh
index c3790b8..8fe2485 100644
--- a/milena/mln/value/aliases.hh
+++ b/milena/mln/value/aliases.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,16 +28,25 @@
#ifndef MLN_VALUE_ALIASES_HH
# define MLN_VALUE_ALIASES_HH
-/*! \file mln/value/aliases.hh
- *
- * \brief File that includes all aliases of value types.
- */
+/// \file mln/value/aliases.hh
+///
+/// File that includes all aliases of value types.
+# include <mln/value/float01_8.hh>
+# include <mln/value/float01_16.hh>
# include <mln/value/int_u8.hh>
# include <mln/value/int_u16.hh>
+# include <mln/value/int_u32.hh>
# include <mln/value/int_s8.hh>
+# include <mln/value/int_s16.hh>
+# include <mln/value/int_s32.hh>
+# include <mln/value/label_8.hh>
+# include <mln/value/label_16.hh>
+
+# include <mln/value/rgb8.hh>
+# include <mln/value/rgb16.hh>
#endif // ! MLN_VALUE_ALIASES_HH
diff --git a/milena/mln/value/all.hh b/milena/mln/value/all.hh
index 2620f21..27ef955 100644
--- a/milena/mln/value/all.hh
+++ b/milena/mln/value/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +28,9 @@
#ifndef MLN_VALUE_ALL_HH
# define MLN_VALUE_ALL_HH
-/*! \file mln/value/all.hh
- *
- * \brief File that includes all "value types"-related materials.
- */
+/// \file mln/value/all.hh
+///
+/// File that includes all "value types"-related materials.
namespace mln
diff --git a/milena/mln/value/essential.hh b/milena/mln/value/essential.hh
index e537eff..4d0b97b 100644
--- a/milena/mln/value/essential.hh
+++ b/milena/mln/value/essential.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +28,9 @@
#ifndef MLN_VALUE_ESSENTIAL_HH
# define MLN_VALUE_ESSENTIAL_HH
-/*! \file mln/value/essential.hh
- *
- * \brief File that includes essential "value types"-related materials.
- */
+/// \file mln/value/essential.hh
+///
+/// File that includes essential "value types"-related materials.
# include <mln/value/concept/essential.hh>
# include <mln/value/builtin/essential.hh>
@@ -50,6 +49,9 @@
# include <mln/value/int_u16.hh>
# include <mln/value/int_u32.hh>
+# include <mln/value/label_8.hh>
+# include <mln/value/label_16.hh>
+
# include <mln/value/rgb8.hh>
# include <mln/value/rgb16.hh>
diff --git a/milena/mln/value/label.hh b/milena/mln/value/label.hh
index 02eec94..8421133 100644
--- a/milena/mln/value/label.hh
+++ b/milena/mln/value/label.hh
@@ -129,12 +129,6 @@ namespace mln
/// Return the next value.
label<n> next() const;
- /// Conversion to unsigned.
- const enc& to_enc() const;
-
- protected:
-
- enc v_;
};
@@ -165,21 +159,21 @@ namespace mln
inline
label<n>::label(unsigned i)
{
- v_ = enc(i);
+ this->v_ = enc(i);
}
template <unsigned n>
inline
label<n>::label(const literal::zero_t&)
{
- v_ = 0;
+ this->v_ = 0;
}
template <unsigned n>
inline
label<n>::operator unsigned() const
{
- return to_enc();
+ return this->to_enc();
}
template <unsigned n>
@@ -188,7 +182,7 @@ namespace mln
label<n>::operator=(unsigned i)
{
mln_precondition(i <= mln_max(enc));
- v_ = enc(i);
+ this->v_ = enc(i);
return *this;
}
@@ -197,7 +191,7 @@ namespace mln
label<n>&
label<n>::operator=(const literal::zero_t&)
{
- v_ = 0;
+ this->v_ = 0;
return *this;
}
@@ -206,8 +200,8 @@ namespace mln
label<n>&
label<n>::operator++()
{
- mln_precondition(v_ < mln_max(enc));
- ++v_;
+ mln_precondition(this->v_ < mln_max(enc));
+ ++this->v_;
return *this;
}
@@ -216,8 +210,8 @@ namespace mln
label<n>&
label<n>::operator--()
{
- mln_precondition(v_ != 0);
- --v_;
+ mln_precondition(this->v_ != 0);
+ --this->v_;
return *this;
}
@@ -226,22 +220,14 @@ namespace mln
label<n>
label<n>::next() const
{
- return label<n>(v_ + 1);
- }
-
- template <unsigned n>
- inline
- const mln_enc(label<n>)&
- label<n>::to_enc() const
- {
- return v_;
+ return label<n>(this->v_ + 1);
}
template <unsigned n>
inline
std::ostream& operator<<(std::ostream& ostr, const label<n>&
i)
{
- return ostr << i.to_enc();
+ return ostr << debug::format(i.to_equiv());
}
# endif // ! MLN_INCLUDE_ONLY
--
1.5.6.5