URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Update io tests due to moves.
* mln/io/fits/load.hh: Remove debug.
* mln/io/pfm/load.hh,
* mln/io/pfm/save.hh: Fix a bug : the last line wasn't read/written.
* tests/io/fits/Makefile.am: Remove spaces.
* tests/io/pgm/Makefile.am: Add the variable TEST.
* tests/io/pbm/pbm.cc,
* tests/io/pgm/pgm.cc,
* tests/io/pgm/pgm16.cc,
* tests/io/pgm/pgm19.cc,
* tests/io/pgm/pgm27.cc,
* tests/io/ppm/Makefile.am,
* tests/io/ppm/ppm.cc: Update the path of the tests image
* tests/io/fits/io_fits.cc: Rename as...
* tests/io/fits/fits.cc: ...this.
---
mln/io/fits/load.hh | 5 ---
mln/io/pfm/load.hh | 2 -
mln/io/pfm/save.hh | 2 -
mln/io/pnm/save_header.hh | 1
tests/io/fits/fits.cc | 63 ++++++++++++++++++++++++++++++++++++++++++++++
tests/io/pbm/pbm.cc | 7 ++++-
tests/io/pgm/Makefile.am | 1
tests/io/pgm/pgm.cc | 16 +++++++++--
tests/io/pgm/pgm16.cc | 2 -
tests/io/pgm/pgm19.cc | 2 -
tests/io/pgm/pgm27.cc | 2 -
tests/io/ppm/Makefile.am | 1
tests/io/ppm/ppm.cc | 6 +++-
13 files changed, 95 insertions(+), 15 deletions(-)
Index: trunk/milena/tests/io/pgm/pgm27.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm27.cc (revision 1541)
+++ trunk/milena/tests/io/pgm/pgm27.cc (revision 1542)
@@ -74,7 +74,7 @@
typedef value::int_u<27> int_u27;
image2d<int_u8>
- lena = io::pgm::load<int_u8>("../img/lena.pgm");
+ lena = io::pgm::load<int_u8>("../../../img/lena.pgm");
image2d<int_u27> out(lena.domain());
level::transform(lena, to27bits(), out);
Index: trunk/milena/tests/io/pgm/pgm19.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm19.cc (revision 1541)
+++ trunk/milena/tests/io/pgm/pgm19.cc (revision 1542)
@@ -75,7 +75,7 @@
border::thickness = 52;
image2d<int_u8>
- lena = io::pgm::load<int_u8>("../img/lena.pgm");
+ lena = io::pgm::load<int_u8>("../../../img/lena.pgm");
image2d<int_u19> out(lena.domain());
level::transform(lena, to19bits(), out);
Index: trunk/milena/tests/io/pgm/pgm.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm.cc (revision 1541)
+++ trunk/milena/tests/io/pgm/pgm.cc (revision 1542)
@@ -38,6 +38,8 @@
#include <mln/io/pgm/load.hh>
#include <mln/io/pgm/save.hh>
+#include <mln/level/compare.hh>
+
int main()
{
using namespace mln;
@@ -45,18 +47,26 @@
{
image2d<int_u8>
- lena = io::pgm::load<int_u8>("../img/lena.pgm");
+ lena = io::pgm::load<int_u8>("../../../img/lena.pgm");
io::pgm::save(lena, "out.pgm");
+
+ image2d<int_u8>
+ lena2 = io::pgm::load<int_u8>("out.pgm");
+
+ mln_assertion(lena2 == lena);
}
{
image2d< value::int_u<8> >
- lena;
- io::pgm::load(lena, "../img/lena.pgm");
+ lena, lena2;
+ io::pgm::load(lena, "../../../img/lena.pgm");
io::pgm::save(lena, "out.pgm");
+
+ io::pgm::load(lena2, "out.pgm");
+ mln_assertion(lena2 == lena);
}
}
Index: trunk/milena/tests/io/pgm/Makefile.am
===================================================================
--- trunk/milena/tests/io/pgm/Makefile.am (revision 1541)
+++ trunk/milena/tests/io/pgm/Makefile.am (revision 1542)
@@ -13,3 +13,4 @@
pgm27_SOURCES = pgm27.cc
pgm_SOURCES = pgm.cc
+TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/io/pgm/pgm16.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm16.cc (revision 1541)
+++ trunk/milena/tests/io/pgm/pgm16.cc (revision 1542)
@@ -76,7 +76,7 @@
border::thickness = 52;
image2d<int_u8>
- lena = io::pgm::load<int_u8>("../img/lena.pgm");
+ lena = io::pgm::load<int_u8>("../../../img/lena.pgm");
image2d<int_u16> out(lena.domain());
level::transform(lena, to16bits(), out);
Index: trunk/milena/tests/io/fits/io_fits.cc (deleted)
===================================================================
Index: trunk/milena/tests/io/fits/fits.cc
===================================================================
--- trunk/milena/tests/io/fits/fits.cc (revision 0)
+++ trunk/milena/tests/io/fits/fits.cc (revision 1542)
@@ -0,0 +1,63 @@
+// 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.
+
+/*! \file tests/fits_load.cc
+ *
+ * \brief Test on mln::io::fits::load.
+ */
+
+#include <mln/core/image2d.hh>
+
+#include <mln/level/compare.hh>
+#include <mln/debug/println.hh>
+
+#include <mln/io/fits/load.hh>
+#include <mln/io/pfm/save.hh>
+#include <mln/io/pfm/load.hh>
+
+int main()
+{
+ using namespace mln;
+ {
+ image2d<float>
+ fits_in = io::fits::load("../../../img/test.fits");
+
+ io::pfm::save(fits_in, "out.pfm");
+
+ image2d<float>
+ pfm = io::pfm::load("out.pfm");
+
+ mln_assertion(pfm == fits_in);
+
+ io::pfm::save(fits_in, "out2.pfm");
+
+ image2d<float>
+ pfm2 = io::pfm::load("out2.pfm");
+
+ mln_assertion(fits_in == pfm2);
+ }
+}
Index: trunk/milena/tests/io/fits/Makefile.am
===================================================================
Index: trunk/milena/tests/io/ppm/ppm.cc
===================================================================
--- trunk/milena/tests/io/ppm/ppm.cc (revision 1541)
+++ trunk/milena/tests/io/ppm/ppm.cc (revision 1542)
@@ -36,6 +36,8 @@
#include <mln/io/ppm/load.hh>
#include <mln/io/ppm/save.hh>
+#include <mln/level/compare.hh>
+
@@ -44,6 +46,8 @@
using namespace mln;
using value::rgb8;
- image2d<rgb8> lena = io::ppm::load("../img/lena.ppm");
+ image2d<rgb8> lena = io::ppm::load("../../../img/lena.ppm");
io::ppm::save(lena, "out.ppm");
+ image2d<rgb8> lena2 = io::ppm::load("out.ppm");
+ mln_assertion(lena2 == lena);
}
Index: trunk/milena/tests/io/ppm/Makefile.am
===================================================================
--- trunk/milena/tests/io/ppm/Makefile.am (revision 1541)
+++ trunk/milena/tests/io/ppm/Makefile.am (revision 1542)
@@ -11,5 +11,4 @@
ppm23_SOURCES = ppm23.cc
ppm_SOURCES = ppm.cc
-
TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/io/pbm/pbm.cc
===================================================================
--- trunk/milena/tests/io/pbm/pbm.cc (revision 1541)
+++ trunk/milena/tests/io/pbm/pbm.cc (revision 1542)
@@ -34,13 +34,18 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/pbm/save.hh>
+#include <mln/level/compare.hh>
+
int main()
{
using namespace mln;
- image2d<bool> pic = io::pbm::load("../img/picasso.pbm");
+ image2d<bool> pic = io::pbm::load("../../../img/picasso.pbm");
io::pbm::save(pic, "pic.pbm");
+ image2d<bool> pic2 = io::pbm::load("pic.pbm");
+
+ mln_assertion(pic == pic2);
}
Index: trunk/milena/mln/io/pfm/save.hh
===================================================================
--- trunk/milena/mln/io/pfm/save.hh (revision 1541)
+++ trunk/milena/mln/io/pfm/save.hh (revision 1542)
@@ -85,7 +85,7 @@
//image2d<float>& ima_ = const_cast< image2d<float>&
>(ima);
point2d p(make::point2d(0, 0));
- for (p.row() = min_row; p.row() < max_row; ++p.row())
+ for (p.row() = min_row; p.row() <= max_row; ++p.row())
file.write((const char*)(&(ima(p))),
sizeof(float) * ncols);
file.close();
Index: trunk/milena/mln/io/pfm/load.hh
===================================================================
--- trunk/milena/mln/io/pfm/load.hh (revision 1541)
+++ trunk/milena/mln/io/pfm/load.hh (revision 1542)
@@ -110,7 +110,7 @@
unsigned int
ncols = geom::ncols(ima);
- for (p.row() = min_row; p.row() < max_row; ++p.row())
+ for (p.row() = min_row; p.row() <= max_row; ++p.row())
file.read((char*)(&(ima(p))),
sizeof(float) * ncols);
Index: trunk/milena/mln/io/fits/load.hh
===================================================================
--- trunk/milena/mln/io/fits/load.hh (revision 1541)
+++ trunk/milena/mln/io/fits/load.hh (revision 1542)
@@ -43,7 +43,7 @@
# include <mln/core/image2d.hh>
# include <mln/value/int_u8.hh>
-# include <mln/io/fitsio.h>
+# include <fitsio.h>
namespace mln
{
@@ -79,9 +79,6 @@
const int ncols = naxes[0], nrows = naxes[1];
- std::cout << "ncols : " << ncols
- << "nrows : " << nrows << std::endl;
-
image2d<float> output(nrows, ncols);
nullval = 0; // don't check null values
Index: trunk/milena/mln/io/pnm/save_header.hh
===================================================================
--- trunk/milena/mln/io/pnm/save_header.hh (revision 1541)
+++ trunk/milena/mln/io/pnm/save_header.hh (revision 1542)
@@ -69,6 +69,7 @@
void save_max_val(value::rgb<n>&, std::ofstream& file)
{
typedef typename value::int_u<n>::enc E;
+
file << unsigned(mln_max(E)) << std::endl;
}