https://svn.lrde.epita.fr/svn/oln/trunk/swilena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Wrap mln::image2d<int_u8> as well as I/O routines.
* pgm.ixx, int_u8.i, image2d_int_u8.i: New.
* Makefile.am (EXTRA_DIST): Add pgm.ixx, image2d_int_u8.i and
int_u8.i.
* fill.ixx, println.ixx: Fix doxygen headers.
* image2d_int.i: Typo.
* python/lena.py: New test.
* python/Makefile.am: Handle modules int_u8 and image2d_int_u8.
(top_srcdir): Add top_srcdir and top_builddir into the
environment.
(TESTS): Add lena.py.
* python/swilena.py: Import image2d_int_u8.
Makefile.am | 6 +++--
fill.ixx | 2 -
image2d_int.i | 2 -
image2d_int_u8.i | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
int_u8.i | 38 ++++++++++++++++++++++++++++++++
pgm.ixx | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
println.ixx | 2 -
python/Makefile.am | 27 +++++++++++++++++++----
python/lena.py | 39 +++++++++++++++++++++++++++++++++
python/swilena.py | 1
10 files changed, 229 insertions(+), 9 deletions(-)
Index: python/lena.py
--- python/lena.py (revision 0)
+++ python/lena.py (revision 0)
@@ -0,0 +1,39 @@
+#! /usr/bin/env python
+
+# 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
+# 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.
+# reasons why the executable file might be covered by the GNU General
+# Public License.
+
+import os
+from swilena import *
+
+top_srcdir = os.environ["top_srcdir"]
+img_dir = os.path.join(top_srcdir, "milena", "img")
+lena = os.path.join (img_dir, "lena.pgm")
+
+ima = image2d_int_u8.load(lena)
+eroded = image2d_int_u8.erosion (ima, win_c4p())
+image2d_int_u8.save(eroded, "out.pgm")
Index: python/Makefile.am
--- python/Makefile.am (revision 2105)
+++ python/Makefile.am (working copy)
@@ -50,6 +50,16 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_point2d-wrap.Pcc@am__quote@
nodist_python_PYTHON += point2d.py
+## int_u8.
+pyexec_LTLIBRARIES += _int_u8.la
+nodist__int_u8_la_SOURCES = int_u8-wrap.cc
+_int_u8_la_LIBADD = $(AM_LIBADD)
+CLEANFILES += $(nodist__int_u8_la_SOURCES) int_u8.py int_u8.py[co]
+## Include the dependency files. Copied from Automake's generated
+## case for C++.
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_int_u8-wrap.Pcc@am__quote@
+nodist_python_PYTHON += int_u8.py
+
## dpoint2d.
pyexec_LTLIBRARIES += _dpoint2d.la
nodist__dpoint2d_la_SOURCES = dpoint2d-wrap.cc
@@ -80,6 +90,16 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_image2d_int-wrap.Pcc@am__quote@
nodist_python_PYTHON += image2d_int.py
+## image2d_int_u8.
+pyexec_LTLIBRARIES += _image2d_int_u8.la
+nodist__image2d_int_u8_la_SOURCES = image2d_int_u8-wrap.cc
+_image2d_int_u8_la_LIBADD = $(AM_LIBADD)
+CLEANFILES += $(nodist__image2d_int_u8_la_SOURCES) image2d_int_u8.py image2d_int_u8.py[co]
+## Include the dependency files. Copied from Automake's generated
+## case for C++.
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_image2d_int_u8-wrap.Pcc@am__quote@
+nodist_python_PYTHON += image2d_int_u8.py
+
## ---------------------------- ##
## Swilena Python Shell (sps). ##
@@ -103,9 +123,8 @@
include $(top_srcdir)/swilena/run.mk
## FIXME: Do we really need to pass top_srcdir and top_builddir to run?
-##TESTS_ENVIRONMENT = \
-## top_srcdir="$(top_srcdir)" top_builddir="$(top_builddir)" $(RUN)
-TESTS_ENVIRONMENT = $(RUN)
+TESTS_ENVIRONMENT = \
+ top_srcdir="$(top_srcdir)" top_builddir="$(top_builddir)" $(RUN)
# Ensure `run' is rebuilt before the tests are run.
$(TESTS): $(srcdir)/run.stamp
# The dependency is on `run.in' and not `run', since `run' is
@@ -119,5 +138,5 @@
$(MAKE) $(AM_MAKEFLAGS) $(RUN)
@mv -f $@.tmp $@
-TESTS = test.py
+TESTS = test.py lena.py
EXTRA_DIST += $(TESTS)
Index: python/swilena.py
--- python/swilena.py (revision 2105)
+++ python/swilena.py (working copy)
@@ -33,3 +33,4 @@
from dpoint2d import *
from window2d import *
import image2d_int
+import image2d_int_u8
Index: image2d_int_u8.i
--- image2d_int_u8.i (revision 0)
+++ image2d_int_u8.i (revision 0)
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+// 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
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file image2d.i
+/// \brief A simple wrapping of mln::image2d<mln::value::int_u8> along
+/// with some algorithms.
+
+%module image2d_int_u8
+
+%import "int_u8.i"
+// FIXME: The import directive does not include the `%{ ... %}' clauses.
+// %{
+// #include "mln/value/int_u8.hh"
+// %}
+//
+%include "image2d.ixx"
+%template(image2d_int_u8) mln::image2d< mln::value::int_u<8> >;
+
+%include "pgm.ixx"
+%template(load) mln::io::pgm::load< mln::value::int_u<8> >;
+%template(save) mln::io::pgm::save< mln::image2d< mln::value::int_u<8> > >;
+
+%include "fill.ixx"
+%template(fill) mln::level::fill< mln::image2d< mln::value::int_u<8> > >;
+
+%include "println.ixx"
+%template(println) mln::debug::println< mln::image2d< mln::value::int_u<8> > >;
+
+%import "window2d.i"
+// FIXME: The import directive does not include the `%{ ... %}' clauses.
+%{
+#include "mln/core/window2d.hh"
+%}
+
+%include "morpho.ixx"
+%template(erosion) mln::morpho::erosion< mln::image2d< mln::value::int_u<8> >,
+ mln::window2d >;
Index: pgm.ixx
--- pgm.ixx (revision 0)
+++ pgm.ixx (revision 0)
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+// 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
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file pgm.ixx
+/// \brief A wrapper of mln::io::pgm::load and mln::io::pgm::save
+
+%module pgm
+
+%include std_string.i
+
+%{
+#include "mln/io/pgm/load.hh"
+#include "mln/io/pgm/save.hh"
+%}
+
+// Wrap mln::io::pgm::load(const std::string&) by hand, to force swig
+// to choose this overloading.
+namespace mln
+{
+ namespace io
+ {
+ namespace pgm
+ {
+
+ template <typename V>
+ mln::image2d<V> load(const std::string& filename);
+
+ } // end of namespace mln::io::pgm
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+%include "mln/io/pgm/save.hh"
Index: int_u8.i
--- int_u8.i (revision 0)
+++ int_u8.i (revision 0)
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+// 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
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file int_u8.i
+/// \brief A wrapper of mln::value::int_u8.
+
+%module int_u8
+
+%{
+#include "mln/value/int_u8.hh"
+%}
+
+%include "mln/value/int_u8.hh"
Index: fill.ixx
--- fill.ixx (revision 2105)
+++ fill.ixx (working copy)
@@ -26,7 +26,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file fill.i
+/// \file fill.ixx
/// \brief A wrapper of mln::level::fill.
%module fill
Index: println.ixx
--- println.ixx (revision 2105)
+++ println.ixx (working copy)
@@ -26,7 +26,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file println.i
+/// \file println.ixx
/// \brief A wrapper of mln::debug::println.
%{
Index: Makefile.am
--- Makefile.am (revision 2105)
+++ Makefile.am (working copy)
@@ -3,8 +3,10 @@
SUBDIRS = python
# Meta-wrappers (templates).
-EXTRA_DIST = fill.ixx image2d.ixx intp.ixx morpho.ixx println.ixx
+EXTRA_DIST = fill.ixx image2d.ixx intp.ixx morpho.ixx pgm.ixx println.ixx
# Wrappers.
-EXTRA_DIST += dpoint2d.i image2d_int.i point2d.i window2d.i
+EXTRA_DIST += \
+ dpoint2d.i image2d_int.i image2d_int_u8.i int_u8.i \
+ point2d.i window2d.i
check_SCRIPTS = run
Index: image2d_int.i
--- image2d_int.i (revision 2105)
+++ image2d_int.i (working copy)
@@ -43,7 +43,7 @@
%template(println) mln::debug::println< mln::image2d<int> >;
%import "window2d.i"
-// FIXME: The import directive does not import the `%{ ... %}' clauses.
+// FIXME: The import directive does not include the `%{ ... %}' clauses.
%{
#include "mln/core/window2d.hh"
%}
https://svn.lrde.epita.fr/svn/oln/trunk/swilena
Getting this work was not easy. I had to figure out that dpoint2d had to
be wrapped for window2d to work, but error messages gave no hint about
this. :(
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add preliminary support for windows and morpho in Swilena.
* dpoint2d.i, window2d.i, morpho.ixx: New wrappers.
* image2d.ixx, point2d.i, fill.ixx: Aesthetic changes.
* image2d_int.i: Likewise.
Use window2d and morpho::erosion.
* python/swilena.py: Inject the contents of modules dpoint2d and
window2d.
* python/test.py: Exercise window2d and morpho::erosion.
* python/Makefile.am: Handle modules dpoint2d and window2d.
* Makefile.am (EXTRA_DIST): Remove image2d.i
Add fill.ixx, image2d.ixx, intp.ixx, morpho.ixx, println.ixx,
dpoint2d.i, image2d_int.i, point2d.i and window2d.i.
Makefile.am | 5 +-
dpoint2d.i | 64 ++++++++++++++++++++++++++++++
fill.ixx | 2
image2d.ixx | 10 +---
image2d_int.i | 17 ++++++--
morpho.ixx | 54 ++++++++++++++++++++++++++
point2d.i | 2
python/Makefile.am | 20 +++++++++
python/swilena.py | 2
python/test.py | 22 ++++++++++
window2d.i | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
11 files changed, 296 insertions(+), 12 deletions(-)
Index: image2d.ixx
--- image2d.ixx (revision 2103)
+++ image2d.ixx (working copy)
@@ -37,10 +37,10 @@
#include "mln/core/image2d.hh"
%}
-%include "mln/core/box2d.hh";
-%include "mln/core/dpoint2d.hh";
+%include "mln/core/box2d.hh"
+%include "mln/core/dpoint2d.hh"
-%include "mln/core/concept/image.hh";
+%include "mln/core/concept/image.hh"
// FIXME: Wrap mln::image2d by hand, for Milena macros disturb swig.
// Annotate the original source code instead?
@@ -48,10 +48,8 @@
{
template <typename T>
struct image2d
- /* FIXME: This is a simple wrapping; ignore the base class (for the
- moment). */
- // : public internal::image_primary_< box2d, image2d<T> >
/* FIXME: Cheat, so that generic algorithms can use mln::image2d. */
+ // : public internal::image_primary_< box2d, image2d<T> >
: public Image< image2d<T> >
{
// Warning: just to make effective types appear in Doxygen:
Index: python/test.py
--- python/test.py (revision 2103)
+++ python/test.py (working copy)
@@ -53,5 +53,27 @@
v = image2d_int.intp_value(ima(p))
print "ima(" + str(i) + ", " + str(j) + ") = " + str(v)
+# FIXME: This is too complicated. We should be able to write
+#
+# ima(1,1) = 51
+#
+# or at least
+#
+# ima.set(1, 1, 51)
+#
+image2d_int.intp_assign(ima(point2d(1,1)), 10)
+
print
image2d_int.println(ima)
+
+# Elementary erosion in 4-connectivity using win_c4p.
+eroded = image2d_int.erosion (ima, win_c4p())
+image2d_int.println(eroded)
+
+# Erosion using a custom window.
+w = window2d()
+w.insert(-1, 0)
+w.insert( 0, 0)
+w.insert(+1, 0)
+eroded = image2d_int.erosion (ima, w)
+image2d_int.println(eroded)
Index: python/Makefile.am
--- python/Makefile.am (revision 2103)
+++ python/Makefile.am (working copy)
@@ -50,6 +50,26 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_point2d-wrap.Pcc@am__quote@
nodist_python_PYTHON += point2d.py
+## dpoint2d.
+pyexec_LTLIBRARIES += _dpoint2d.la
+nodist__dpoint2d_la_SOURCES = dpoint2d-wrap.cc
+_dpoint2d_la_LIBADD = $(AM_LIBADD)
+CLEANFILES += $(nodist__dpoint2d_la_SOURCES) dpoint2d.py dpoint2d.py[co]
+## Include the dependency files. Copied from Automake's generated
+## case for C++.
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_dpoint2d-wrap.Pcc@am__quote@
+nodist_python_PYTHON += dpoint2d.py
+
+## window2d.
+pyexec_LTLIBRARIES += _window2d.la
+nodist__window2d_la_SOURCES = window2d-wrap.cc
+_window2d_la_LIBADD = $(AM_LIBADD)
+CLEANFILES += $(nodist__window2d_la_SOURCES) window2d.py window2d.py[co]
+## Include the dependency files. Copied from Automake's generated
+## case for C++.
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_window2d-wrap.Pcc@am__quote@
+nodist_python_PYTHON += window2d.py
+
## image2d_int.
pyexec_LTLIBRARIES += _image2d_int.la
nodist__image2d_int_la_SOURCES = image2d_int-wrap.cc
Index: python/swilena.py
--- python/swilena.py (revision 2103)
+++ python/swilena.py (working copy)
@@ -30,4 +30,6 @@
import ltihooks
from point2d import *
+from dpoint2d import *
+from window2d import *
import image2d_int
Index: window2d.i
--- window2d.i (revision 0)
+++ window2d.i (revision 0)
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+// 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
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file window2d.i
+/// \brief A wrapper of mln::window2d.
+
+%module window2d
+
+%import "dpoint2d.i"
+
+%{
+#include "mln/core/window2d.hh"
+%}
+
+%include "mln/core/concept/window.hh"
+
+// FIXME: Wrap mln::image2d by hand, for Milena macros disturb swig.
+// Annotate the original source code instead?
+namespace mln
+{
+ template <typename D>
+ class window
+ /* FIXME: Simplify, so as to minimize the work. */
+ : public Window< window<D> >
+ , public internal::dpoints_base_<D, window<D> >
+ {
+ typedef internal::dpoints_base_<D, window<D> > super_;
+ public:
+
+ /*! \brief Point_Iterator type to browse the points of a generic window
+ * w.r.t. the ordering of delta-points.
+ */
+ typedef dpoints_fwd_piter<D> fwd_qiter;
+
+ /*! \brief Point_Iterator type to browse the points of a generic window
+ * w.r.t. the reverse ordering of delta-points.
+ */
+ typedef dpoints_bkd_piter<D> bkd_qiter;
+
+
+ /*! \brief Constructor without argument.
+ *
+ * The constructed window is empty.
+ */
+ window();
+
+
+ /*! \brief Test if the window is symmetric.
+ */
+ bool is_symmetric() const;
+
+ /// Insert a delta-point \p dp.
+ window<D>& insert(const D& dp);
+
+// FIXME: Swig tries to wrap everything by default; prevent it from wrapping
+// invalid methods (1D and 3D ctors for a point2d).
+ /// \{ Insertion of a delta-point with different numbers of
+ /// arguments (coordinates) w.r.t. the dimension.
+// window<D>& insert(const mln_coord(D)& dind); // For 1D.
+
+// FIXME: The macro mln_coord disturbs swig.
+// window<D>& insert(const mln_coord(D)& drow,
+// const mln_coord(D)& dcol); // For 2D.
+ window<D>& insert(const typename D::coord& drow,
+ const typename D::coord& dcol); // For 2D.
+
+// window<D>& insert(const mln_coord(D)& dsli,
+// const mln_coord(D)& drow,
+// const mln_coord(D)& dcol); // For 3D.
+// /// \}
+
+ /// Apply a central symmetry to the target window.
+ window<D>& sym();
+
+ protected:
+
+// FIXME: The macro used here disturbs swig.
+// box_<mln_point(D)> b_;
+ box_<typename D::point> b_;
+ };
+} // end of namespace mln
+
+%include "mln/core/window2d.hh"
+
+%template(window2d) mln::window< mln::dpoint_<mln::grid::square, int > >;
Index: point2d.i
--- point2d.i (revision 2103)
+++ point2d.i (working copy)
@@ -51,7 +51,7 @@
Check whether this bug has been fixed in a recent release of SWIG
or if it has been reported. */
%ignore mln::point_<mln::grid::square,int>::origin;
-// Ignoring to_h_vec saves us the wrapping of
+// Ignoring to_h_vec saves us the wrapping of h_vec.
%ignore mln::point_<mln::grid::square,int>::to_h_vec;
// Swig tries to wrap everything by default; prevent it from wrapping
// invalid methods (1D and 3D ctors for a point2d).
Index: Makefile.am
--- Makefile.am (revision 2103)
+++ Makefile.am (working copy)
@@ -2,6 +2,9 @@
SUBDIRS = python
-EXTRA_DIST = image2d.i
+# Meta-wrappers (templates).
+EXTRA_DIST = fill.ixx image2d.ixx intp.ixx morpho.ixx println.ixx
+# Wrappers.
+EXTRA_DIST += dpoint2d.i image2d_int.i point2d.i window2d.i
check_SCRIPTS = run
Index: image2d_int.i
--- image2d_int.i (revision 2103)
+++ image2d_int.i (working copy)
@@ -32,12 +32,21 @@
%module image2d_int
-%include intp.ixx
-%include image2d.ixx
+%include "intp.ixx"
+%include "image2d.ixx"
%template(image2d_int) mln::image2d<int>;
-%include fill.ixx
+%include "fill.ixx"
%template(fill) mln::level::fill< mln::image2d<int> >;
-%include println.ixx
+%include "println.ixx"
%template(println) mln::debug::println< mln::image2d<int> >;
+
+%import "window2d.i"
+// FIXME: The import directive does not import the `%{ ... %}' clauses.
+%{
+#include "mln/core/window2d.hh"
+%}
+
+%include "morpho.ixx"
+%template(erosion) mln::morpho::erosion< mln::image2d<int>, mln::window2d >;
Index: dpoint2d.i
--- dpoint2d.i (revision 0)
+++ dpoint2d.i (revision 0)
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+// 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
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file dpoint2d.i
+/// \brief A wrapper of mln::dpoint2d.
+
+%module dpoint2d
+
+%{
+#include "mln/core/dpoint.hh"
+#include "mln/core/dpoint2d.hh"
+%}
+
+%include "mln/core/dpoint.hh";
+%include "mln/core/dpoint2d.hh";
+/* FIXME: Ignore `mln::dpoint_<M,C>::origin' to circumvent a swig bug.
+ Without this ignore clause, the generated code would trigger this
+ error :
+
+ image2d-wrap.cc:3115:144: error: macro "SWIG_as_voidptr" passed 2
+ arguments, but takes just 1
+ image2d-wrap.cc: In function 'PyObject* dpoint2d_origin_get()':
+ image2d-wrap.cc:3115: error: 'SWIG_as_voidptr' was not declared in this
+ scope
+
+ Check whether this bug has been fixed in a recent release of SWIG
+ or if it has been reported. */
+// %ignore mln::dpoint_<mln::grid::square,int>::origin;
+// Ignoring to_h_vec saves us the wrapping of h_vec.
+// %ignore mln::dpoint_<mln::grid::square,int>::to_h_vec;
+// Swig tries to wrap everything by default; prevent it from wrapping
+// invalid methods (1D and 3D ctors for a dpoint2d).
+// %ignore mln::dpoint_<mln::grid::square,int>::dpoint_(const literal::zero_t&);
+%ignore mln::dpoint_<mln::grid::square,int>::dpoint_(const literal::one_t&);
+%ignore mln::dpoint_<mln::grid::square,int>::operator=(const literal::one_t&);
+%ignore mln::dpoint_<mln::grid::square,int>::dpoint_(int);
+%ignore mln::dpoint_<mln::grid::square,int>::dpoint_(int, int, int);
+
+%template(dpoint2d) mln::dpoint_<mln::grid::square, int>;
Index: morpho.ixx
--- morpho.ixx (revision 0)
+++ morpho.ixx (revision 0)
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+// 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
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file fill.i
+/// \brief Wrappers of morphological algorithms from mln::morpho.
+
+%module morpho
+
+%{
+#include "mln/morpho/erosion.hh"
+%}
+
+// FIXME: Wrap mln::morpho::erosion by hand, for mln_concrete(I)
+// disturbs swig. Annotate the original source code instead?
+namespace mln
+{
+ namespace morpho
+ {
+
+ template <typename I, typename W>
+ /* FIXME: How can we handle concrete in Swilena? Simplify this
+ for the moment, and use I directly. */
+// typename mln::trait::concrete< I >::ret
+ I
+ erosion(const Image<I>& input, const Window<W>& win);
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
Index: fill.ixx
--- fill.ixx (revision 2103)
+++ fill.ixx (working copy)
@@ -41,8 +41,10 @@
{
namespace level
{
+
template <typename I>
void fill(mln::Image<I>& ima, const typename I::value& v);
+
} // end of namespace mln::level
} // end of namespace mln
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* mln/core/dpoint.hh,
* mln/core/dpoint1d.hh,
* mln/core/dpoint2d.hh,
* mln/core/dpoint2d_h.hh,
* mln/core/dpoint3d.hh,
* mln/core/window1d.hh,
* mln/core/window3d.hh:
Update copyright headers.
dpoint.hh | 2 +-
dpoint1d.hh | 2 +-
dpoint2d.hh | 2 +-
dpoint2d_h.hh | 2 +-
dpoint3d.hh | 2 +-
window1d.hh | 2 +-
window3d.hh | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
Index: mln/core/dpoint2d.hh
--- mln/core/dpoint2d.hh (revision 2102)
+++ mln/core/dpoint2d.hh (working copy)
@@ -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
Index: mln/core/dpoint2d_h.hh
--- mln/core/dpoint2d_h.hh (revision 2102)
+++ mln/core/dpoint2d_h.hh (working copy)
@@ -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
Index: mln/core/dpoint.hh
--- mln/core/dpoint.hh (revision 2102)
+++ mln/core/dpoint.hh (working copy)
@@ -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
Index: mln/core/dpoint1d.hh
--- mln/core/dpoint1d.hh (revision 2102)
+++ mln/core/dpoint1d.hh (working copy)
@@ -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
Index: mln/core/dpoint3d.hh
--- mln/core/dpoint3d.hh (revision 2102)
+++ mln/core/dpoint3d.hh (working copy)
@@ -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
Index: mln/core/window1d.hh
--- mln/core/window1d.hh (revision 2102)
+++ mln/core/window1d.hh (working copy)
@@ -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
Index: mln/core/window3d.hh
--- mln/core/window3d.hh (revision 2102)
+++ mln/core/window3d.hh (working copy)
@@ -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