https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Fix wrong include.
* mln/core/site_set/p_graph.hh,
* mln/core/image/graph_image.hh,
* mln/display/remove.hh,
* mln/display/save.hh,
* mln/display/show.hh,
* mln/util/greater_point.hh: Include image/image_if.hh instead
of image_if_value.hh.
core/image/graph_image.hh | 2 +-
core/site_set/p_graph.hh | 1 -
display/remove.hh | 2 +-
display/save.hh | 2 +-
display/show.hh | 2 +-
util/greater_point.hh | 2 +-
6 files changed, 5 insertions(+), 6 deletions(-)
Index: mln/core/site_set/p_graph.hh
--- mln/core/site_set/p_graph.hh (revision 2742)
+++ mln/core/site_set/p_graph.hh (working copy)
@@ -35,7 +35,6 @@
# include <mln/util/graph.hh>
# include <mln/util/tracked_ptr.hh>
-# include <mln/core/image/graph_psite.hh>
# include <mln/core/site_set/p_graph_piter.hh>
/* FIXME: This class shares a lot with p_line_graph. Factor as much
Index: mln/core/image/graph_image.hh
--- mln/core/image/graph_image.hh (revision 2742)
+++ mln/core/image/graph_image.hh (working copy)
@@ -38,7 +38,7 @@
# include <mln/core/internal/image_primary.hh>
# include <mln/algebra/vec.hh>
# include <mln/core/site_set/p_graph.hh>
-# include <mln/core/image/graph_psite.hh>
+# include <mln/core/image/bgraph_psite.hh>
# include <mln/value/set.hh>
/* FIXME: This class shares a lot with line_graph_image. Factor as
Index: mln/display/remove.hh
--- mln/display/remove.hh (revision 2742)
+++ mln/display/remove.hh (working copy)
@@ -35,7 +35,7 @@
*/
# include <mln/trait/image_from_grid.hh>
-# include <mln/core/image_if_value.hh>
+# include <mln/core/image/image_if.hh>
# include <mln/core/image/image2d.hh>
# include <mln/display/save.hh>
Index: mln/display/save.hh
--- mln/display/save.hh (revision 2742)
+++ mln/display/save.hh (working copy)
@@ -35,7 +35,7 @@
*/
# include <mln/trait/image_from_grid.hh>
-# include <mln/core/image_if_value.hh>
+# include <mln/core/image/image_if.hh>
# include <mln/core/image/image2d.hh>
# include <mln/value/rgb8.hh>
# include <mln/level/fill.hh>
Index: mln/display/show.hh
--- mln/display/show.hh (revision 2742)
+++ mln/display/show.hh (working copy)
@@ -35,7 +35,7 @@
*/
# include <mln/trait/image_from_grid.hh>
-# include <mln/core/image_if_value.hh>
+# include <mln/core/image/image_if.hh>
# include <mln/core/image/image2d.hh>
# include <mln/display/save.hh>
Index: mln/util/greater_point.hh
--- mln/util/greater_point.hh (revision 2742)
+++ mln/util/greater_point.hh (working copy)
@@ -1,4 +1,4 @@
-:/ Copyright (C) 2005, 2008 EPITA Research and Development Laboratory
(LRDE)
+// Copyright (C) 2005, 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
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Fix wrong include.
* mln/core/site_set/p_graph.hh,
* mln/core/image/graph_image.hh,
* mln/display/remove.hh,
* mln/display/save.hh,
* mln/display/show.hh,
* mln/util/greater_point.hh: Include image/image_if.hh instead
of image_if_value.hh.
core/image/graph_image.hh | 2 +-
core/site_set/p_graph.hh | 1 -
display/remove.hh | 2 +-
display/save.hh | 2 +-
display/show.hh | 2 +-
util/greater_point.hh | 2 +-
6 files changed, 5 insertions(+), 6 deletions(-)
Index: mln/core/site_set/p_graph.hh
--- mln/core/site_set/p_graph.hh (revision 2742)
+++ mln/core/site_set/p_graph.hh (working copy)
@@ -35,7 +35,6 @@
# include <mln/util/graph.hh>
# include <mln/util/tracked_ptr.hh>
-# include <mln/core/image/graph_psite.hh>
# include <mln/core/site_set/p_graph_piter.hh>
/* FIXME: This class shares a lot with p_line_graph. Factor as much
Index: mln/core/image/graph_image.hh
--- mln/core/image/graph_image.hh (revision 2742)
+++ mln/core/image/graph_image.hh (working copy)
@@ -38,7 +38,7 @@
# include <mln/core/internal/image_primary.hh>
# include <mln/algebra/vec.hh>
# include <mln/core/site_set/p_graph.hh>
-# include <mln/core/image/graph_psite.hh>
+# include <mln/core/image/bgraph_psite.hh>
# include <mln/value/set.hh>
/* FIXME: This class shares a lot with line_graph_image. Factor as
Index: mln/display/remove.hh
--- mln/display/remove.hh (revision 2742)
+++ mln/display/remove.hh (working copy)
@@ -35,7 +35,7 @@
*/
# include <mln/trait/image_from_grid.hh>
-# include <mln/core/image_if_value.hh>
+# include <mln/core/image/image_if.hh>
# include <mln/core/image/image2d.hh>
# include <mln/display/save.hh>
Index: mln/display/save.hh
--- mln/display/save.hh (revision 2742)
+++ mln/display/save.hh (working copy)
@@ -35,7 +35,7 @@
*/
# include <mln/trait/image_from_grid.hh>
-# include <mln/core/image_if_value.hh>
+# include <mln/core/image/image_if.hh>
# include <mln/core/image/image2d.hh>
# include <mln/value/rgb8.hh>
# include <mln/level/fill.hh>
Index: mln/display/show.hh
--- mln/display/show.hh (revision 2742)
+++ mln/display/show.hh (working copy)
@@ -35,7 +35,7 @@
*/
# include <mln/trait/image_from_grid.hh>
-# include <mln/core/image_if_value.hh>
+# include <mln/core/image/image_if.hh>
# include <mln/core/image/image2d.hh>
# include <mln/display/save.hh>
Index: mln/util/greater_point.hh
--- mln/util/greater_point.hh (revision 2742)
+++ mln/util/greater_point.hh (working copy)
@@ -1,4 +1,4 @@
-:/ Copyright (C) 2005, 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2005, 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
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena/sandbox
Index: ChangeLog
from Alexandre Abraham <abraham(a)lrde.epita.fr>
Add co-occurence matrix computing.
* nature/co_occurence.hh: New
(mln::co_occurence) : compute co-occurence matrix.
* nature/mco.cc: New
Dummy test.
co_occurence.hh | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mco.cc | 45 +++++++++++++++++++++++++++++++++
2 files changed, 120 insertions(+)
Index: nature/co_occurence.hh
--- nature/co_occurence.hh (revision 0)
+++ nature/co_occurence.hh (revision 0)
@@ -0,0 +1,75 @@
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+//
+// 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_CO_OCCURENCE_HH
+# define MLN_CO_OCCURENCE_HH
+
+/*! \file ??
+ *
+ * \brief FIXME
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/dpoint.hh>
+# include <mln/core/image/image2d.hh>
+# include <mln/level/fill.hh>
+
+
+namespace mln
+{
+
+
+ template <typename I, typename D>
+ // image2d<unsigned> co_occurence (const Image<I>&, const Dpoint<D>&);
+ image2d<unsigned> co_occurence (const Image<I>&, const Gdpoint<D>&);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename D>
+ image2d<unsigned> co_occurence (const Image<I> &ima_, const Gdpoint<D> &dp_)
+ {
+ mln::metal::equal<mln_psite(I), mln_psite(D)>::check();
+
+ const I &ima = exact(ima_);
+ const D &dp = exact(dp_);
+ image2d<unsigned> mco(mln_card(mln_value(I)), mln_card(mln_value(I)), 0);
+ level::fill(mco, 0);
+
+
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ if (ima.domain().has(p + dp))
+ mco(point2d(ima(p), ima(p + dp)))++;
+
+ return mco;
+ }
+
+#endif // MLN_INCLUDE_ONLY
+
+}
+
+#endif // MLN_CO_OCCURENCE_HH
Index: nature/mco.cc
--- nature/mco.cc (revision 0)
+++ nature/mco.cc (revision 0)
@@ -0,0 +1,45 @@
+#include <iostream>
+
+#include <mln/value/int_u.hh>
+#include <mln/core/image/image2d.hh>
+#include "co_occurence.hh"
+#include <mln/core/alias/dpoint2d.hh>
+
+int main ()
+{
+ using namespace mln;
+ using namespace value;
+
+ typedef image2d< int_u<3> > I;
+
+ int_u<3> vs[6][5] = {
+
+ { 3, 3, 4, 4, 4 },
+ { 2, 1, 1, 1, 1 },
+ { 1, 4, 4, 4, 6 },
+ { 1, 4, 3, 4, 1 },
+ { 7, 4, 5, 3, 1 },
+ { 7, 7, 1, 1, 0 }
+
+ };
+
+ I ima(make::image2d(vs));
+
+ dpoint2d d(0, 1);
+
+ // std::cout << co_occurence(ima, d) << std::endl;
+
+ image2d<unsigned> co(co_occurence(ima, d));
+
+ unsigned cpt = 0;
+
+ mln_piter_(image2d<unsigned>) p(co.domain());
+ for_all(p)
+ {
+ std::cout << p << " = " << co(p) << std::endl;
+ cpt += co(p);
+ }
+
+ std::cout << cpt << std::endl;
+
+}