URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-17 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fix namespaces documentation.
* mln/arith/all.hh: New,
* mln/canvas/all.hh: New,
* mln/canvas/browsing/all.hh: New,
* mln/canvas/morpho/all.hh: New,
* mln/convert/all.hh: New,
* mln/display/all.hh: New,
* mln/draw/all.hh: New,
* mln/estim/all.hh: New,
* mln/io/abort.hh: New,
* mln/io/all.hh: New,
* mln/io/fits/all.hh: New,
* mln/io/pbm/all.hh: New,
* mln/io/ppm/all.hh: New,
* mln/io/pfm/all.hh: New,
* mln/io/pgm/all.hh: New,
* mln/io/pnm/all.hh: New, add missing all.hh files.
* mln/accu/all.hh,
* mln/border/all.hh,
* mln/core/image1d.hh,
* mln/debug/all.hh: Fix documentation.
Rename io/internal/pnm to io/pnm.
* mln/io/internal/abort.hh: Rename as...
* mln/io/abort.hh: ...this.
* mln/io/internal/pnm/load.hh: Rename as...
* mln/io/internal/pnm/load.hh: ...this.
* mln/io/internal/pnm/load_header.hh: Rename as...
* mln/io/internal/pnm/load_header.hh: ...this.
* mln/io/internal/pnm/macros.hh: Rename as...
* mln/io/internal/pnm/macros.hh: ...this.
* mln/io/internal/pnm/save.hh: Rename as...
* mln/io/internal/pnm/save.hh: ...this.
* mln/io/internal/pnm/save_header.hh: Rename as...
* mln/io/internal/pnm/save_header.hh: ...this.
* mln/io/internal/pnm: Rename as...
* mln/io/pnm: ...this.
* mln/io/pbm/load.hh,
* mln/io/pbm/save.hh,
* mln/io/pgm/load.hh,
* mln/io/pgm/save.hh,
* mln/io/pnm/load.hh,
* mln/io/pnm/load_header.hh,
* mln/io/pnm/macros.hh,
* mln/io/pnm/save.hh,
* mln/io/pnm/save_header.hh,
* mln/io/ppm/load.hh,
* mln/io/ppm/save.hh,
* mln/io/fits/load.hh: Update.
---
accu/all.hh | 11 +-
arith/all.hh | 54 +++++++++++
border/all.hh | 9 +
canvas/all.hh | 54 +++++++++++
canvas/browsing/all.hh | 53 +++++++++++
canvas/morpho/all.hh | 50 ++++++++++
convert/all.hh | 53 +++++++++++
core/image1d.hh | 2
debug/all.hh | 7 +
display/all.hh | 53 +++++++++++
draw/all.hh | 48 ++++++++++
estim/all.hh | 49 ++++++++++
io/abort.hh | 60 ++++++++++++
io/all.hh | 52 +++++++++++
io/fits/all.hh | 50 ++++++++++
io/fits/load.hh | 4
io/pbm/all.hh | 58 ++++++++++++
io/pbm/load.hh | 4
io/pbm/save.hh | 4
io/pfm/all.hh | 58 ++++++++++++
io/pgm/all.hh | 51 ++++++++++
io/pgm/load.hh | 6 -
io/pgm/save.hh | 4
io/pnm/all.hh | 55 +++++++++++
io/pnm/load.hh | 228 +++++++++++++++++++++++++++++++++++++++++++++++++
io/pnm/load_header.hh | 135 +++++++++++++++++++++++++++++
io/pnm/macros.hh | 49 ++++++++++
io/pnm/save.hh | 182 +++++++++++++++++++++++++++++++++++++++
io/pnm/save_header.hh | 100 +++++++++++++++++++++
io/ppm/all.hh | 51 ++++++++++
io/ppm/load.hh | 6 -
io/ppm/save.hh | 4
32 files changed, 1577 insertions(+), 27 deletions(-)
Index: trunk/milena/mln/debug/all.hh
===================================================================
--- trunk/milena/mln/debug/all.hh (revision 1345)
+++ trunk/milena/mln/debug/all.hh (revision 1346)
@@ -38,10 +38,13 @@
{
/// Namespace of routines that help to debug.
- namespace debug {}
-
+ namespace debug
+ {
+ /// Implementation namespace of debug namespace.
+ namespace impl {}
}
+}
# include <mln/debug/format.hh>
# include <mln/debug/iota.hh>
Index: trunk/milena/mln/core/image1d.hh
===================================================================
--- trunk/milena/mln/core/image1d.hh (revision 1345)
+++ trunk/milena/mln/core/image1d.hh (revision 1346)
@@ -59,7 +59,7 @@
namespace internal
{
- /// Data structure for mln::image1d<T>.
+ /// Data structure for \c mln::image1d<T>.
template <typename T>
struct data_< image1d<T> >
{
Index: trunk/milena/mln/draw/all.hh
===================================================================
--- trunk/milena/mln/draw/all.hh (revision 0)
+++ trunk/milena/mln/draw/all.hh (revision 1346)
@@ -0,0 +1,48 @@
+// 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_DRAW_ALL_HH
+# define MLN_DRAW_ALL_HH
+
+/*! \file mln/draw/all.hh
+ *
+ * \brief File that includes all draw-related routines.
+ */
+
+
+namespace mln
+{
+
+ /// Namespace of drawing routines.
+ namespace draw {}
+
+}
+
+# include <mln/draw/line.hh>
+# include <mln/draw/mesh.hh>
+
+#endif // ! MLN_DRAW_ALL_HH
Index: trunk/milena/mln/arith/all.hh
===================================================================
--- trunk/milena/mln/arith/all.hh (revision 0)
+++ trunk/milena/mln/arith/all.hh (revision 1346)
@@ -0,0 +1,54 @@
+// 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_ARITH_ALL_HH
+# define MLN_ARITH_ALL_HH
+
+/*! \file mln/arith/all.hh
+ *
+ * \brief File that includes all arithmetic materials.
+ */
+
+
+namespace mln
+{
+
+ /// Namespace of arithmetic.
+ namespace arith
+ {
+ /// Implementation namespace of arith namespace.
+ namespace impl {}
+ }
+
+}
+
+# include <mln/arith/min.hh>
+# include <mln/arith/minus.hh>
+# include <mln/arith/plus.hh>
+# include <mln/arith/revert.hh>
+
+#endif // ! MLN_ARITH_ALL_HH
Index: trunk/milena/mln/accu/all.hh
===================================================================
--- trunk/milena/mln/accu/all.hh (revision 1345)
+++ trunk/milena/mln/accu/all.hh (revision 1346)
@@ -41,9 +41,14 @@
namespace mln
{
- /*! Namespace of accumulators.
- */
- namespace accu {}
+ /// Namespace of accumulators.
+ namespace accu
+ {
+ /// Implementation namespace of accumulator namespace.
+ namespace impl {}
+ /// Internal namespace of accumulators.
+ namespace internal {}
+ }
}
Index: trunk/milena/mln/border/all.hh
===================================================================
--- trunk/milena/mln/border/all.hh (revision 1345)
+++ trunk/milena/mln/border/all.hh (revision 1346)
@@ -37,9 +37,12 @@
namespace mln
{
- /*! Namespace of routines related to image virtual (outer) border.
- */
- namespace border {}
+ /// Namespace of routines related to image virtual (outer) border.
+ namespace border
+ {
+ /// Implementation namespace of border namespace.
+ namespace impl {}
+ }
}
Index: trunk/milena/mln/convert/all.hh
===================================================================
--- trunk/milena/mln/convert/all.hh (revision 0)
+++ trunk/milena/mln/convert/all.hh (revision 1346)
@@ -0,0 +1,53 @@
+// 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_CONVERT_ALL_HH
+# define MLN_CONVERT_ALL_HH
+
+/*! \file mln/convert/all.hh
+ *
+ * \brief File that includes all convertion-related routines.
+ */
+
+
+namespace mln
+{
+ /// Namespace of convertion routines.
+ namespace convert {}
+}
+
+# include <mln/convert/to_dpoint.hh>
+# include <mln/convert/to_fun.hh>
+# include <mln/convert/to_image.hh>
+# include <mln/convert/to_rgb.hh>
+# include <mln/convert/to_std_set.hh>
+# include <mln/convert/to_tiles.hh>
+# include <mln/convert/to_vec_p.hh>
+# include <mln/convert/to_window.hh>
+# include <mln/convert/to_w_window.hh>
+
+#endif // ! MLN_CONVERT_ALL_HH
Index: trunk/milena/mln/estim/all.hh
===================================================================
--- trunk/milena/mln/estim/all.hh (revision 0)
+++ trunk/milena/mln/estim/all.hh (revision 1346)
@@ -0,0 +1,49 @@
+// 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_ESTIM_ALL_HH
+# define MLN_ESTIM_ALL_HH
+
+/*! \file mln/estim/all.hh
+ *
+ * \brief File that includes all estimation materials.
+ */
+
+
+namespace mln
+{
+
+ /// Namespace of estimation materials.
+ namespace estim {}
+
+}
+
+# include <mln/estim/mean.hh>
+# include <mln/estim/min_max.hh>
+# include <mln/estim/sum.hh>
+
+#endif // ! MLN_ESTIM_ALL_HH
Index: trunk/milena/mln/display/all.hh
===================================================================
--- trunk/milena/mln/display/all.hh (revision 0)
+++ trunk/milena/mln/display/all.hh (revision 1346)
@@ -0,0 +1,53 @@
+// 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_DISPLAY_ALL_HH
+# define MLN_DISPLAY_ALL_HH
+
+/*! \file mln/display/all.hh
+ *
+ * \brief File that includes all display routines.
+ */
+
+
+namespace mln
+{
+
+ /// Namespace of routines that help to display images.
+ namespace display
+ {
+ /// Implementation namespace of display namespace.
+ namespace impl {}
+ }
+
+}
+
+# include <mln/display/color_pretty.hh>
+# include <mln/display/save.hh>
+# include <mln/display/show.hh>
+
+#endif // ! MLN_DISPLAY_ALL_HH
Index: trunk/milena/mln/io/pfm/all.hh
===================================================================
--- trunk/milena/mln/io/pfm/all.hh (revision 0)
+++ trunk/milena/mln/io/pfm/all.hh (revision 1346)
@@ -0,0 +1,58 @@
+// 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_PFM_ALL_HH
+# define MLN_IO_PFM_ALL_HH
+
+/*! \file mln/io/pfm/all.hh
+ *
+ * \brief File that includes all pfm io materials.
+ */
+
+
+namespace mln
+{
+
+ namespace io
+ {
+ /// Namespace of pfm input/output handling.
+ namespace pfm
+ {
+ /// Implementation namespace of pfm namespace.
+ namespace impl {}
+
+ /// Internal namespace of pfm namespace.
+ namespace internal {}
+ }
+ }
+
+}
+
+# include <mln/io/pfm/load.hh>
+# include <mln/io/pfm/save.hh>
+
+#endif // ! MLN_IO_PFM_ALL_HH
Index: trunk/milena/mln/io/pgm/all.hh
===================================================================
--- trunk/milena/mln/io/pgm/all.hh (revision 0)
+++ trunk/milena/mln/io/pgm/all.hh (revision 1346)
@@ -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
Index: trunk/milena/mln/io/pgm/save.hh
===================================================================
--- trunk/milena/mln/io/pgm/save.hh (revision 1345)
+++ trunk/milena/mln/io/pgm/save.hh (revision 1346)
@@ -40,7 +40,7 @@
# include <iostream>
# include <fstream>
-# include <mln/io/internal/pnm/save.hh>
+# include <mln/io/pnm/save.hh>
# include <mln/geom/size2d.hh>
# include <mln/metal/templated_by.hh>
@@ -76,7 +76,7 @@
mln::metal::templated_by<mln_value(I), value::int_u >,
mln::metal::templated_by<mln_value(I), value::int_u_sat >
::check();
- io::internal::pnm::save(PGM,
exact(ima), filename);
+ io::pnm::save(PGM, exact(ima), filename);
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/io/pgm/load.hh
===================================================================
--- trunk/milena/mln/io/pgm/load.hh (revision 1345)
+++ trunk/milena/mln/io/pgm/load.hh (revision 1346)
@@ -45,7 +45,7 @@
# include <mln/value/int_u8.hh>
-# include <mln/io/internal/pnm/load.hh>
+# include <mln/io/pnm/load.hh>
namespace mln
@@ -60,7 +60,7 @@
template <typename V>
image2d<V> load(const std::string& filename)
{
- return io::internal::pnm::load<V>(PGM, filename);
+ return io::pnm::load<V>(PGM, filename);
}
image2d<value::int_u8> load(const std::string& filename)
@@ -72,7 +72,7 @@
void load(Image<I>& ima,
const std::string& filename)
{
- io::internal::pnm::load<I>(PGM, ima, filename);
+ io::pnm::load<I>(PGM, ima, filename);
}
} // end of namespace mln::io::pgm
Index: trunk/milena/mln/io/abort.hh
===================================================================
--- trunk/milena/mln/io/abort.hh (revision 0)
+++ trunk/milena/mln/io/abort.hh (revision 1346)
@@ -0,0 +1,60 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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_ABORT_HH
+# define MLN_IO_ABORT_HH
+
+/*!
+ * \file mln/io/abort.hh
+ *
+ * \brief Define a function which aborts a process in io module.
+ *
+ */
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace internal
+ {
+
+ void abort()
+ {
+ std::cerr << " aborting." << std::endl;
+ exit(0);
+ }
+
+ } // end of namespace mln::io::internal
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+#endif // ! MLN_IO_ABORT_HH
Index: trunk/milena/mln/io/fits/all.hh
===================================================================
--- trunk/milena/mln/io/fits/all.hh (revision 0)
+++ trunk/milena/mln/io/fits/all.hh (revision 1346)
@@ -0,0 +1,50 @@
+// 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_FITS_ALL_HH
+# define MLN_IO_FITS_ALL_HH
+
+/*! \file mln/io/fits/all.hh
+ *
+ * \brief File that includes all fits io materials.
+ */
+
+
+namespace mln
+{
+
+ namespace io
+ {
+ /// Namespace of fits input/output handling.
+ namespace fits {}
+ }
+
+}
+
+# include <mln/io/fits/load.hh>
+
+#endif // ! MLN_IO_FITS_ALL_HH
Index: trunk/milena/mln/io/fits/load.hh
===================================================================
--- trunk/milena/mln/io/fits/load.hh (revision 1345)
+++ trunk/milena/mln/io/fits/load.hh (revision 1346)
@@ -45,10 +45,6 @@
# include <mln/value/int_u8.hh>
# include <mln/io/fitsio.h>
-#include <iostream>
-#include <fstream>
-#include <string>
-
namespace mln
{
Index: trunk/milena/mln/io/all.hh
===================================================================
--- trunk/milena/mln/io/all.hh (revision 0)
+++ trunk/milena/mln/io/all.hh (revision 1346)
@@ -0,0 +1,52 @@
+// 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_ALL_HH
+# define MLN_IO_ALL_HH
+
+/*! \file mln/io/all.hh
+ *
+ * \brief File that includes all io materials.
+ */
+
+
+namespace mln
+{
+
+ /// Namespace of input/output handling.
+ namespace io {}
+
+}
+
+# include <mln/io/fits/all.hh>
+# include <mln/io/pbm/all.hh>
+# include <mln/io/pfm/all.hh>
+# include <mln/io/pgm/all.hh>
+# include <mln/io/pnm/all.hh>
+# include <mln/io/ppm/all.hh>
+
+#endif // ! MLN_IO_ALL_HH
Index: trunk/milena/mln/io/pnm/macros.hh
===================================================================
--- trunk/milena/mln/io/pnm/macros.hh (revision 0)
+++ trunk/milena/mln/io/pnm/macros.hh (revision 1346)
@@ -0,0 +1,49 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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_PNM_MACROS_HH
+# define MLN_IO_PNM_MACROS_HH
+
+/*! \file mln/io/pnm/macros.hh
+ *
+ * \brief Definition of pnm formats macros.
+ */
+
+/// Portable Pixel Map Format
+# define PPM '6'
+# define PPM_ASCII '3'
+
+/// Portable Gray Map Format
+# define PGM '5'
+# define PGM_ASCII '2'
+
+/// Portable Bit Map Format
+# define PBM '4'
+# define PBM_ASCII '1'
+
+#endif // ! MLN_IO_PNM_LOAD_HH
Index: trunk/milena/mln/io/pnm/save_header.hh
===================================================================
--- trunk/milena/mln/io/pnm/save_header.hh (revision 0)
+++ trunk/milena/mln/io/pnm/save_header.hh (revision 1346)
@@ -0,0 +1,100 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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_PNM_SAVE_HEADER_HH
+# define MLN_IO_PNM_SAVE_HEADER_HH
+
+/*!
+ * \file mln/io/pnm/save_header.hh
+ *
+ * \brief Define a function which saves header for PNM image.
+ *
+ */
+
+# include <iostream>
+# include <fstream>
+
+# include <mln/value/rgb.hh>
+# include <mln/geom/nrows.hh>
+# include <mln/geom/ncols.hh>
+
+namespace mln
+{
+
+ namespace io
+ {
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace pnm
+ {
+
+ template <typename V>
+ void save_max_val(V&, std::ofstream& file)
+ {
+ if (mln_max(V) > 1)
+ file << mln_max(V) << std::endl;
+ }
+
+ template <unsigned int n>
+ void save_max_val(value::rgb<n>&, std::ofstream& file)
+ {
+ typedef typename value::rgb<n>::enc E;
+ file << mln_max(E) << std::endl;
+ }
+
+ template <typename I>
+ void save_header(const char type,
+ const I& ima, const std::string& filename,
+ std::ofstream& file)
+ {
+ if (! file)
+ {
+ std::cerr << "error: cannot open file '" << filename
+ << "'!";
+ abort();
+ }
+ file << "P" << type << std::endl;
+ file << "# milena" << std::endl;
+ file << geom::ncols(ima) << ' ' << geom::nrows(ima) <<
std::endl;
+
+ mln_value(I) i;
+ save_max_val(i, file);
+ }
+
+ } // end of namespace mln::io::pnm
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+
+#endif // ! MLN_IO_PNM_SAVE_HEADER_HH
Index: trunk/milena/mln/io/pnm/load_header.hh
===================================================================
--- trunk/milena/mln/io/pnm/load_header.hh (revision 0)
+++ trunk/milena/mln/io/pnm/load_header.hh (revision 1346)
@@ -0,0 +1,135 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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_PNM_LOAD_HEADER_HH
+# define MLN_IO_PNM_LOAD_HEADER_HH
+
+/*!
+ * \file mln/io/pnm/load_header.hh
+ *
+ * \brief Define a function which loads header for PNM image.
+ *
+ */
+
+# include <iostream>
+# include <fstream>
+# include <string>
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace pnm
+ {
+
+
+ bool read_header(std::ifstream& istr,
+ char& type,
+ int& nrows, int& ncols,
+ unsigned int& maxval,
+ bool test = false)
+ {
+ // check magic
+ if (istr.get() != 'P' )
+ goto err;
+ type = istr.get();
+
+ if (type < '1' || type > '6')
+ goto err;
+ if (istr.get() != '\n')
+ goto err;
+
+ // skip comments
+ while (istr.peek() == '#')
+ {
+ std::string line;
+ std::getline(istr, line);
+ }
+
+ // get size
+ istr >> ncols >> nrows;
+ if (nrows <= 0 || ncols <= 0)
+ goto err;
+
+ // get maxvalue
+ if (istr.get() != '\n')
+ goto err;
+ if (type != '1' && type != '4')
+ {
+ istr >> maxval;
+ if (istr.get() != '\n')
+ goto err;
+ }
+ return true;
+
+ err:
+ if (! test)
+ {
+ std::cerr << "error: badly formed header!";
+ abort();
+ }
+ return false;
+ }
+
+ void read_header(char ascii, char raw,
+ std::ifstream& istr,
+ char& type,
+ int& nrows, int& ncols,
+ unsigned int& maxval)
+ {
+ read_header(istr, type, nrows, ncols, maxval);
+ if (! (type == ascii || type == raw))
+ {
+ std::cerr << "error: bad pnm type; "
+ << "expected P" << ascii
+ << " or P" << raw
+ << ", get P" << type << "!";
+ abort();
+ }
+ }
+
+ void read_header(char ascii, char raw,
+ std::ifstream& istr,
+ char& type,
+ int& nrows, int& ncols)
+ {
+ unsigned int maxval;
+ read_header(ascii, raw, istr, type,
+ nrows, ncols, maxval);
+ }
+
+ } // end of namespace mln::io::pnm
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+
+#endif // ! MLN_IO_PNM_LOAD_HEADER_HH
Index: trunk/milena/mln/io/pnm/all.hh
===================================================================
--- trunk/milena/mln/io/pnm/all.hh (revision 0)
+++ trunk/milena/mln/io/pnm/all.hh (revision 1346)
@@ -0,0 +1,55 @@
+// 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_PNM_ALL_HH
+# define MLN_IO_PNM_ALL_HH
+
+/*! \file mln/io/pnm/all.hh
+ *
+ * \brief File that includes all pnm io materials.
+ */
+
+
+namespace mln
+{
+
+ namespace io
+ {
+ /// Namespace of pnm input/output handling.
+ namespace pnm
+ {
+ /// Namespace of pnm's implementation details.
+ namespace impl {}
+ }
+ }
+
+}
+
+# include <mln/io/pnm/load.hh>
+# include <mln/io/pnm/save.hh>
+
+#endif // ! MLN_IO_PNM_ALL_HH
Index: trunk/milena/mln/io/pnm/save.hh
===================================================================
--- trunk/milena/mln/io/pnm/save.hh (revision 0)
+++ trunk/milena/mln/io/pnm/save.hh (revision 1346)
@@ -0,0 +1,182 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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_PNM_SAVE_HH
+# define MLN_IO_PNM_SAVE_HH
+
+/*!
+ * \file mln/io/pnm/save.hh
+ *
+ * \brief Define a function which saves an image of kind PNM into
+ * given path.
+ *
+ */
+
+# include <iostream>
+# include <fstream>
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/point2d.hh>
+
+# include <mln/value/rgb.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/value/int_u8.hh>
+
+# include <mln/metal/templated_by.hh>
+
+# include <mln/io/pnm/save_header.hh>
+# include <mln/io/pnm/macros.hh>
+
+# include <mln/geom/size2d.hh>
+
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace pnm
+ {
+
+ // FIXME: Doc.
+ template <typename I>
+ void save(const int type, const Image<I>& ima_, const std::string&
filename);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // write a rgb value into for uncontiguous datas
+ template <unsigned int n>
+ void write_value(std::ofstream& file,
+ const value::rgb<n>& c)
+ {
+ typedef typename value::rgb<n>::enc::enc E;
+
+ E v = c.red().to_enc();
+ file.write((char*)&v, sizeof(E));
+ v = c.green().to_enc();
+ file.write((char*)&v, sizeof(E));
+ v = c.blue().to_enc();
+ file.write((char*)&v, sizeof(E));
+ }
+
+ // write a scalar value into for uncontiguous datas
+ template <typename V>
+ void write_value(std::ofstream& file,
+ V& v)
+ {
+ typedef typename V::enc E;
+
+ E c = v.to_enc();
+ file.write((char*)(&c), sizeof(E));
+ }
+
+ // save data for (sizeof(int_u8) != 1) and non fastest images
+ template <typename I>
+ void save_data_uncontiguous(std::ofstream& file,
+ const I& ima)
+ {
+ const int
+ min_row = geom::min_row(ima),
+ max_row = geom::max_row(ima),
+ min_col = geom::min_col(ima),
+ max_col = geom::max_col(ima);
+
+ point2d p;
+ for (p.row() = min_row; p.row() <= max_row; ++p.row())
+ for (p.col() = min_col; p.col() <= max_col; ++p.col())
+ write_value(file, ima(p));
+ }
+
+ // save data when (sizeof(int_u8) == 1) with fastest images
+ // (faster)
+ template <typename I>
+ void save_data_contiguous(std::ofstream& file,
+ const I& ima_)
+ {
+ const I& ima = exact(ima_);
+ const int
+ min_row = geom::min_row(ima),
+ max_row = geom::max_row(ima);
+ point2d p;
+ p.col() = geom::min_col(ima);
+ size_t len = geom::ncols(ima) * sizeof(mln_value(I));
+ for (p.row() = min_row; p.row() <= max_row; ++p.row())
+ file.write((char*)(& ima(p)), len);
+ }
+
+
+ // caller for fastest images
+ template <typename I>
+ void save_data_(std::ofstream& file,
+ trait::image::speed::fastest, const I& ima)
+ {
+ if (sizeof(value::int_u8) == 1)
+ save_data_contiguous(file, ima);
+ else
+ save_data_uncontiguous(file, ima);
+ }
+
+ // caller for non fastest images
+ template <typename I>
+ void save_data_(std::ofstream& file,
+ trait::image::speed::any, const I& ima)
+ {
+ save_data_uncontiguous(file, ima);
+ }
+
+ } // end of namespace mln::io::pnm::impl
+
+
+ // Facades.
+
+ template <typename I>
+ void save(const int type, const Image<I>& ima_, const std::string&
filename)
+ {
+ const I& ima = exact(ima_);
+ std::ofstream file(filename.c_str());
+ io::pnm::save_header(type, ima, filename, file);
+
+ impl::save_data_(file,
+ mln_trait_image_speed(I)(), ima);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::pnm
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+
+#endif // ! MLN_IO_PNM_SAVE_HH
Index: trunk/milena/mln/io/pnm/load.hh
===================================================================
--- trunk/milena/mln/io/pnm/load.hh (revision 0)
+++ trunk/milena/mln/io/pnm/load.hh (revision 1346)
@@ -0,0 +1,228 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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_PNM_LOAD_HH
+# define MLN_IO_PNM_LOAD_HH
+
+/*!
+ * \file mln/io/pnm/load.hh
+ *
+ * \brief Define a function which loads an image of kind PNM 8/16bits with
+ * given path.
+ */
+
+# include <iostream>
+# include <fstream>
+# include <string>
+
+# include <mln/core/image2d.hh>
+
+# include <mln/value/int_u8.hh>
+# include <mln/value/rgb.hh>
+
+# include <mln/io/pnm/load_header.hh>
+# include <mln/io/pnm/macros.hh>
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace pnm
+ {
+
+# ifndef MLN_INCLUDE_ONLY
+ //read a rgb value (sizeof(int_u8) != 1)
+ template <unsigned int n>
+ void read_value(std::ifstream& file,
+ value::rgb<n>& v)
+ {
+ typedef typename value::rgb<n>::enc::enc E;
+
+ E c;
+ file.read((char*)(&c), sizeof(E));
+ v.red() = c;
+ file.read((char*)(&c), sizeof(E));
+ v.green() = c;
+ file.read((char*)(&c), sizeof(E));
+ v.blue() = c;
+ }
+
+ //read a scalar value (sizeof(int_u8) != 1)
+ template <class V>
+ void read_value(std::ifstream& file,
+ V& v)
+ {
+ typedef typename V::enc E;
+
+ E c;
+ file.read((char*)(&c), sizeof(E));
+ v = c;
+ }
+
+ // used when (sizeof(int_u8) != 1)
+ template <typename V>
+ void load_raw_2d_uncontiguous(std::ifstream& file,
+ image2d<V>& ima)
+ {
+ const int
+ min_row = geom::min_row(ima),
+ max_row = geom::max_row(ima),
+ min_col = geom::min_col(ima),
+ max_col = geom::max_col(ima);
+
+ point2d p;
+ for (p.row() = min_row; p.row() <= max_row; ++p.row())
+ for (p.col() = min_col; p.col() <= max_col; ++p.col())
+ read_value(file, ima(p));
+ }
+
+ // used in g++ > 2.95
+ template <typename I>
+ void load_raw_2d_contiguous(std::ifstream& file, I& ima)
+ {
+ point2d p = make::point2d(0, ima.domain().pmin().col());
+ typedef mln_value(I) V;
+ const mln_coord(I)
+ min_row = geom::min_row(ima),
+ max_row = geom::max_row(ima);
+
+ size_t len = geom::ncols(ima) * sizeof(V);
+ for (p.row() = min_row; p.row() <= max_row; ++p.row())
+ file.read((char*)(&ima(p)), len);
+ }
+
+ /// load_ascii.
+ template <typename I>
+ void load_ascii(std::ifstream& file, I& ima)
+ {
+ mln_fwd_piter(I) p(ima.domain());
+ for_all(p)
+ {
+ unsigned value;
+ file >> value;
+ ima(p) = value;
+ // FIXME: Test alt code below.
+ // file >> ima(p);
+ }
+ }
+
+ /// load_raw_2d.
+ /// for all pnm 8/16 bits formats
+ template <typename I>
+ void load_raw_2d(std::ifstream& file, I& ima)
+ {
+ if (sizeof(value::int_u8) == 1)
+ load_raw_2d_contiguous(file, ima);
+ else
+ load_raw_2d_uncontiguous(file, ima);
+ }
+
+ /// main function : load pnm format
+ template <typename V>
+ image2d<V> load(char type_, const std::string& filename)
+ {
+ std::ifstream file(filename.c_str());
+ if (! file)
+ {
+ std::cerr << "error: file '" << filename
+ << "' not found!";
+ abort();
+ }
+ char type = 0;
+ int nrows, ncols;
+ unsigned int maxval;
+ read_header(type_ - 3, type_, file, type,
+ nrows, ncols, maxval);
+
+ image2d<V> ima(nrows, ncols);
+ if (type == type_)
+ load_raw_2d(file, ima);
+ else
+ if (type == (type_ - 3))
+ pnm::load_ascii(file, ima);
+ return ima;
+
+ }
+
+ /// a new function to load pnm files :
+ /// the destination is an argument to check if
+ /// the type match the file to load.
+ template <typename I>
+ void load(char type_,
+ Image<I>& ima_,
+ const std::string& filename)
+ {
+ std::ifstream file(filename.c_str());
+ if (! file)
+ {
+ std::cerr << "error: file '" << filename
+ << "' not found!";
+ abort();
+ }
+
+ I& ima = exact(ima_);
+
+ char type = 0;
+ int nrows, ncols;
+ unsigned int maxval;
+ read_header(type_ - 3, type_, file, type,
+ nrows, ncols, maxval);
+
+ if (value::props< mln_value(I) >::max() != maxval)
+ {
+ std::cerr << "max ref : " << value::props< mln_value(I)
>::max()
+ << "max image : " << maxval
+ << std::endl;
+
+ std::cerr << "error: file '" << filename
+ << "' cannot be loaded into this type of image"
+ << std::endl;
+ abort();
+ }
+
+ ima.init_(make::box2d(nrows, ncols));
+ if (type == type_)
+ load_raw_2d(file, ima);
+ else
+ if (type == (type_ - 3))
+ pnm::load_ascii(file, ima);
+
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::pnm
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+
+#endif // ! MLN_IO_PNM_LOAD_HH
Index: trunk/milena/mln/io/ppm/all.hh
===================================================================
--- trunk/milena/mln/io/ppm/all.hh (revision 0)
+++ trunk/milena/mln/io/ppm/all.hh (revision 1346)
@@ -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_PPM_ALL_HH
+# define MLN_IO_PPM_ALL_HH
+
+/*! \file mln/io/ppm/all.hh
+ *
+ * \brief File that includes all ppm io materials.
+ */
+
+
+namespace mln
+{
+
+ namespace io
+ {
+ /// Namespace of ppm input/output handling.
+ namespace ppm {}
+ }
+
+}
+
+# include <mln/io/ppm/load.hh>
+# include <mln/io/ppm/save.hh>
+
+#endif // ! MLN_IO_PPM_ALL_HH
Index: trunk/milena/mln/io/ppm/save.hh
===================================================================
--- trunk/milena/mln/io/ppm/save.hh (revision 1345)
+++ trunk/milena/mln/io/ppm/save.hh (revision 1346)
@@ -41,7 +41,7 @@
# include <mln/metal/templated_by.hh>
-# include <mln/io/internal/pnm/save.hh>
+# include <mln/io/pnm/save.hh>
namespace mln
{
@@ -64,7 +64,7 @@
mln::metal::templated_by<mln_value(I), value::rgb >::check();
//call the generic function for pnm files
- io::internal::pnm::save(PPM, exact(ima), filename);
+ io::pnm::save(PPM, exact(ima), filename);
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/io/ppm/load.hh
===================================================================
--- trunk/milena/mln/io/ppm/load.hh (revision 1345)
+++ trunk/milena/mln/io/ppm/load.hh (revision 1346)
@@ -44,7 +44,7 @@
# include <mln/core/image2d.hh>
# include <mln/value/rgb8.hh>
-# include <mln/io/internal/pnm/load.hh>
+# include <mln/io/pnm/load.hh>
namespace mln
{
@@ -57,7 +57,7 @@
template <typename V>
image2d<V> load(const std::string& filename)
{
- return io::internal::pnm::load<V>(PPM, filename);
+ return io::pnm::load<V>(PPM, filename);
}
image2d<value::rgb8> load(const std::string& filename)
@@ -69,7 +69,7 @@
void load(Image<I>& ima,
const std::string& filename)
{
- io::internal::pnm::load<I>(PPM, ima, filename);
+ io::pnm::load<I>(PPM, ima, filename);
}
} // end of namespace mln::io::ppm
Index: trunk/milena/mln/io/internal/abort.hh (deleted)
===================================================================
Index: trunk/milena/mln/io/pbm/all.hh
===================================================================
--- trunk/milena/mln/io/pbm/all.hh (revision 0)
+++ trunk/milena/mln/io/pbm/all.hh (revision 1346)
@@ -0,0 +1,58 @@
+// 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_PBM_ALL_HH
+# define MLN_IO_PBM_ALL_HH
+
+/*! \file mln/io/pbm/all.hh
+ *
+ * \brief File that includes all pbm io materials.
+ */
+
+
+namespace mln
+{
+
+ namespace io
+ {
+ /// Namespace of pbm input/output handling.
+ namespace pbm
+ {
+ /// Namespace of pbm's implementation details.
+ namespace impl {}
+
+ /// Internal namespace of pbm namespace.
+ namespace internal {}
+ }
+ }
+
+}
+
+# include <mln/io/pbm/load.hh>
+# include <mln/io/pbm/save.hh>
+
+#endif // ! MLN_IO_PBM_ALL_HH
Index: trunk/milena/mln/io/pbm/save.hh
===================================================================
--- trunk/milena/mln/io/pbm/save.hh (revision 1345)
+++ trunk/milena/mln/io/pbm/save.hh (revision 1346)
@@ -44,7 +44,7 @@
# include <mln/metal/equal.hh>
# include <mln/metal/bexpr.hh>
-# include <mln/io/internal/pnm/save.hh>
+# include <mln/io/pnm/save.hh>
namespace mln
@@ -78,7 +78,7 @@
const I& ima = exact(ima_);
std::ofstream file(filename.c_str());
- io::internal::pnm::save_header(PBM, ima, filename, file);
+ io::pnm::save_header(PBM, ima, filename, file);
const int
min_row = geom::min_row(ima),
Index: trunk/milena/mln/io/pbm/load.hh
===================================================================
--- trunk/milena/mln/io/pbm/load.hh (revision 1345)
+++ trunk/milena/mln/io/pbm/load.hh (revision 1346)
@@ -43,7 +43,7 @@
# include <string>
# include <mln/core/image2d.hh>
-# include <mln/io/internal/pnm/load_header.hh>
+# include <mln/io/pnm/load_header.hh>
namespace mln
{
@@ -113,7 +113,7 @@
}
char type;
int nrows, ncols;
- io::internal::pnm::read_header('1', '4', file, type, nrows,
ncols);
+ io::pnm::read_header('1', '4', file, type, nrows, ncols);
image2d<bool> ima(nrows, ncols);
if (type == '4')
Index: trunk/milena/mln/canvas/morpho/all.hh
===================================================================
--- trunk/milena/mln/canvas/morpho/all.hh (revision 0)
+++ trunk/milena/mln/canvas/morpho/all.hh (revision 1346)
@@ -0,0 +1,50 @@
+// 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_CANVAS_MORPHO_ALL_HH
+# define MLN_CANVAS_MORPHO_ALL_HH
+
+/*! \file mln/canvas/morpho/all.hh
+ *
+ * \brief File that includes morphological canvas-related routines.
+ */
+
+
+namespace mln
+{
+
+ namespace canvas
+ {
+ /// Namespace of morphological canvas.
+ namespace morpho {}
+ }
+
+}
+
+# include <mln/canvas/morpho/algebraic_union_find.hh>
+
+#endif // ! MLN_CANVAS_MORPHO_ALL_HH
Index: trunk/milena/mln/canvas/all.hh
===================================================================
--- trunk/milena/mln/canvas/all.hh (revision 0)
+++ trunk/milena/mln/canvas/all.hh (revision 1346)
@@ -0,0 +1,54 @@
+// 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_CANVAS_ALL_HH
+# define MLN_CANVAS_ALL_HH
+
+/*! \file mln/canvas/all.hh
+ *
+ * \brief File that includes all canvas-related routines.
+ */
+
+
+namespace mln
+{
+
+ /// Namespace of canvas.
+ namespace canvas
+ {
+ /// Implementation namespace of canvas namespace.
+ namespace impl {}
+ }
+
+}
+
+# include <mln/canvas/browsing/all.hh>
+# include <mln/canvas/morpho/all.hh>
+# include <mln/canvas/champfer.hh>
+# include <mln/canvas/labeling.hh>
+
+#endif // ! MLN_CANVAS_ALL_HH
Index: trunk/milena/mln/canvas/browsing/all.hh
===================================================================
--- trunk/milena/mln/canvas/browsing/all.hh (revision 0)
+++ trunk/milena/mln/canvas/browsing/all.hh (revision 1346)
@@ -0,0 +1,53 @@
+// 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_CANVAS_BROWSING_ALL_HH
+# define MLN_CANVAS_BROWSING_ALL_HH
+
+/*! \file mln/canvas/browsing/all.hh
+ *
+ * \brief File that includes all browsing canvas-related routines.
+ */
+
+
+namespace mln
+{
+
+ namespace canvas
+ {
+ /// Namespace of browsing canvas.
+ namespace browsing {}
+ }
+
+}
+
+# include <mln/canvas/browsing/directional.hh>
+# include <mln/canvas/browsing/dir_ricard51.hh>
+# include <mln/canvas/browsing/fwd.hh>
+# include <mln/canvas/browsing/snake_fwd.hh>
+
+#endif // ! MLN_CANVAS_BROWSING_ALL_HH