* mln/core/alias/point3df.hh (mln::point3df): Move typedef...
* mln/core/alias/point3d.hh: ...here.
* mln/core/alias/point3df.hh: Remove file.
* mln/core/alias/all.hh: Remove inclusion of
mln/core/alias/point3df.hh.
* mln/core/alias/complex_geometry.hh: Adjust.
---
milena/ChangeLog | 11 ++
milena/mln/core/alias/all.hh | 1 -
milena/mln/core/alias/complex_geometry.hh | 4 +-
milena/mln/core/alias/point3d.hh | 7 +-
milena/mln/core/alias/point3df.hh | 216 -----------------------------
5 files changed, 19 insertions(+), 220 deletions(-)
delete mode 100644 milena/mln/core/alias/point3df.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7172cfb..0d2e7ed 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,14 @@
+2009-02-11 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Fix and factor mln::point3df and mln::point3d.
+
+ * mln/core/alias/point3df.hh (mln::point3df): Move typedef...
+ * mln/core/alias/point3d.hh: ...here.
+ * mln/core/alias/point3df.hh: Remove file.
+ * mln/core/alias/all.hh: Remove inclusion of
+ mln/core/alias/point3df.hh.
+ * mln/core/alias/complex_geometry.hh: Adjust.
+
2009-02-11 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Minor fixes.
diff --git a/milena/mln/core/alias/all.hh b/milena/mln/core/alias/all.hh
index a7dde7f..e79a358 100644
--- a/milena/mln/core/alias/all.hh
+++ b/milena/mln/core/alias/all.hh
@@ -51,7 +51,6 @@
#include <mln/core/alias/point2d.hh>
#include <mln/core/alias/point2d_h.hh>
#include <mln/core/alias/point3d.hh>
-#include <mln/core/alias/point3df.hh>
#include <mln/core/alias/vec3d.hh>
#include <mln/core/alias/w_window1d_float.hh>
#include <mln/core/alias/w_window1d_int.hh>
diff --git a/milena/mln/core/alias/complex_geometry.hh b/milena/mln/core/alias/complex_geometry.hh
index 2ba0362..e9ce8de 100644
--- a/milena/mln/core/alias/complex_geometry.hh
+++ b/milena/mln/core/alias/complex_geometry.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 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
@@ -34,7 +34,7 @@
# include <mln/geom/complex_geometry.hh>
# include <mln/core/alias/point2d.hh>
-# include <mln/core/alias/point3df.hh>
+# include <mln/core/alias/point3d.hh>
namespace mln
diff --git a/milena/mln/core/alias/point3d.hh b/milena/mln/core/alias/point3d.hh
index 7ffac8f..acbf721 100644
--- a/milena/mln/core/alias/point3d.hh
+++ b/milena/mln/core/alias/point3d.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of the Olena Library. This library is free
@@ -48,6 +48,11 @@ namespace mln
*/
typedef point<grid::cube, def::coord> point3d;
+ /*! \brief Type alias for a point defined on the 3D square grid with
+ * floating-point coordinates.
+ */
+ typedef point<grid::cube, def::coordf> point3df;
+
namespace internal
{
diff --git a/milena/mln/core/alias/point3df.hh b/milena/mln/core/alias/point3df.hh
deleted file mode 100644
index 4fed640..0000000
--- a/milena/mln/core/alias/point3df.hh
+++ /dev/null
@@ -1,216 +0,0 @@
-// 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
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef MLN_CORE_ALIAS_POINT3DF_HH
-# define MLN_CORE_ALIAS_POINT3DF_HH
-
-/*! \file mln/core/alias/point3df.hh
- *
- * \brief Definition of the mln::point3df alias and of its construction
- * routine.
- */
-
-/* FIXME: Factor with mln/core/alias/point3d.hh (these two files are
- almost identical). */
-
-# include <mln/core/point.hh>
-# include <mln/core/def/coordf.hh>
-// For site_const_impl and site_mutable_impl:
-# include <mln/core/concept/site_proxy.hh>
-# include <mln/core/internal/force_exact.hh>
-
-namespace mln
-{
-
- /*! \brief Type alias for a point defined on the 3D square grid with
- * floating-point coordinates.
- */
- typedef point<grid::cube, def::coordf> point3df;
-
- namespace internal
- {
-
- // Specialization.
-
- template <typename C, typename E>
- struct subject_impl< const point<grid::cube, C>, E >
- {
- typedef C coordf;
- enum { dim = 3 };
-
- typedef const C& row_t;
- const C& row() const;
-
- typedef const C& col_t;
- const C& col() const;
-
- typedef const C& sli_t;
- const C& sli() const;
-
- const C& operator[](unsigned i) const;
- const C& last_coord() const;
- private:
- const E& exact_() const;
- };
-
-
- // Specialization for point<M,C>.
-
- template <typename C, typename E>
- struct subject_impl< point<grid::cube, C>, E > :
- subject_impl< const point<grid::cube, C>, E >
- {
- private:
- typedef subject_impl< const point<grid::cube, C>, E > super_;
- E& exact_();
- public:
-
- using super_::row;
- C& row();
-
- using super_::col;
- C& col();
-
- using super_::sli;
- C& sli();
-
- using super_::operator[];
- C& operator[](unsigned i);
- };
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- // subject_impl
-
- template <typename C, typename E>
- inline
- const C&
- subject_impl< const point<grid::cube, C>, E >::row() const
- {
- return exact_().get_subject().row();
- }
-
- template <typename C, typename E>
- inline
- const C&
- subject_impl< const point<grid::cube, C>, E >::col() const
- {
- return exact_().get_subject().col();
- }
-
- template <typename C, typename E>
- inline
- const C&
- subject_impl< const point<grid::cube, C>, E >::sli() const
- {
- return exact_().get_subject().sli();
- }
-
- template <typename C, typename E>
- inline
- const C&
- subject_impl< const point<grid::cube, C>, E >::operator[](unsigned i) const
- {
- mln_precondition(i < 3);
- return exact_().get_subject()[i];
- }
-
- template <typename C, typename E>
- inline
- const C&
- subject_impl< const point<grid::cube, C>, E >::last_coord() const
- {
- return this->col();
- }
-
- template <typename C, typename E>
- inline
- const E&
- subject_impl< const point<grid::cube, C>, E >::exact_() const
- {
- return internal::force_exact<const E>(*this);
- }
-
- // subject_impl
-
- template <typename C, typename E>
- inline
- C&
- subject_impl< point<grid::cube, C>, E >::row()
- {
- return exact_().get_subject().row();
- }
-
- template <typename C, typename E>
- inline
- C&
- subject_impl< point<grid::cube, C>, E >::col()
- {
- return exact_().get_subject().col();
- }
-
- template <typename C, typename E>
- inline
- C&
- subject_impl< point<grid::cube, C>, E >::sli()
- {
- return exact_().get_subject().sli();
- }
-
- template <typename C, typename E>
- inline
- C&
- subject_impl< point<grid::cube, C>, E >::operator[](unsigned i)
- {
- mln_precondition(i < 3);
- return exact_().get_subject()[i];
- }
-
- template <typename C, typename E>
- inline
- E&
- subject_impl< point<grid::cube, C>, E >::exact_()
- {
- return internal::force_exact<E>(*this);
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::internal
-
-
-} // end of namespace mln
-
-// FIXME: File mln/core/alias/dpoint3df does not exist yet.
-# if 0
-# include <mln/core/alias/dpoint3df.hh>
-# endif
-
-#endif // ! MLN_CORE_ALIAS_POINT3DF_HH
--
1.6.1.2
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Minor fixes.
* mln/accu/mean.hh (to_result): Make it work even if it is
not valid. That is a safety when computing mean values of a
collection of labels.
* mln/value/label.hh: Fix missing forward declaration.
* mln/fun/i2v/array.hh: Upgrade file doc style.
accu/mean.hh | 2 ++
fun/i2v/array.hh | 3 +++
value/label.hh | 6 ++++--
3 files changed, 9 insertions(+), 2 deletions(-)
Index: mln/accu/mean.hh
--- mln/accu/mean.hh (revision 3350)
+++ mln/accu/mean.hh (working copy)
@@ -151,6 +151,8 @@
mean<T,S,M>::to_result() const
{
unsigned n = count_.to_result();
+ if (n == 0u)
+ return M(); // Safety.
return static_cast<M>(sum_.to_result() / n);
}
Index: mln/value/label.hh
--- mln/value/label.hh (revision 3350)
+++ mln/value/label.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 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
@@ -44,9 +45,10 @@
namespace mln
{
- // Forward declaration.
+ // Forward declarations.
namespace value {
template <unsigned n> struct label;
+ template <unsigned n> struct int_u;
}
namespace literal {
Index: mln/fun/i2v/array.hh
--- mln/fun/i2v/array.hh (revision 3350)
+++ mln/fun/i2v/array.hh (working copy)
@@ -34,6 +34,9 @@
///
/// \todo Change design so that there is no multiple inheritance:
/// array<T> : internal::array_base<T, E==array<T> > : Function_i2v<E>
+///
+/// \todo We should convert (with from_to) arrays that do not hold the
+/// same element type, e.g., int_u8 -> int or vec<3,f> -> rgb8.
# include <vector>
# include <algorithm>
* mln/labeling/mean_values.hh: New. Create an image with the component
mean values.
---
milena/ChangeLog | 7 ++
milena/mln/labeling/mean_values.hh | 190 ++++++++++++++++++++++++++++++++++++
2 files changed, 197 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/labeling/mean_values.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index fb64ae9..92e7c44 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2009-02-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add labeling::mean_values.
+
+ * mln/labeling/mean_values.hh: New. Create an image with the component
+ mean values.
+
+2009-02-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Various small fixes.
* mln/convert/from_to.hxx
diff --git a/milena/mln/labeling/mean_values.hh b/milena/mln/labeling/mean_values.hh
new file mode 100644
index 0000000..d7c131a
--- /dev/null
+++ b/milena/mln/labeling/mean_values.hh
@@ -0,0 +1,190 @@
+// Copyright (C) 2009 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
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_LABELING_MEAN_VALUES_HH
+# define MLN_LABELING_MEAN_VALUES_HH
+
+# include <mln/core/concept/image.hh>
+
+/// \file mln/labeling/mean_values.hh
+///
+/// Construct from a labeled image a new image, the labels values are
+/// replaced by the components mean values.
+
+
+namespace mln
+{
+
+ // Forward declaration
+ namespace value
+ {
+ template <unsigned n> struct rgb;
+ }
+
+
+ namespace labeling
+ {
+
+ template <typename I, typename L>
+ mln_concrete(I)
+ mean_colors(const Image<I>& input,
+ const Image<L>& lbl, mln_value(L) nlabels);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ template <typename I, typename L>
+ void
+ mean_values_tests(const Image<I>& input,
+ const Image<L>& lbl, mln_value(L) nlabels)
+ {
+ mln_precondition(exact(input).is_valid());
+ mln_precondition(exact(lbl).is_valid());
+ (void) input;
+ (void) lbl;
+ (void) nlabels;
+ }
+
+ } // end of namespace mln::labeling::internal
+
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+
+ template <typename I, typename L>
+ mln_concrete(I)
+ mean_values(const Image<I>& input,
+ const Image<L>& lbl, mln_value(L) nlabels)
+ {
+ internal::mean_values_tests(input, lbl, nlabels);
+
+ trace::warning("labeling::impl::generic::mean_values() is not \
+ implemented!");
+ //FIXME: to write!
+ abort();
+ }
+
+ }
+
+ template <typename I, typename L>
+ mln_concrete(I)
+ mean_values_rgb(const Image<I>& input_,
+ const Image<L>& lbl_, mln_value(L) nlabels)
+ {
+ trace::entering("mln::labeling::mean_values_rgb");
+
+ internal::mean_values_tests(input_, lbl_, nlabels);
+
+ const I& input = exact(input_);
+ const L& lbl = exact(lbl_);
+
+ util::array<vec3d_f> m_3f = labeling::compute(accu::mean<mln_value(I)>(),
+ input, // input color image
+ lbl, // watershed labeling
+ nlabels);
+ m_3f[0] = literal::zero;
+
+ util::array<mln_value(I)> m;
+ convert::from_to(m_3f, m);
+ m[0] = literal::white; //FIXME: handle label 0 correctly.
+
+ mln_concrete(I) output = level::transform(lbl,
+ convert::to< fun::i2v::array<mln_value(I)> >(m));
+
+
+ trace::exiting("mln::labeling::mean_values_rgb");
+ return output;
+ }
+
+ } // end of namespace mln::morpho::impl
+
+
+ namespace internal
+ {
+
+ template <unsigned n, typename I, typename L>
+ mln_concrete(I)
+ mean_values_dispatch(const value::rgb<n>&,
+ const Image<I>& input,
+ const Image<L>& lbl, mln_value(L) nlabels)
+ {
+ return impl::mean_values_rgb(input, lbl, nlabels);
+ }
+
+ template <typename I, typename L>
+ mln_concrete(I)
+ mean_values_dispatch(const mln_value(I)&,
+ const Image<I>& input,
+ const Image<L>& lbl, mln_value(L) nlabels)
+ {
+ return impl::generic::mean_values(input, lbl, nlabels);
+ }
+
+ template <typename I, typename L>
+ mln_concrete(I)
+ mean_values_dispatch(const Image<I>& input,
+ const Image<L>& lbl, mln_value(L) nlabels)
+ {
+ return mean_values_dispatch(mln_value(I)(), input, lbl, nlabels);
+ }
+
+ } // end of namespace mln::morpho::internal
+
+
+
+ // Facade
+
+ template <typename I, typename L>
+ mln_concrete(I)
+ mean_values(const Image<I>& input,
+ const Image<L>& lbl, mln_value(L) nlabels)
+
+ {
+ trace::entering("mln::labeling::mean_values");
+
+ internal::mean_values_tests(input, lbl, nlabels);
+
+ mln_concrete(I) output = internal::mean_values_dispatch(input, lbl, nlabels);
+
+ trace::exiting("mln::labeling::mean_values");
+ return output;
+ }
+
+
+# endif // !MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::labeling
+
+} // end of namespace mln
+
+#endif // ! MLN_LABELING_MEAN_VALUES_HH
--
1.5.6.5