* headers.mk: add new headers to distribution.
* mln/io/raw/all.hh: include new headers.
* mln/io/raw/load.hh,
* mln/io/raw/save.hh: new io routines. Dump/load Olena images into a
file.
* tests/io/Makefile.am,
* tests/io/raw/Makefile.am,
* tests/io/raw/pbm.cc,
* tests/io/raw/raw.cc: add new tests.
* tests/unit_test/Makefile.am,
* tests/unit_test/mln_io_raw_all.cc,
* tests/unit_test/mln_io_raw_load.cc,
* tests/unit_test/mln_io_raw_save.cc: add new unit tests.
---
milena/ChangeLog | 22 +++++
milena/headers.mk | 3 +
milena/mln/io/raw/all.hh | 51 ++++++++++
milena/mln/io/raw/load.hh | 143 +++++++++++++++++++++++++++++
milena/mln/io/raw/save.hh | 127 +++++++++++++++++++++++++
milena/tests/io/Makefile.am | 3 +-
milena/tests/io/{ => raw}/Makefile.am | 14 +--
milena/tests/io/raw/pbm.cc | 62 +++++++++++++
milena/tests/io/raw/raw.cc | 94 +++++++++++++++++++
milena/tests/unit_test/Makefile.am | 6 +
milena/tests/unit_test/mln_io_raw_all.cc | 11 ++
milena/tests/unit_test/mln_io_raw_load.cc | 11 ++
milena/tests/unit_test/mln_io_raw_save.cc | 11 ++
13 files changed, 549 insertions(+), 9 deletions(-)
create mode 100644 milena/mln/io/raw/all.hh
create mode 100644 milena/mln/io/raw/load.hh
create mode 100644 milena/mln/io/raw/save.hh
copy milena/tests/io/{ => raw}/Makefile.am (54%)
create mode 100644 milena/tests/io/raw/pbm.cc
create mode 100644 milena/tests/io/raw/raw.cc
create mode 100644 milena/tests/unit_test/mln_io_raw_all.cc
create mode 100644 milena/tests/unit_test/mln_io_raw_load.cc
create mode 100644 milena/tests/unit_test/mln_io_raw_save.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index baa1882..41dcd8d 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,27 @@
2009-01-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add io::raw::save and io::raw::load routines.
+
+ * headers.mk: add new headers to distribution.
+
+ * mln/io/raw/all.hh: include new headers.
+
+ * mln/io/raw/load.hh,
+ * mln/io/raw/save.hh: new io routines. Dump/load Olena images into a
+ file.
+
+ * tests/io/Makefile.am,
+ * tests/io/raw/Makefile.am,
+ * tests/io/raw/pbm.cc,
+ * tests/io/raw/raw.cc: add new tests.
+
+ * tests/unit_test/Makefile.am,
+ * tests/unit_test/mln_io_raw_all.cc,
+ * tests/unit_test/mln_io_raw_load.cc,
+ * tests/unit_test/mln_io_raw_save.cc: add new unit tests.
+
+2009-01-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Use extract::* routines in tutorial examples.
* milena/doc/tutorial/figures/tuto4_genericity_and_algorithms-10.ppm
diff --git a/milena/headers.mk b/milena/headers.mk
index 65d98e5..74a3002 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -985,6 +985,9 @@ mln/io/ppm/save.hh \
mln/io/pfm/load.hh \
mln/io/pfm/all.hh \
mln/io/pfm/save.hh \
+mln/io/raw/load.hh \
+mln/io/raw/all.hh \
+mln/io/raw/save.hh \
mln/io/all.hh \
mln/io/pbm/load.hh \
mln/io/pbm/all.hh \
diff --git a/milena/mln/io/raw/all.hh b/milena/mln/io/raw/all.hh
new file mode 100644
index 0000000..c10fa1a
--- /dev/null
+++ b/milena/mln/io/raw/all.hh
@@ -0,0 +1,51 @@
+// Copyright (C) 2007 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_IO_PGM_ALL_HH
+# define MLN_IO_PGM_ALL_HH
+
+/*! \file mln/io/pgm/all.hh
+ *
+ * \brief File that includes all pgm io materials.
+ */
+
+
+namespace mln
+{
+
+ namespace io
+ {
+ /// Namespace of pgm input/output handling.
+ namespace pgm {}
+ }
+
+}
+
+# include <mln/io/pgm/load.hh>
+# include <mln/io/pgm/save.hh>
+
+#endif // ! MLN_IO_PGM_ALL_HH
diff --git a/milena/mln/io/raw/load.hh b/milena/mln/io/raw/load.hh
new file mode 100644
index 0000000..d6e9077
--- /dev/null
+++ b/milena/mln/io/raw/load.hh
@@ -0,0 +1,143 @@
+// 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_IO_RAW_LOAD_HH
+# define MLN_IO_RAW_LOAD_HH
+
+/// \file mln/io/raw/load.hh
+///
+/// Load a Milena image dumped into a file.
+
+# include <iostream>
+# include <fstream>
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/routine/initialize.hh>
+# include <mln/core/box_runstart_piter.hh>
+# include <mln/core/pixel.hh>
+# include <mln/data/memcpy_.hh>
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace raw
+ {
+
+ /// Load a Milena image by dumped into a file.
+ ///
+ /// \param[in,out] ima_ The image to load.
+ /// \param[in] filename the destination.
+ template <typename I>
+ void load(Image<I>& ima_, const std::string& filename);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ template <typename P>
+ inline
+ void read_point(std::ifstream& file, P& p)
+ {
+ char tmp[sizeof (P)];
+ file.read(tmp, sizeof (P));
+ p = *(P*)(void*)(&tmp);
+ }
+
+
+ template <typename I>
+ inline
+ void load_header(Image<I>& ima, std::ifstream& file)
+ {
+ unsigned dim;
+ file >> dim;
+
+ typedef mln_site(I) P;
+ mln_assertion(P::dim == dim);
+
+ P pmin, pmax;
+ read_point<P>(file, pmin);
+ read_point<P>(file, pmax);
+
+ mln_concrete(I) result(box<P>(pmin, pmax));
+ initialize(ima, result);
+ }
+
+
+ template <typename I>
+ inline
+ void load_data(Image<I>& ima_, std::ifstream& file)
+ {
+ I& ima = exact(ima_);
+
+ unsigned data_size = sizeof (mln_value(I)) + sizeof (mln_value(I)) % 2;
+
+ mln_box_runstart_piter(I) p(ima.domain());
+ for_all(p)
+ {
+ pixel<I> src(ima, p);
+ file.read((char*) (&src.val()), p.run_length() * data_size);
+ }
+
+ }
+
+ } // end of namespace mln::io::raw::internal
+
+
+
+ template <typename I>
+ void load(Image<I>& ima, const std::string& filename)
+ {
+ trace::entering("mln::io::raw::load");
+
+ std::ifstream file(filename.c_str());
+ if (! file)
+ {
+ std::cerr << "error: cannot open file '" << filename << "'!";
+ abort();
+ }
+
+ internal::load_header(ima, file);
+ internal::load_data(ima, file);
+
+ trace::exiting("mln::io::raw::load");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::raw
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+#endif // ! MLN_IO_RAW_LOAD_HH
diff --git a/milena/mln/io/raw/save.hh b/milena/mln/io/raw/save.hh
new file mode 100644
index 0000000..83b8fab
--- /dev/null
+++ b/milena/mln/io/raw/save.hh
@@ -0,0 +1,127 @@
+// 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_IO_RAW_SAVE_HH
+# define MLN_IO_RAW_SAVE_HH
+
+/// \file mln/io/raw/save.hh
+///
+/// Save a Milena image by dumping its data to a file.
+
+# include <iostream>
+# include <fstream>
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/box_runstart_piter.hh>
+# include <mln/core/pixel.hh>
+# include <mln/data/memcpy_.hh>
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace raw
+ {
+
+ /// Save a Milena image by dumping its data to a file.
+ ///
+ /// \param[in] ima_ The image to save.
+ /// \param[in] filename the destination.
+ template <typename I>
+ void save(const Image<I>& ima_, const std::string& filename);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ template <typename I>
+ inline
+ void save_header(const I& ima,
+ std::ofstream& file)
+ {
+ typedef mln_site(I) P;
+ file << P::dim;
+
+ mln_site(I) p = ima.domain().pmin();
+ file.write((char*) (&p), sizeof (P));
+
+ p = ima.domain().pmax();
+ file.write((char*) (&p), sizeof (P));
+ }
+
+
+ template <typename I>
+ inline
+ void save_data(I& ima, std::ofstream& file)
+ {
+ unsigned data_size = sizeof (mln_value(I)) + sizeof (mln_value(I)) % 2;
+
+ mln_box_runstart_piter(I) p(ima.domain());
+ for_all(p)
+ {
+ pixel<I> src(ima, p);
+ file.write((char*) (&src.val()), p.run_length() * data_size);
+ }
+ }
+
+ } // end of namespace mln::io::raw::internal
+
+
+ template <typename I>
+ void save(const Image<I>& ima_, const std::string& filename)
+ {
+ trace::entering("mln::io::raw::save");
+
+ const I& ima = exact(ima_);
+
+ std::ofstream file(filename.c_str());
+ if (! file)
+ {
+ std::cerr << "error: cannot open file '" << filename << "'!";
+ abort();
+ }
+
+ internal::save_header(ima, file);
+ internal::save_data(ima, file);
+
+ trace::exiting("mln::io::raw::save");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::raw
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+#endif // ! MLN_IO_RAW_SAVE_HH
diff --git a/milena/tests/io/Makefile.am b/milena/tests/io/Makefile.am
index 36d7797..8895b09 100644
--- a/milena/tests/io/Makefile.am
+++ b/milena/tests/io/Makefile.am
@@ -9,4 +9,5 @@ SUBDIRS = \
pfm \
pgm \
pnm \
- ppm
+ ppm \
+ raw
diff --git a/milena/tests/io/Makefile.am b/milena/tests/io/raw/Makefile.am
similarity index 54%
copy from milena/tests/io/Makefile.am
copy to milena/tests/io/raw/Makefile.am
index 36d7797..2d3d1c0 100644
--- a/milena/tests/io/Makefile.am
+++ b/milena/tests/io/raw/Makefile.am
@@ -2,11 +2,9 @@
include $(top_srcdir)/milena/tests/tests.mk
-SUBDIRS = \
- fits \
- off \
- pbm \
- pfm \
- pgm \
- pnm \
- ppm
+check_PROGRAMS = \
+ raw
+
+raw_SOURCES = raw.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/io/raw/pbm.cc b/milena/tests/io/raw/pbm.cc
new file mode 100644
index 0000000..3ccc040
--- /dev/null
+++ b/milena/tests/io/raw/pbm.cc
@@ -0,0 +1,62 @@
+// 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.
+
+/// \file tests/io/raw/raw.cc
+///
+/// Test on mln::io::raw::.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/io/raw/load.hh>
+#include <mln/io/raw/save.hh>
+
+#include <mln/level/compare.hh>
+
+#include "tests/data.hh"
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<bool> pic = io::pbm::load(MLN_IMG_DIR "/picasso.pbm");
+ io::raw::save(pic, "pic.raw");
+// image2d<bool> pic2 = io::raw::load("pic.raw");
+
+// mln_assertion(pic == pic2);
+}
+
+
+// sample binary image to test with xv, imview, and display
+// to bring into the fore the binary image bug with raw raw.
+
+// | | | | -
+// | | - - -
+// | - - - -
+// - - - - -
+// - - - - -
+// - - - - -
diff --git a/milena/tests/io/raw/raw.cc b/milena/tests/io/raw/raw.cc
new file mode 100644
index 0000000..193b125
--- /dev/null
+++ b/milena/tests/io/raw/raw.cc
@@ -0,0 +1,94 @@
+// 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.
+
+/// \file tests/io/raw/raw.cc
+///
+/// Test on mln::io::raw::*.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/raw/load.hh>
+#include <mln/io/raw/save.hh>
+
+#include <mln/level/compare.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/rgb8.hh>
+
+#include "tests/data.hh"
+
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ /// Value: bool
+ {
+ bool data[4] = { 0, 1,
+ 1, 0 };
+ image2d<bool> pic = make::image2d(data);
+
+ io::raw::save(pic, "pic.raw");
+
+ image2d<bool> pic2;
+ io::raw::load(pic2, "pic.raw");
+
+ mln_assertion(pic.domain() == pic2.domain());
+ mln_assertion(pic == pic2);
+ }
+
+ /// Value: int_u8
+ {
+ value::int_u8 data[4] = { 5, 1,
+ 1, 9 };
+ image2d<value::int_u8> pic = make::image2d(data);
+ io::raw::save(pic, "pic.raw");
+
+ image2d<value::int_u8> pic2;
+ io::raw::load(pic2, "pic.raw");
+
+ mln_assertion(pic.domain() == pic2.domain());
+ mln_assertion(pic == pic2);
+ }
+
+ /// Value: rgb8
+ {
+ using value::rgb8;
+ value::rgb8 data[4] = { rgb8(2,4,5), rgb8(1,23,255),
+ rgb8(64,41,150), rgb8(23,53,49) };
+ image2d<value::rgb8> pic = make::image2d(data);
+ io::raw::save(pic, "pic.raw");
+
+ image2d<value::rgb8> pic2;
+ io::raw::load(pic2, "pic.raw");
+
+ mln_assertion(pic.domain() == pic2.domain());
+ mln_assertion(pic == pic2);
+ }
+
+}
+
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index 315f1b3..0475cc4 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -951,6 +951,9 @@ mln_io_ppm_save \
mln_io_pfm_load \
mln_io_pfm_all \
mln_io_pfm_save \
+mln_io_raw_load \
+mln_io_raw_all \
+mln_io_raw_save \
mln_io_all \
mln_io_pbm_load \
mln_io_pbm_all \
@@ -1974,6 +1977,9 @@ mln_io_ppm_save_SOURCES = mln_io_ppm_save.cc
mln_io_pfm_load_SOURCES = mln_io_pfm_load.cc
mln_io_pfm_all_SOURCES = mln_io_pfm_all.cc
mln_io_pfm_save_SOURCES = mln_io_pfm_save.cc
+mln_io_raw_load_SOURCES = mln_io_raw_load.cc
+mln_io_raw_all_SOURCES = mln_io_raw_all.cc
+mln_io_raw_save_SOURCES = mln_io_raw_save.cc
mln_io_all_SOURCES = mln_io_all.cc
mln_io_pbm_load_SOURCES = mln_io_pbm_load.cc
mln_io_pbm_all_SOURCES = mln_io_pbm_all.cc
diff --git a/milena/tests/unit_test/mln_io_raw_all.cc b/milena/tests/unit_test/mln_io_raw_all.cc
new file mode 100644
index 0000000..40875ba
--- /dev/null
+++ b/milena/tests/unit_test/mln_io_raw_all.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/io/raw/all.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/io/raw/all.hh>
+#include <mln/io/raw/all.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_io_raw_load.cc b/milena/tests/unit_test/mln_io_raw_load.cc
new file mode 100644
index 0000000..11f9ba6
--- /dev/null
+++ b/milena/tests/unit_test/mln_io_raw_load.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/io/raw/load.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/io/raw/load.hh>
+#include <mln/io/raw/load.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_io_raw_save.cc b/milena/tests/unit_test/mln_io_raw_save.cc
new file mode 100644
index 0000000..3ead995
--- /dev/null
+++ b/milena/tests/unit_test/mln_io_raw_save.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/io/raw/save.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/io/raw/save.hh>
+#include <mln/io/raw/save.hh>
+
+int main()
+{
+ // Nothing.
+}
--
1.5.6.5
* milena/headers.mk: add new headers to distribution.
* milena/mln/literal/all.hh: include new headers.
* milena/mln/literal/max.hh,
* milena/mln/literal/min.hh: New literals. They use mln_{max,min}
internaly.
* milena/tests/unit_test/Makefile.am,
* milena/tests/unit_test/mln_literal_max.cc,
* milena/tests/unit_test/mln_literal_min.cc: new unit tests.
---
milena/ChangeLog | 16 ++++++++
milena/headers.mk | 2 +
milena/mln/literal/all.hh | 7 ++-
milena/mln/literal/{all.hh => max.hh} | 61 ++++++++++++++++-------------
milena/mln/literal/{all.hh => min.hh} | 61 ++++++++++++++++-------------
milena/tests/unit_test/Makefile.am | 4 ++
milena/tests/unit_test/mln_literal_max.cc | 11 +++++
milena/tests/unit_test/mln_literal_min.cc | 11 +++++
8 files changed, 117 insertions(+), 56 deletions(-)
copy milena/mln/literal/{all.hh => max.hh} (56%)
copy milena/mln/literal/{all.hh => min.hh} (56%)
create mode 100644 milena/tests/unit_test/mln_literal_max.cc
create mode 100644 milena/tests/unit_test/mln_literal_min.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 85efec7..fdfc0ea 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,21 @@
2009-01-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Introduce literal::min and literal::max.
+
+ * milena/headers.mk: add new headers to distribution.
+
+ * milena/mln/literal/all.hh: include new headers.
+
+ * milena/mln/literal/max.hh,
+ * milena/mln/literal/min.hh: New literals. They use mln_{max,min}
+ internaly.
+
+ * milena/tests/unit_test/Makefile.am,
+ * milena/tests/unit_test/mln_literal_max.cc,
+ * milena/tests/unit_test/mln_literal_min.cc: new unit tests.
+
+2009-01-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Fix various operator issues with value::shell.
* mln/value/shell.hh: make it inherit from Proxy.
diff --git a/milena/headers.mk b/milena/headers.mk
index 7263811..65d98e5 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -44,6 +44,7 @@ mln/pw/cst.hh \
mln/pw/var.hh \
mln/pw/essential.hh \
mln/literal/zero.hh \
+mln/literal/max.hh \
mln/literal/ops.hh \
mln/literal/origin.hh \
mln/literal/grays.hh \
@@ -51,6 +52,7 @@ mln/literal/all.hh \
mln/literal/colors.hh \
mln/literal/black.hh \
mln/literal/one.hh \
+mln/literal/min.hh \
mln/literal/white.hh \
mln/literal/essential.hh \
mln/registration/get_rtransf.hh \
diff --git a/milena/mln/literal/all.hh b/milena/mln/literal/all.hh
index 781c507..22b6603 100644
--- a/milena/mln/literal/all.hh
+++ b/milena/mln/literal/all.hh
@@ -1,5 +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
@@ -64,6 +64,9 @@ namespace mln
# include <mln/literal/grays.hh>
# include <mln/literal/colors.hh>
+# include <mln/literal/max.hh>
+# include <mln/literal/min.hh>
+
# include <mln/literal/ops.hh>
diff --git a/milena/mln/literal/all.hh b/milena/mln/literal/max.hh
similarity index 56%
copy from milena/mln/literal/all.hh
copy to milena/mln/literal/max.hh
index 781c507..117cc66 100644
--- a/milena/mln/literal/all.hh
+++ b/milena/mln/literal/max.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
+// 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
@@ -26,45 +25,53 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LITERAL_ALL_HH
-# define MLN_LITERAL_ALL_HH
+#ifndef MLN_LITERAL_MAX_HH
+# define MLN_LITERAL_MAX_HH
-/// \file mln/literal/all.hh
+/// \file mln/literal/max.hh
///
-/// File that includes all literals.
+/// Definition of the literal of mln::max.
-// Technical note:
-//
-// With some recent g++ versions, we have a warning due to literal
-// conversions (namely: "type qualifiers ignored on function return
-// type"). This warning comes from the "operator T()" method
-// instantiated with T being a const type, for instance, when
-// literal::zero is given to a procedure expecting a "const int&"
-// object. This warning will be avoided in very recent versions
-// of C++ thanks to the new compiling option -Wignore_qualifiers.
+# include <mln/core/concept/literal.hh>
+# include <mln/trait/value_.hh>
namespace mln
{
- /// Namespace of literals.
- namespace literal {}
+ namespace literal
+ {
+
+ /// Type of literal max.
+ struct max_t : public Literal<max_t>
+ {
+
+ template <typename T>
+ operator T () const;
+ };
+
+
+ /// Literal max.
+ extern const max_t& max;
+
-}
+# ifndef MLN_INCLUDE_ONLY
+ template <typename T>
+ inline
+ max_t::operator T () const
+ {
+ return mln_max(T);
+ }
-# include <mln/literal/zero.hh>
-# include <mln/literal/one.hh>
-# include <mln/literal/origin.hh>
+ const max_t& max = max_t();
-# include <mln/literal/white.hh>
-# include <mln/literal/black.hh>
+# endif // ! MLN_INCLUDE_ONLY
-# include <mln/literal/grays.hh>
-# include <mln/literal/colors.hh>
+ } // end of namespace mln::literal
-# include <mln/literal/ops.hh>
+} // end of namespace mln
-#endif // ! MLN_LITERAL_ALL_HH
+#endif // ! MLN_LITERAL_MAX_HH
diff --git a/milena/mln/literal/all.hh b/milena/mln/literal/min.hh
similarity index 56%
copy from milena/mln/literal/all.hh
copy to milena/mln/literal/min.hh
index 781c507..74cfbd2 100644
--- a/milena/mln/literal/all.hh
+++ b/milena/mln/literal/min.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
+// 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
@@ -26,45 +25,53 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LITERAL_ALL_HH
-# define MLN_LITERAL_ALL_HH
+#ifndef MLN_LITERAL_MIN_HH
+# define MLN_LITERAL_MIN_HH
-/// \file mln/literal/all.hh
+/// \file mln/literal/min.hh
///
-/// File that includes all literals.
+/// Definition of the literal of mln::min.
-// Technical note:
-//
-// With some recent g++ versions, we have a warning due to literal
-// conversions (namely: "type qualifiers ignored on function return
-// type"). This warning comes from the "operator T()" method
-// instantiated with T being a const type, for instance, when
-// literal::zero is given to a procedure expecting a "const int&"
-// object. This warning will be avoided in very recent versions
-// of C++ thanks to the new compiling option -Wignore_qualifiers.
+# include <mln/core/concept/literal.hh>
+# include <mln/trait/value_.hh>
namespace mln
{
- /// Namespace of literals.
- namespace literal {}
+ namespace literal
+ {
+
+ /// Type of literal min.
+ struct min_t : public Literal<min_t>
+ {
+
+ template <typename T>
+ operator T () const;
+ };
+
+
+ /// Literal min.
+ extern const min_t& min;
+
-}
+# ifndef MLN_INCLUDE_ONLY
+ template <typename T>
+ inline
+ min_t::operator T () const
+ {
+ return mln_min(T);
+ }
-# include <mln/literal/zero.hh>
-# include <mln/literal/one.hh>
-# include <mln/literal/origin.hh>
+ const min_t& min = min_t();
-# include <mln/literal/white.hh>
-# include <mln/literal/black.hh>
+# endif // ! MLN_INCLUDE_ONLY
-# include <mln/literal/grays.hh>
-# include <mln/literal/colors.hh>
+ } // end of namespace mln::literal
-# include <mln/literal/ops.hh>
+} // end of namespace mln
-#endif // ! MLN_LITERAL_ALL_HH
+#endif // ! MLN_LITERAL_MIN_HH
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index 3b4444a..315f1b3 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -44,6 +44,7 @@ mln_pw_cst \
mln_pw_var \
mln_pw_essential \
mln_literal_zero \
+mln_literal_max \
mln_literal_ops \
mln_literal_origin \
mln_literal_grays \
@@ -51,6 +52,7 @@ mln_literal_all \
mln_literal_colors \
mln_literal_black \
mln_literal_one \
+mln_literal_min \
mln_literal_white \
mln_literal_essential \
mln_registration_get_rtransf \
@@ -1065,6 +1067,7 @@ mln_pw_cst_SOURCES = mln_pw_cst.cc
mln_pw_var_SOURCES = mln_pw_var.cc
mln_pw_essential_SOURCES = mln_pw_essential.cc
mln_literal_zero_SOURCES = mln_literal_zero.cc
+mln_literal_max_SOURCES = mln_literal_max.cc
mln_literal_ops_SOURCES = mln_literal_ops.cc
mln_literal_origin_SOURCES = mln_literal_origin.cc
mln_literal_grays_SOURCES = mln_literal_grays.cc
@@ -1072,6 +1075,7 @@ mln_literal_all_SOURCES = mln_literal_all.cc
mln_literal_colors_SOURCES = mln_literal_colors.cc
mln_literal_black_SOURCES = mln_literal_black.cc
mln_literal_one_SOURCES = mln_literal_one.cc
+mln_literal_min_SOURCES = mln_literal_min.cc
mln_literal_white_SOURCES = mln_literal_white.cc
mln_literal_essential_SOURCES = mln_literal_essential.cc
mln_registration_get_rtransf_SOURCES = mln_registration_get_rtransf.cc
diff --git a/milena/tests/unit_test/mln_literal_max.cc b/milena/tests/unit_test/mln_literal_max.cc
new file mode 100644
index 0000000..1bf00c4
--- /dev/null
+++ b/milena/tests/unit_test/mln_literal_max.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/literal/max.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/literal/max.hh>
+#include <mln/literal/max.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_literal_min.cc b/milena/tests/unit_test/mln_literal_min.cc
new file mode 100644
index 0000000..f29827c
--- /dev/null
+++ b/milena/tests/unit_test/mln_literal_min.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/literal/min.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/literal/min.hh>
+#include <mln/literal/min.hh>
+
+int main()
+{
+ // Nothing.
+}
--
1.5.6.5
* headers.mk: add new headers to distribution.
* mln/all.hh,
* mln/essential/routine.hh,
* mln/extract/all.hh,
* mln/extract/essential.hh: include the new headers.
* mln/extract/blue.hh,
* mln/extract/green.hh,
* mln/extract/red.hh: new routines. Create a fun_image to work on a
specific color component.
* tests/extract/Makefile.am,
* tests/extract/blue.cc,
* tests/extract/green.cc,
* tests/extract/red.cc: add new tests.
* tests/unit_test/Makefile.am,
* tests/unit_test/mln_extract_all.cc,
* tests/unit_test/mln_extract_blue.cc,
* tests/unit_test/mln_extract_essential.cc,
* tests/unit_test/mln_extract_green.cc,
* tests/unit_test/mln_extract_red.cc,
* tests/unit_test/mln_opt_element.cc: add unit tests.
---
milena/ChangeLog | 30 ++++++++
milena/headers.mk | 6 ++
milena/mln/all.hh | 83 ++++++++---------------
milena/mln/essential/routine.hh | 1 +
milena/mln/extract/all.hh | 50 ++++++++++++++
milena/mln/extract/blue.hh | 65 ++++++++++++++++++
milena/mln/extract/essential.hh | 38 ++++++++++
milena/mln/extract/green.hh | 65 ++++++++++++++++++
milena/mln/extract/red.hh | 65 ++++++++++++++++++
milena/tests/extract/Makefile.am | 14 ++++
milena/tests/extract/blue.cc | 45 ++++++++++++
milena/tests/extract/green.cc | 45 ++++++++++++
milena/tests/extract/red.cc | 45 ++++++++++++
milena/tests/unit_test/Makefile.am | 12 +++
milena/tests/unit_test/mln_extract_all.cc | 11 +++
milena/tests/unit_test/mln_extract_blue.cc | 11 +++
milena/tests/unit_test/mln_extract_essential.cc | 11 +++
milena/tests/unit_test/mln_extract_green.cc | 11 +++
milena/tests/unit_test/mln_extract_red.cc | 11 +++
milena/tests/unit_test/mln_opt_element.cc | 11 +++
20 files changed, 575 insertions(+), 55 deletions(-)
create mode 100644 milena/mln/extract/all.hh
create mode 100644 milena/mln/extract/blue.hh
create mode 100644 milena/mln/extract/essential.hh
create mode 100644 milena/mln/extract/green.hh
create mode 100644 milena/mln/extract/red.hh
create mode 100644 milena/tests/extract/Makefile.am
create mode 100644 milena/tests/extract/blue.cc
create mode 100644 milena/tests/extract/green.cc
create mode 100644 milena/tests/extract/red.cc
create mode 100644 milena/tests/unit_test/mln_extract_all.cc
create mode 100644 milena/tests/unit_test/mln_extract_blue.cc
create mode 100644 milena/tests/unit_test/mln_extract_essential.cc
create mode 100644 milena/tests/unit_test/mln_extract_green.cc
create mode 100644 milena/tests/unit_test/mln_extract_red.cc
create mode 100644 milena/tests/unit_test/mln_opt_element.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7584344..6350650 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,33 @@
+2009-01-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add routines to work on a specific color component.
+
+ * headers.mk: add new headers to distribution.
+
+ * mln/all.hh,
+ * mln/essential/routine.hh,
+ * mln/extract/all.hh,
+ * mln/extract/essential.hh: include the new headers.
+
+ * mln/extract/blue.hh,
+ * mln/extract/green.hh,
+ * mln/extract/red.hh: new routines. Create a fun_image to work on a
+ specific color component.
+
+
+ * tests/extract/Makefile.am,
+ * tests/extract/blue.cc,
+ * tests/extract/green.cc,
+ * tests/extract/red.cc: add new tests.
+
+ * tests/unit_test/Makefile.am,
+ * tests/unit_test/mln_extract_all.cc,
+ * tests/unit_test/mln_extract_blue.cc,
+ * tests/unit_test/mln_extract_essential.cc,
+ * tests/unit_test/mln_extract_green.cc,
+ * tests/unit_test/mln_extract_red.cc,
+ * tests/unit_test/mln_opt_element.cc: add unit tests.
+
2009-01-21 Thierry GERAUD <thierry.geraud(a)lrde.epita.fr>
Add some images.
diff --git a/milena/headers.mk b/milena/headers.mk
index 5babdd4..7263811 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -158,6 +158,11 @@ mln/make/w_window3d_int.hh \
mln/make/essential.hh \
mln/make/w_window1d_int.hh \
mln/make/point2d_h.hh \
+mln/extract/red.hh \
+mln/extract/all.hh \
+mln/extract/green.hh \
+mln/extract/blue.hh \
+mln/extract/essential.hh \
mln/display/all.hh \
mln/display/essential.hh \
mln/extension/adjust.hh \
@@ -427,6 +432,7 @@ mln/math/essential.hh \
mln/math/acos.hh \
mln/math/round_sat.hh \
mln/opt/at.hh \
+mln/opt/element.hh \
mln/opt/value.hh \
mln/binarization/includes.hh \
mln/binarization/all.hh \
diff --git a/milena/mln/all.hh b/milena/mln/all.hh
index 42d38a0..f9f16d0 100644
--- a/milena/mln/all.hh
+++ b/milena/mln/all.hh
@@ -32,70 +32,43 @@
///
/// File that includes all the headers.
+
+#include <mln/accu/all.hh>
+#include <mln/arith/all.hh>
+#include <mln/border/all.hh>
+#include <mln/canvas/all.hh>
+#include <mln/convert/all.hh>
+#include <mln/core/all.hh>
#include <mln/data/all.hh>
-#include <mln/util/all.hh>
-#include <mln/fun/p2v/all.hh>
-#include <mln/fun/x2x/all.hh>
-#include <mln/fun/v2v/all.hh>
-#include <mln/fun/i2v/all.hh>
-#include <mln/fun/all.hh>
-#include <mln/fun/x2v/all.hh>
-#include <mln/fun/p2b/all.hh>
+#include <mln/debug/all.hh>
+#include <mln/display/all.hh>
+#include <mln/draw/all.hh>
+#include <mln/estim/all.hh>
#include <mln/extension/all.hh>
+#include <mln/extract/all.hh>
+#include <mln/fun/all.hh>
+#include <mln/geom/all.hh>
#include <mln/histo/all.hh>
-#include <mln/trait/op/all.hh>
-#include <mln/trait/all.hh>
-#include <mln/trait/value/all.hh>
-#include <mln/win/all.hh>
-#include <mln/core/routine/all.hh>
-#include <mln/core/trait/all.hh>
-#include <mln/core/def/all.hh>
-#include <mln/core/internal/check/image_all.hh>
-#include <mln/core/image/all.hh>
-#include <mln/core/site_set/all.hh>
-#include <mln/io/pbm/all.hh>
-#include <mln/io/pfm/all.hh>
-#include <mln/io/pgm/all.hh>
#include <mln/io/all.hh>
-#include <mln/io/fits/all.hh>
-#include <mln/io/pnm/all.hh>
-#include <mln/io/ppm/all.hh>
-#include <mln/make/all.hh>
-#include <mln/canvas/morpho/all.hh>
-#include <mln/canvas/all.hh>
-#include <mln/canvas/browsing/all.hh>
-#include <mln/estim/all.hh>
-#include <mln/arith/all.hh>
-#include <mln/display/all.hh>
-#include <mln/test/all.hh>
-#include <mln/border/all.hh>
-#include <mln/trace/all.hh>
-#include <mln/debug/all.hh>
-#include <mln/morpho/elementary/all.hh>
-#include <mln/morpho/all.hh>
-#include <mln/accu/all.hh>
-#include <mln/pw/all.hh>
+#include <mln/labeling/all.hh>
+#include <mln/level/all.hh>
#include <mln/linear/all.hh>
-#include <mln/metal/all.hh>
-#include <mln/metal/math/all.hh>
-#include <mln/set/all.hh>
-#include <mln/convert/impl/all.hh>
-#include <mln/convert/all.hh>
-#include <mln/geom/all.hh>
#include <mln/literal/all.hh>
-#include <mln/level/approx/all.hh>
-#include <mln/level/all.hh>
-#include <mln/level/naive/all.hh>
+#include <mln/logical/all.hh>
+#include <mln/make/all.hh>
#include <mln/math/all.hh>
+#include <mln/metal/all.hh>
+#include <mln/morpho/all.hh>
#include <mln/norm/all.hh>
-#include <mln/logical/all.hh>
-#include <mln/draw/all.hh>
-#include <mln/value/builtin/all.hh>
-#include <mln/value/all.hh>
-#include <mln/value/internal/all.hh>
-#include <mln/value/concept/all.hh>
+#include <mln/pw/all.hh>
+#include <mln/set/all.hh>
#include <mln/tag/all.hh>
-#include <mln/labeling/all.hh>
+#include <mln/test/all.hh>
+#include <mln/trace/all.hh>
+#include <mln/trait/all.hh>
+#include <mln/util/all.hh>
+#include <mln/value/all.hh>
+#include <mln/win/all.hh>
#include <mln/essential/1d.hh>
#include <mln/essential/2d.hh>
diff --git a/milena/mln/essential/routine.hh b/milena/mln/essential/routine.hh
index 819749b..ba164b4 100644
--- a/milena/mln/essential/routine.hh
+++ b/milena/mln/essential/routine.hh
@@ -42,6 +42,7 @@
# include <mln/draw/essential.hh>
# include <mln/estim/essential.hh>
# include <mln/extension/essential.hh>
+# include <mln/extract/essential.hh>
# include <mln/fun/essential.hh>
# include <mln/geom/essential.hh>
# include <mln/histo/essential.hh>
diff --git a/milena/mln/extract/all.hh b/milena/mln/extract/all.hh
new file mode 100644
index 0000000..eeea24d
--- /dev/null
+++ b/milena/mln/extract/all.hh
@@ -0,0 +1,50 @@
+// 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_EXTRACT_ALL_HH
+# define MLN_EXTRACT_ALL_HH
+
+/// \file mln/extract/all.hh
+///
+/// File that includes all sub-data extraction related routines.
+
+
+namespace mln
+{
+
+ namespace extract
+ {
+ }
+
+}
+
+# include <mln/extract/red.hh>
+# include <mln/extract/green.hh>
+# include <mln/extract/blue.hh>
+
+
+#endif // ! MLN_EXTRACT_ALL_HH
diff --git a/milena/mln/extract/blue.hh b/milena/mln/extract/blue.hh
new file mode 100644
index 0000000..3315a25
--- /dev/null
+++ b/milena/mln/extract/blue.hh
@@ -0,0 +1,65 @@
+// 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_EXTRACT_GREEN_HH
+# define MLN_EXTRACT_GREEN_HH
+
+/// \file mln/extract/blue.hh
+///
+/// Extract the blue component of an image.
+
+
+# include <mln/core/image/fun_image.hh>
+# include <mln/fun/meta/blue.hh>
+
+namespace mln
+{
+
+ namespace extract
+ {
+
+ template <typename I>
+ fun_image<meta::blue<mln_value(I)>,I>
+ blue(Image<I>& ima);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ fun_image<meta::blue<mln_value(I)>,I>
+ blue(Image<I>& ima)
+ {
+ fun_image<meta::blue<mln_value(I)>,I> result(ima);
+ return result;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::extract
+
+} // end of namespace mln
+
+#endif // ! MLN_EXTRACT_GREEN_HH
diff --git a/milena/mln/extract/essential.hh b/milena/mln/extract/essential.hh
new file mode 100644
index 0000000..27a4cae
--- /dev/null
+++ b/milena/mln/extract/essential.hh
@@ -0,0 +1,38 @@
+// 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_EXTRACT_ESSENTIAL_HH
+# define MLN_EXTRACT_ESSENTIAL_HH
+
+/// \file mln/extract/all.hh
+///
+/// File that includes all sub-data extraction related routines.
+
+# include <mln/extract/all.hh>
+
+
+#endif // ! MLN_EXTRACT_ESSENTIAL_HH
diff --git a/milena/mln/extract/green.hh b/milena/mln/extract/green.hh
new file mode 100644
index 0000000..7a4e54c
--- /dev/null
+++ b/milena/mln/extract/green.hh
@@ -0,0 +1,65 @@
+// 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_EXTRACT_GREEN_HH
+# define MLN_EXTRACT_GREEN_HH
+
+/// \file mln/extract/green.hh
+///
+/// Extract the green component of an image.
+
+
+# include <mln/core/image/fun_image.hh>
+# include <mln/fun/meta/green.hh>
+
+namespace mln
+{
+
+ namespace extract
+ {
+
+ template <typename I>
+ fun_image<meta::green<mln_value(I)>,I>
+ green(Image<I>& ima);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ fun_image<meta::green<mln_value(I)>,I>
+ green(Image<I>& ima)
+ {
+ fun_image<meta::green<mln_value(I)>,I> result(ima);
+ return result;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::extract
+
+} // end of namespace mln
+
+#endif // ! MLN_EXTRACT_GREEN_HH
diff --git a/milena/mln/extract/red.hh b/milena/mln/extract/red.hh
new file mode 100644
index 0000000..9946568
--- /dev/null
+++ b/milena/mln/extract/red.hh
@@ -0,0 +1,65 @@
+// 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_EXTRACT_RED_HH
+# define MLN_EXTRACT_RED_HH
+
+/// \file mln/extract/red.hh
+///
+/// Extract the red component of an image.
+
+
+# include <mln/core/image/fun_image.hh>
+# include <mln/fun/meta/red.hh>
+
+namespace mln
+{
+
+ namespace extract
+ {
+
+ template <typename I>
+ fun_image<meta::red<mln_value(I)>,I>
+ red(Image<I>& ima);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ fun_image<meta::red<mln_value(I)>,I>
+ red(Image<I>& ima)
+ {
+ fun_image<meta::red<mln_value(I)>,I> result(ima);
+ return result;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::extract
+
+} // end of namespace mln
+
+#endif // ! MLN_EXTRACT_RED_HH
diff --git a/milena/tests/extract/Makefile.am b/milena/tests/extract/Makefile.am
new file mode 100644
index 0000000..d39a20f
--- /dev/null
+++ b/milena/tests/extract/Makefile.am
@@ -0,0 +1,14 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ red \
+ green \
+ blue
+
+red_SOURCES = red.cc
+green_SOURCES = green.cc
+blue_SOURCES = blue.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/extract/blue.cc b/milena/tests/extract/blue.cc
new file mode 100644
index 0000000..2748fa3
--- /dev/null
+++ b/milena/tests/extract/blue.cc
@@ -0,0 +1,45 @@
+// 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.
+
+# include <mln/core/image/image2d.hh>
+# include <mln/extract/blue.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/core/var.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<value::rgb8> ima(2,2);
+ point2d p(1,1);
+ ima(p) = value::rgb8(200, 230, 240);
+
+ mln_VAR(ima_blue, extract::blue(ima));
+
+ mln_assertion(ima(p).blue() == ima_blue(p));
+}
+
diff --git a/milena/tests/extract/green.cc b/milena/tests/extract/green.cc
new file mode 100644
index 0000000..59a8c28
--- /dev/null
+++ b/milena/tests/extract/green.cc
@@ -0,0 +1,45 @@
+// 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.
+
+# include <mln/core/image/image2d.hh>
+# include <mln/extract/green.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/core/var.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<value::rgb8> ima(2,2);
+ point2d p(1,1);
+ ima(p) = value::rgb8(200, 230, 240);
+
+ mln_VAR(ima_green, extract::green(ima));
+
+ mln_assertion(ima(p).green() == ima_green(p));
+}
+
diff --git a/milena/tests/extract/red.cc b/milena/tests/extract/red.cc
new file mode 100644
index 0000000..de2facb
--- /dev/null
+++ b/milena/tests/extract/red.cc
@@ -0,0 +1,45 @@
+// 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.
+
+# include <mln/core/image/image2d.hh>
+# include <mln/extract/red.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/core/var.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<value::rgb8> ima(2,2);
+ point2d p(1,1);
+ ima(p) = value::rgb8(200, 230, 240);
+
+ mln_VAR(ima_red, extract::red(ima));
+
+ mln_assertion(ima(p).red() == ima_red(p));
+}
+
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index 9398c88..3b4444a 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -155,6 +155,11 @@ mln_make_w_window3d_int \
mln_make_essential \
mln_make_w_window1d_int \
mln_make_point2d_h \
+mln_extract_red \
+mln_extract_all \
+mln_extract_green \
+mln_extract_blue \
+mln_extract_essential \
mln_display_all \
mln_display_essential \
mln_extension_adjust \
@@ -421,6 +426,7 @@ mln_math_essential \
mln_math_acos \
mln_math_round_sat \
mln_opt_at \
+mln_opt_element \
mln_opt_value \
mln_binarization_includes \
mln_binarization_all \
@@ -1170,6 +1176,11 @@ mln_make_w_window3d_int_SOURCES = mln_make_w_window3d_int.cc
mln_make_essential_SOURCES = mln_make_essential.cc
mln_make_w_window1d_int_SOURCES = mln_make_w_window1d_int.cc
mln_make_point2d_h_SOURCES = mln_make_point2d_h.cc
+mln_extract_red_SOURCES = mln_extract_red.cc
+mln_extract_all_SOURCES = mln_extract_all.cc
+mln_extract_green_SOURCES = mln_extract_green.cc
+mln_extract_blue_SOURCES = mln_extract_blue.cc
+mln_extract_essential_SOURCES = mln_extract_essential.cc
mln_display_all_SOURCES = mln_display_all.cc
mln_display_essential_SOURCES = mln_display_essential.cc
mln_extension_adjust_SOURCES = mln_extension_adjust.cc
@@ -1436,6 +1447,7 @@ mln_math_essential_SOURCES = mln_math_essential.cc
mln_math_acos_SOURCES = mln_math_acos.cc
mln_math_round_sat_SOURCES = mln_math_round_sat.cc
mln_opt_at_SOURCES = mln_opt_at.cc
+mln_opt_element_SOURCES = mln_opt_element.cc
mln_opt_value_SOURCES = mln_opt_value.cc
mln_binarization_includes_SOURCES = mln_binarization_includes.cc
mln_binarization_all_SOURCES = mln_binarization_all.cc
diff --git a/milena/tests/unit_test/mln_extract_all.cc b/milena/tests/unit_test/mln_extract_all.cc
new file mode 100644
index 0000000..1d2ce3d
--- /dev/null
+++ b/milena/tests/unit_test/mln_extract_all.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/extract/all.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/extract/all.hh>
+#include <mln/extract/all.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_extract_blue.cc b/milena/tests/unit_test/mln_extract_blue.cc
new file mode 100644
index 0000000..db1009f
--- /dev/null
+++ b/milena/tests/unit_test/mln_extract_blue.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/extract/blue.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/extract/blue.hh>
+#include <mln/extract/blue.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_extract_essential.cc b/milena/tests/unit_test/mln_extract_essential.cc
new file mode 100644
index 0000000..ab8ba1e
--- /dev/null
+++ b/milena/tests/unit_test/mln_extract_essential.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/extract/essential.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/extract/essential.hh>
+#include <mln/extract/essential.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_extract_green.cc b/milena/tests/unit_test/mln_extract_green.cc
new file mode 100644
index 0000000..b504f6c
--- /dev/null
+++ b/milena/tests/unit_test/mln_extract_green.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/extract/green.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/extract/green.hh>
+#include <mln/extract/green.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_extract_red.cc b/milena/tests/unit_test/mln_extract_red.cc
new file mode 100644
index 0000000..8af1a91
--- /dev/null
+++ b/milena/tests/unit_test/mln_extract_red.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/extract/red.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/extract/red.hh>
+#include <mln/extract/red.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_opt_element.cc b/milena/tests/unit_test/mln_opt_element.cc
new file mode 100644
index 0000000..8a0225c
--- /dev/null
+++ b/milena/tests/unit_test/mln_opt_element.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/opt/element.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/opt/element.hh>
+#include <mln/opt/element.hh>
+
+int main()
+{
+ // Nothing.
+}
--
1.5.6.5