* mln/io/all.hh: update.
* mln/io/fits/load.hh,
* mln/io/pbm/load.hh,
* mln/io/pbm/save.hh,
* mln/io/pfm/load.hh,
* mln/io/pfm/save.hh,
* mln/io/pgm/load.hh,
* mln/io/pgm/save.hh,
* mln/io/pnm/save.hh,
* mln/io/ppm/load.hh,
* mln/io/ppm/save.hh: Update copyright.
* mln/io/txt/save.hh: save an image<char> to a txt file.
* mln/io/off/all.hh,
* mln/io/txt/all.hh: new missing 'all' headers.
---
milena/ChangeLog | 22 +++++++++++++
milena/mln/io/all.hh | 2 +
milena/mln/io/fits/load.hh | 2 +-
milena/mln/io/{ => off}/all.hh | 25 ++++++---------
milena/mln/io/pbm/load.hh | 2 +-
milena/mln/io/pbm/save.hh | 2 +-
milena/mln/io/pfm/load.hh | 2 +-
milena/mln/io/pfm/save.hh | 2 +-
milena/mln/io/pgm/load.hh | 2 +-
milena/mln/io/pgm/save.hh | 2 +-
milena/mln/io/pnm/save.hh | 2 +-
milena/mln/io/ppm/load.hh | 2 +-
milena/mln/io/ppm/save.hh | 2 +-
milena/mln/io/{ => txt}/all.hh | 24 +++++---------
milena/mln/io/{ppm => txt}/save.hh | 59 +++++++++++++++++++++++-------------
15 files changed, 91 insertions(+), 61 deletions(-)
copy milena/mln/io/{ => off}/all.hh (72%)
copy milena/mln/io/{ => txt}/all.hh (72%)
copy milena/mln/io/{ppm => txt}/save.hh (61%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c1f5639..82589d5 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,27 @@
2008-11-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add io::txt::save.
+
+ * mln/io/all.hh: update.
+
+ * mln/io/fits/load.hh,
+ * mln/io/pbm/load.hh,
+ * mln/io/pbm/save.hh,
+ * mln/io/pfm/load.hh,
+ * mln/io/pfm/save.hh,
+ * mln/io/pgm/load.hh,
+ * mln/io/pgm/save.hh,
+ * mln/io/pnm/save.hh,
+ * mln/io/ppm/load.hh,
+ * mln/io/ppm/save.hh: Update copyright.
+
+ * mln/io/txt/save.hh: save an image<char> to a txt file.
+
+ * mln/io/off/all.hh,
+ * mln/io/txt/all.hh: new missing 'all' headers.
+
+2008-11-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add debug::colorize.
* mln/debug/colorize.hh: create a color image from a labeled image.
diff --git a/milena/mln/io/all.hh b/milena/mln/io/all.hh
index 7a93964..51ddbb2 100644
--- a/milena/mln/io/all.hh
+++ b/milena/mln/io/all.hh
@@ -47,10 +47,12 @@ namespace mln
}
# include <mln/io/fits/all.hh>
+# include <mln/io/off/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>
+# include <mln/io/txt/all.hh>
#endif // ! MLN_IO_ALL_HH
diff --git a/milena/mln/io/fits/load.hh b/milena/mln/io/fits/load.hh
index 4cbf0b8..c09536c 100644
--- a/milena/mln/io/fits/load.hh
+++ b/milena/mln/io/fits/load.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/all.hh b/milena/mln/io/off/all.hh
similarity index 72%
copy from milena/mln/io/all.hh
copy to milena/mln/io/off/all.hh
index 7a93964..bfcc080 100644
--- a/milena/mln/io/all.hh
+++ b/milena/mln/io/off/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,32 +25,27 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_IO_ALL_HH
-# define MLN_IO_ALL_HH
+#ifndef MLN_IO_OFF_ALL_HH
+# define MLN_IO_OFF_ALL_HH
-/*! \file mln/io/all.hh
+/*! \file mln/io/off/all.hh
*
- * \brief File that includes all io materials.
+ * \brief File that includes all off io materials.
*/
namespace mln
{
- /// Namespace of input/output handling.
namespace io
{
- /// Internal namespace of io namespace.
- namespace internal {}
+ /// Namespace of off input/output handling.
+ namespace off {}
}
}
-# 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>
+# include <mln/io/off/load.hh>
+# include <mln/io/off/save.hh>
-#endif // ! MLN_IO_ALL_HH
+#endif // ! MLN_IO_OFF_ALL_HH
diff --git a/milena/mln/io/pbm/load.hh b/milena/mln/io/pbm/load.hh
index 40c6086..b2ba586 100644
--- a/milena/mln/io/pbm/load.hh
+++ b/milena/mln/io/pbm/load.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/pbm/save.hh b/milena/mln/io/pbm/save.hh
index 93d4485..5f5811a 100644
--- a/milena/mln/io/pbm/save.hh
+++ b/milena/mln/io/pbm/save.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/pfm/load.hh b/milena/mln/io/pfm/load.hh
index 35f5e54..96bc20d 100644
--- a/milena/mln/io/pfm/load.hh
+++ b/milena/mln/io/pfm/load.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/pfm/save.hh b/milena/mln/io/pfm/save.hh
index 486639e..53f18e6 100644
--- a/milena/mln/io/pfm/save.hh
+++ b/milena/mln/io/pfm/save.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/pgm/load.hh b/milena/mln/io/pgm/load.hh
index e7df29e..a82f5b5 100644
--- a/milena/mln/io/pgm/load.hh
+++ b/milena/mln/io/pgm/load.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/pgm/save.hh b/milena/mln/io/pgm/save.hh
index b02576d..f15c0eb 100644
--- a/milena/mln/io/pgm/save.hh
+++ b/milena/mln/io/pgm/save.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/pnm/save.hh b/milena/mln/io/pnm/save.hh
index b09465c..5c52fc4 100644
--- a/milena/mln/io/pnm/save.hh
+++ b/milena/mln/io/pnm/save.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/ppm/load.hh b/milena/mln/io/ppm/load.hh
index f97700b..bf9d27b 100644
--- a/milena/mln/io/ppm/load.hh
+++ b/milena/mln/io/ppm/load.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/ppm/save.hh b/milena/mln/io/ppm/save.hh
index c10f3ca..3893203 100644
--- a/milena/mln/io/ppm/save.hh
+++ b/milena/mln/io/ppm/save.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
diff --git a/milena/mln/io/all.hh b/milena/mln/io/txt/all.hh
similarity index 72%
copy from milena/mln/io/all.hh
copy to milena/mln/io/txt/all.hh
index 7a93964..ce00758 100644
--- a/milena/mln/io/all.hh
+++ b/milena/mln/io/txt/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,32 +25,26 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_IO_ALL_HH
-# define MLN_IO_ALL_HH
+#ifndef MLN_IO_TXT_ALL_HH
+# define MLN_IO_TXT_ALL_HH
-/*! \file mln/io/all.hh
+/*! \file mln/io/txt/all.hh
*
- * \brief File that includes all io materials.
+ * \brief File that includes all txt io materials.
*/
namespace mln
{
- /// Namespace of input/output handling.
namespace io
{
- /// Internal namespace of io namespace.
- namespace internal {}
+ /// Namespace of txt input/output handling.
+ namespace txt {}
}
}
-# 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>
+# include <mln/io/txt/save.hh>
-#endif // ! MLN_IO_ALL_HH
+#endif // ! MLN_IO_TXT_ALL_HH
diff --git a/milena/mln/io/ppm/save.hh b/milena/mln/io/txt/save.hh
similarity index 61%
copy from milena/mln/io/ppm/save.hh
copy to milena/mln/io/txt/save.hh
index c10f3ca..ad5713b 100644
--- a/milena/mln/io/ppm/save.hh
+++ b/milena/mln/io/txt/save.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 EPITA
+// Copyright (C) 2008 EPITA
// Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
@@ -26,22 +26,24 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_IO_PPM_SAVE_HH
-# define MLN_IO_PPM_SAVE_HH
+#ifndef MLN_IO_TXT_SAVE_HH
+# define MLN_IO_TXT_SAVE_HH
/*!
- * \file mln/io/ppm/save.hh
+ * \file mln/io/txt/save.hh
*
- * \brief Define a function which saves an image of kind ppm into
+ * \brief Define a function which saves an image of kind TXT into
* given path.
*
*/
+# include <iostream>
+# include <fstream>
+
# include <mln/core/concept/image.hh>
-# include <mln/metal/templated_by.hh>
+# include <mln/metal/is.hh>
-# include <mln/io/pnm/save.hh>
namespace mln
{
@@ -49,37 +51,52 @@ namespace mln
namespace io
{
- namespace ppm
+ namespace txt
{
- /*! Save a Milena image as a ppm image.
+ /*! Save a Milena image as a txt image.
*
- * \param[in] ima The image to save.
- * \param[in,out] filename the destination.
+ * \param[in] ima_ The image to save. Must be an image of char.
+ * \param[in] filename the destination.
*/
- template <typename I>
- void save(const Image<I>& ima, const std::string& filename);
+ void
+ save(const image2d<char>& ima, const std::string& filename);
# ifndef MLN_INCLUDE_ONLY
- template <typename I>
inline
- void save(const Image<I>& ima, const std::string& filename)
+ void
+ save(const image2d<char>& ima, const std::string& filename)
{
- mln::metal::templated_by<mln_value(I), value::rgb >::check();
-
- //call the generic function for pnm files
- io::pnm::save(PPM, exact(ima), filename);
+ trace::entering("mln::io::txt::save");
+
+ mln_precondition(ima.has_data());
+ std::ofstream ostr(filename.c_str());
+ unsigned col = 0;
+ typedef image2d<char> I;
+ mln_piter_(I) p(ima.domain());
+ for_all(p)
+ {
+ ostr << ima(p);
+ if (++col == ima.ncols())
+ {
+ ostr << std::endl;
+ col = 0;
+ }
+ }
+ ostr.close();
+
+ trace::exiting("mln::io::txt::save");
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::ppm
+ } // end of namespace mln::io::txt
} // end of namespace mln::io
} // end of namespace mln
-#endif // ! MLN_IO_PPM_SAVE_HH
+#endif // ! MLN_IO_TXT_SAVE_HH
--
1.5.6.5