Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
November 2007
- 9 participants
- 147 discussions
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-27 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fix a bug in p(g|p)m load.
* mln/io/pnm/load.hh: (load(image&, filename)) now work on rgb images.
* mln/io/pnm/max_component.hh: Define a function which give the max of
the component of a value type.
* tests/io/pgm/pgm16.cc: Now test the other way to load an image
(load(image&, filename)).
* tests/io/ppm/ppm16.cc: likewise.
* img/lena_16.ppm: New, lena, ppm 16 bits.
---
mln/io/pnm/load.hh | 12 ++++--
mln/io/pnm/max_component.hh | 77 ++++++++++++++++++++++++++++++++++++++++++++
tests/io/pgm/pgm16.cc | 12 ++++++
tests/io/ppm/ppm16.cc | 12 ++++++
4 files changed, 107 insertions(+), 6 deletions(-)
Index: trunk/milena/tests/io/pgm/pgm16.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm16.cc (revision 1547)
+++ trunk/milena/tests/io/pgm/pgm16.cc (revision 1548)
@@ -72,6 +72,7 @@
using value::int_u8;
using value::int_u16;
+ {
win::rectangle2d rect(51, 51);
border::thickness = 52;
@@ -90,6 +91,17 @@
level::transform(lena2, to8bits(), out2);
io::pgm::save(out2, "out8.pgm");
+ }
+ {
+ // Abort
+// image2d< value::int_u<8> > a;
+// io::pgm::load(a, "out16.pgm");
+
+ image2d< value::int_u<16> > b;
+ io::pgm::load(b, "out16.pgm");
+
+ }
+
}
Index: trunk/milena/tests/io/ppm/ppm16.cc
===================================================================
--- trunk/milena/tests/io/ppm/ppm16.cc (revision 1547)
+++ trunk/milena/tests/io/ppm/ppm16.cc (revision 1548)
@@ -78,7 +78,7 @@
typedef image2d<rgb8> I;
-
+ {
// load a 8bits image A
image2d<rgb8>
a = io::ppm::load<rgb8>("../../../img/lena.ppm");
@@ -106,5 +106,15 @@
// D should equals A
mln_assertion(d == a);
+ }
+
+ {
+ // Abort
+// image2d<rgb8> a;
+// io::ppm::load(a, "../../../img/lena_16.ppm");
+ image2d< value::rgb<16> > b;
+ io::ppm::load(b, "../../../img/lena_16.ppm");
+
+ }
}
Index: trunk/milena/mln/io/pnm/max_component.hh
===================================================================
--- trunk/milena/mln/io/pnm/max_component.hh (revision 0)
+++ trunk/milena/mln/io/pnm/max_component.hh (revision 1548)
@@ -0,0 +1,77 @@
+// 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_MAX_COMPONENT_HH
+# define MLN_IO_PNM_MAX_COMPONENT_HH
+
+/*!
+ * \file mln/io/pnm/max_component.hh
+ *
+ * \brief Define a function which give the max of the component of a
+ * value type.
+ */
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace pnm
+ {
+ template <typename V>
+ unsigned int max_component();
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename V>
+ unsigned int max_component(const V&)
+ {
+ return mln_max(V);
+ }
+
+# ifdef MLN_VALUE_RGB_HH
+
+ template <unsigned n>
+ unsigned int max_component(const mln::value::rgb<n>&)
+ {
+ return mln_max( mln::value::int_u<n> );
+ }
+
+# endif
+
+# 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/pnm/load.hh
===================================================================
--- trunk/milena/mln/io/pnm/load.hh (revision 1547)
+++ trunk/milena/mln/io/pnm/load.hh (revision 1548)
@@ -46,6 +46,7 @@
# include <mln/value/rgb.hh>
# include <mln/io/pnm/load_header.hh>
+# include <mln/io/pnm/max_component.hh>
# include <mln/io/pnm/macros.hh>
namespace mln
@@ -189,15 +190,16 @@
read_header(type_ - 3, type_, file, type,
nrows, ncols, maxval);
- if (mln_max(mln_value(I)) != maxval)
+ if (max_component(mln_value(I)()) != maxval)
{
- std::cerr << "max ref : " << mln_max(mln_value(I))
- << "max image : " << maxval
- << std::endl;
-
std::cerr << "error: file '" << filename
<< "' cannot be loaded into this type of image"
<< std::endl;
+
+ std::cerr << "input image have " << maxval
+ << " as maximum value while the destination's one is "
+ << max_component(mln_value(I)()) << "."
+ << std::endl;
abort();
}
Index: trunk/milena/img/lena_16.ppm
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/milena/img/lena_16.ppm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk
OK to apply?
(Use Reply-All, I'm not subscribed to this ML, thanks)
ChangeLog:
2007-11-27 Benoit Sigoure <tsuna(a)lrde.epita.fr>
Fix typos in the tutorial.
* milena/doc/tutorial/slides.tex: Various typos everywhere.
---
slides.tex | 47 ++++++++++++++++++++++++-----------------------
1 files changed, 24 insertions(+), 23 deletions(-)
Index: milena/doc/tutorial/slides.tex
===================================================================
--- milena/doc/tutorial/slides.tex (revision 1543)
+++ milena/doc/tutorial/slides.tex (working copy)
@@ -243,7 +243,7 @@
\item Many libraries exist that can fulfill one's needs.
\item If you're happy with your favorite tool, we cannot force you
to change for \mln...
- \item Though, you might have a look at \mln and being seduced!
+ \item Though, you might have a look at \mln and be seduced!
\end{itemize}
\end{block}
@@ -253,7 +253,7 @@
\begin{block}{No!}
\begin{itemize}
\item \mln is rather different than available libraries.
- \item A lot of convenient data structures that \emph{really} helps
+ \item A lot of convenient data structures that \emph{really} help
you in developing IP solutions.
\end{itemize}
\end{block}
@@ -310,7 +310,8 @@
\smallskip
\begin{lstlisting}[basicstyle={\tiny\sffamily}]
template <typename I, typename H>
-void transform_inplace(Image<I>& f_, const Function_v2v<H>& h_)
+void transform_inplace(Image<I>& f_,
+ const Function_v2v<H>& h_)
{
I& f = exact(f);
const H& h = exact(h_);
@@ -361,7 +362,7 @@
%........................................................................
\begin{frame}%[<+->]
- \frametitle{What's In a Library}
+ \frametitle{What's In The Library}
\begin{itemize}
\item algorithms:\\
@@ -389,7 +390,7 @@
\begin{itemize}
\item Generic...
\item Efficient so that one can process large images.
- \item Quite as easy to use as a C or Java library.
+ \item Almost as easy to use as a C or Java library.
\item Many tools to help writing readable algorithms in a concise way.
\end{itemize}
@@ -552,7 +553,7 @@
\texttt{arith} & arithmetical operators \\
\texttt{border} & routines about virtual border &
\texttt{canvas} & canvases \\
-\texttt{convert} & conversions routines &
+\texttt{convert} & conversion routines &
\texttt{core} & the library core \\
\texttt{debug} & debugging tools &
\texttt{display} & display tools \\
@@ -605,7 +606,7 @@
not on implementation details about how to do it
\smallskip
%
- \item you do not have found yet a library to easily process your
+ \item you have not yet found a library to easily process your
particular types of data
\end{itemize}
@@ -824,9 +825,9 @@
\begin{frame}[fragile]
\frametitle{Modifying the State of an Object (2/2)}
- accessing and modifying through method calls allow some control:
+ accessing and modifying through method calls allows for some control:
\begin{itemize}
- \item one cannot do everything with an object
+ \item one cannot do anything with an object
\item especially putting it in an invalid state
\end{itemize}
@@ -888,7 +889,7 @@
\begin{itemize}
\item no need to take the address (with \&) of an object
\item no pointer arithmetics
- \item no $->$ in use
+ \item no $->$ to access members
\end{itemize}
\item it \emph{always} designates the same object
\begin{itemize}
@@ -995,7 +996,7 @@
accessible from the user
\begin{itemize}
\item thanks to the keyword \kw{private}
- \item writing \code{p.row\_} outside this class is not allowed (do
+ \item writing \code{p.row\_} outside this class is not allowed (does
not compile)
\end{itemize}
\smallskip
@@ -1003,7 +1004,7 @@
\item the method \code{row()} is accessible (keyword \kw{public})
\begin{itemize}
\item in the method body we have some room to add code
- \item a simple access to data can performs some clever stuff that
+ \item a simple access to data can perform some clever stuff that
you do not really have to know (neither want to)!
\end{itemize}
\end{itemize}
@@ -1121,7 +1122,7 @@
\end{lstlisting}
\begin{itemize}
-\item the variable \code{r} represents an object which type is
+\item the variable \code{r} represents an object the type of which is
precisely \code{rabbit}
\begin{center}
we say that it is the \emph{exact} type behind this variable
@@ -1165,7 +1166,7 @@
\item In that case
\begin{itemize}
\item at compile-time: there are many possible types of objects represented
- \item at run-time: there is one object represented so just type.
+ \item at run-time: there is one object represented so just one type.
\end{itemize}
\end{itemize}
@@ -1184,7 +1185,7 @@
About ``classical'' object-orientation:
\begin{itemize}
- \item abstractions (like \code{animal}) leads to poor
+ \item abstractions (like \code{animal}) lead to poor
performance at run-time when involved in intensive scientific code.
%
\item it is due to the fact that the exact type is lost\\
@@ -1340,7 +1341,7 @@
\begin{frame}[fragile]
\frametitle{A rationale for Genericity}
-Suppose that you want a routine that computes twice the input:
+Suppose that you want a routine that computes twice its input:
\begin{lstlisting}
int twice(int i) { return 2 * i; }
\end{lstlisting}
@@ -1434,7 +1435,7 @@
one of the procedure argument ``\code{(T t)}''
%
\item the nature of \code{t} is \code{T}, the nature of \code{T} is
- \code{typename} (so designates a type)
+ \code{typename} (so it designates a type)
%
\item the \cpp keyword introducing a generic piece of code is
\kw{template}
@@ -1476,7 +1477,7 @@
\item \code{int twice(int t) { return 2 * t; }} and
\item \code{float twice(float t) { return 2 * t; }}
\end{itemize}
-\item so it is not so different than with overloading
+\item so it is not so different than overloading
\end{itemize}
except that:
@@ -1762,7 +1763,7 @@
}
\end{lstlisting}
-How can we ensure that the delta-point type \code{D} really correspond
+How can we ensure that the delta-point type \code{D} really corresponds
to \code{P}? {\scriptsize (we really do not want \code{P} and
\code{D} resp. being \code{point3d} and \code{dpoint2d}!)}
@@ -1803,7 +1804,7 @@
}
\end{lstlisting}
-What is the problem? (Hint: read both signatures in natural language)
+What is the problem? (Hint: read both signatures out loud)
\end{frame}
@@ -1829,7 +1830,7 @@
\end{lstlisting}
which is clearly not ambiguous (but slow at run-time...)
-where \code{Dpoint} and \code{Image} are abstract class.
+where \code{Dpoint} and \code{Image} are abstract classes.
\end{frame}
@@ -2140,11 +2141,11 @@
\scriptsize{it works for any delta-point type}
\smallskip
%
-\item is fast
+\item is fast,
\scriptsize{you cannot get more efficient code}
\smallskip
%
-\item is user-friendly
+\item is user-friendly,
\scriptsize{just write ``\code{dp1 + dp2}'' to add a couple of delta-points}
\end{itemize}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fix a bug in int_u.
* mln/value/int_u.hh: Replace argument type by (unsigned int)
when it was (int).
(value_integer_::max()) : Replace card - 1 by mln_max(enc_) to avoid
returning -1 for high quantized values.
* tests/io/ppm/ppm16.cc,
* tests/io/ppm/ppm23.cc: Update the path of the input image.
---
mln/value/int_u.hh | 12 +++++++-----
tests/io/ppm/ppm16.cc | 2 +-
tests/io/ppm/ppm23.cc | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
Index: trunk/milena/tests/io/ppm/ppm23.cc
===================================================================
--- trunk/milena/tests/io/ppm/ppm23.cc (revision 1542)
+++ trunk/milena/tests/io/ppm/ppm23.cc (revision 1543)
@@ -81,7 +81,7 @@
// load a 8bits image A
image2d<rgb8>
- a = io::ppm::load<rgb8>("../img/lena.ppm");
+ a = io::ppm::load<rgb8>("../../../img/lena.ppm");
image2d<rgb23> b(a.domain());
image2d<rgb8>::fwd_piter p(b.domain());
Index: trunk/milena/tests/io/ppm/ppm16.cc
===================================================================
--- trunk/milena/tests/io/ppm/ppm16.cc (revision 1542)
+++ trunk/milena/tests/io/ppm/ppm16.cc (revision 1543)
@@ -81,7 +81,7 @@
// load a 8bits image A
image2d<rgb8>
- a = io::ppm::load<rgb8>("../img/lena.ppm");
+ a = io::ppm::load<rgb8>("../../../img/lena.ppm");
image2d<rgb16> b(a.domain());
image2d<rgb8>::fwd_piter p(b.domain());
Index: trunk/milena/mln/value/int_u.hh
===================================================================
--- trunk/milena/mln/value/int_u.hh (revision 1542)
+++ trunk/milena/mln/value/int_u.hh (revision 1543)
@@ -80,6 +80,7 @@
{
private:
typedef mln::value::int_u<n> self_;
+ typedef typename mln::value::internal::encoding_unsigned_<n>::ret enc_;
public:
enum {
@@ -92,7 +93,8 @@
typedef mln_value_quant_from_(card) quant;
static const self_ min() { return 0; }
- static const self_ max() { return card - 1; }
+ //FIXME : Is it too much or not? (the exact max is mlc_pow_int(2, n) )
+ static const self_ max() { return mln_max(enc_); }
static const self_ epsilon() { return 0; }
typedef float sum;
@@ -129,7 +131,7 @@
int_u();
/// Constructor from an integer.
- int_u(int i);
+ int_u(unsigned int i);
/// \{ Constructors/assignments with literals.
int_u(const literal::zero_t&);
@@ -145,7 +147,7 @@
int operator-() const;
/// Assignment from an integer.
- int_u<n>& operator=(int i);
+ int_u<n>& operator=(unsigned int i);
};
@@ -179,7 +181,7 @@
}
template <unsigned n>
- int_u<n>::int_u(int i)
+ int_u<n>::int_u(unsigned int i)
{
mln_precondition(i >= 0);
mln_precondition(unsigned(i) <= mln_max(enc_));
@@ -229,7 +231,7 @@
template <unsigned n>
int_u<n>&
- int_u<n>::operator=(int i)
+ int_u<n>::operator=(unsigned int i)
{
mln_precondition(i >= 0);
mln_precondition(unsigned(i) <= mln_max(enc_));
1
0
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;
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk
ChangeLog:
2007-11-26 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Fix bugs.
* milena/mln/display/color_pretty.hh: Fix warning.
* milena/tests/Makefile.am: Add util and display directory.
* milena/tests/util/Makefile.am: Fix compile bug.
---
mln/display/color_pretty.hh | 2 --
tests/Makefile.am | 2 ++
tests/util/Makefile.am | 4 +---
3 files changed, 3 insertions(+), 5 deletions(-)
Index: trunk/milena/tests/Makefile.am
===================================================================
--- trunk/milena/tests/Makefile.am (revision 1540)
+++ trunk/milena/tests/Makefile.am (revision 1541)
@@ -7,12 +7,14 @@
accu \
border \
canvas \
+ display \
draw \
histo \
level \
logical \
norm \
set \
+ util \
win
check_PROGRAMS = \
Index: trunk/milena/tests/util/Makefile.am
===================================================================
--- trunk/milena/tests/util/Makefile.am (revision 1540)
+++ trunk/milena/tests/util/Makefile.am (revision 1541)
@@ -9,8 +9,7 @@
tree \
tree_fast \
tree_fast_to_image \
-tree_to_image \
-tree_fast_to_image
+tree_to_image
branch_iter_SOURCES = branch_iter.cc
@@ -22,7 +21,6 @@
tree_fast_SOURCES = tree_fast.cc
tree_fast_to_image_SOURCES = tree_to_image.cc
tree_to_image_SOURCES = tree_to_image.cc
-tree_fast_to_image_SOURCES = tree_fast_to_image.cc
TESTS = $(check_PROGRAMS)
Index: trunk/milena/mln/display/color_pretty.hh
===================================================================
--- trunk/milena/mln/display/color_pretty.hh (revision 1540)
+++ trunk/milena/mln/display/color_pretty.hh (revision 1541)
@@ -206,8 +206,6 @@
{
trace::entering("display::color_pretty_rgb");
- const I& input = exact(input_);
-
image2d<value::rgb8> output = impl::color_pretty_rgb(input_, s1_, s2_, s3_);
trace::exiting("display::color_pretty_rgb");
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-26 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Review util subdirectory.
* mln/util/branch_iter.hh,
* mln/util/branch_iter_ind.hh,
* mln/util/eat.hh,
* mln/util/graph.hh,
* mln/util/ignore.hh,
* mln/util/nil.hh,
* mln/util/pix.hh,
* mln/util/tree.hh,
* mln/util/tree_fast.hh,
* mln/util/tree_fast_to_image.hh,
* mln/util/tree_to_image.hh: Add doc, tracing, fix typo.
Tests
* tests/util/Makefile.am: Update tests.
* tests/util/tree_fast_to_image.cc: Fix this test.
* tests/util/graph.cc,
* tests/util/tree.cc,
* tests/util/tree_to_image.cc: Update.
---
mln/util/branch_iter.hh | 3
mln/util/branch_iter_ind.hh | 6 -
mln/util/eat.hh | 4
mln/util/graph.hh | 81 ++++++++++++++---
mln/util/ignore.hh | 4
mln/util/nil.hh | 4
mln/util/pix.hh | 40 ++++++++
mln/util/tree.hh | 184 +++++++++++++++++++++++++++++++++++----
mln/util/tree_fast.hh | 57 +++++++++++-
mln/util/tree_fast_to_image.hh | 28 +++++
mln/util/tree_to_image.hh | 132 +++++++++++++++++++--------
tests/util/Makefile.am | 4
tests/util/graph.cc | 1
tests/util/tree_fast_to_image.cc | 128 ++++++++++++---------------
tests/util/tree_to_image.cc | 17 +--
15 files changed, 535 insertions(+), 158 deletions(-)
Index: trunk/milena/tests/util/tree.cc
===================================================================
Index: trunk/milena/tests/util/tree_fast_to_image.cc
===================================================================
--- trunk/milena/tests/util/tree_fast_to_image.cc (revision 1539)
+++ trunk/milena/tests/util/tree_fast_to_image.cc (revision 1540)
@@ -26,21 +26,24 @@
// Public License.
/*!
- * \file tests/tree_fast_to_image.cc
+ * \file tests/util/tree_fast_to_image.cc
*
* \brief test of mln::util::tree_fast_to_image
*
*/
+#include <mln/util/tree_fast.hh>
#include <mln/core/contract.hh>
#include <mln/core/image2d.hh>
#include <mln/core/p_set.hh>
#include <mln/value/int_u8.hh>
#include <mln/level/stretch.hh>
+#include <mln/level/fill.hh>
+#include <mln/level/compare.hh>
#include <mln/io/pgm/save.hh>
#include <vector>
#include <mln/util/tree_fast_to_image.hh>
-#include <mln/util/tree_fast.hh>
+#include <mln/debug/println.hh>
template <typename P, typename V>
struct fllt_node
@@ -51,92 +54,83 @@
};
-template <typename P, typename V>
-bool operator==(const mln::p_set<P>& lhs, const mln::p_set<P>& rhs)
-{
- std::size_t n = lhs.npoints ();
- mln::p_set<P> tmp;
-
- if (n != rhs.npoints ())
- return false;
-
-// for (std::size_t i = 0; i < n; ++i)
-// if ()
-
-}
-
-template <typename P, typename V>
-bool operator==(const struct fllt_node<P,V>& lhs, const struct fllt_node<P,V>& rhs)
-{
- if (lhs.value != rhs.value)
- return false;
-
- /// FIXME
-
- if (!(lhs.points == rhs.points))
- return false;
-
- if (!(lhs.holes == rhs.holes))
- return false;
-
- return true;
-}
-
int main (void)
{
using namespace mln;
using value::int_u8;
- typedef p_set<point2d > I;
- typedef fllt_node<point2d, int_u8> T;
+ typedef fllt_node<point2d , int_u8> I;
+
- T s1;
- T s2;
- T s3;
- T s4;
- T s5;
- T s6;
- T s7;
+ I s1;
+ I s2;
+ I s3;
+ I s4;
+ I s5;
+ I s6;
+ I s7;
- for (int i = 0; i < 100; ++i)
- for (int j = 0; j < 100; ++j)
+ for (int i = 0; i < 4; ++i)
+ for (int j = 0; j < 4; ++j)
s1.points.insert(point2d(i, j));
s1.value = 60;
- for (int i = 200; i < 300; ++i)
- for (int j = 0; j < 100; ++j)
+ for (int i = 8; i < 16; ++i)
+ for (int j = 0; j < 4; ++j)
s2.points.insert(point2d(i, j));
- s2.value = 100;
- for (int i = 0; i < 100; ++i)
- for (int j = 0; j < 100; ++j)
+ s1.value = 100;
+ for (int i = 0; i < 4; ++i)
+ for (int j = 0; j < 4; ++j)
s3.points.insert(point2d(i, j));
s3.value = 110;
- for (int i = 260; i < 290; ++i)
- for (int j = 0; j < 50; ++j)
+ for (int i = 10; i < 12; ++i)
+ for (int j = 0; j < 2; ++j)
s4.points.insert(point2d(i, j));
s4.value = 170;
- for (int i = 200; i < 210; ++i)
- for (int j = 0; j < 50; ++j)
+ for (int i = 8; i < 16; ++i)
+ for (int j = 0; j < 2; ++j)
s5.points.insert(point2d(i, j));
s5.value = 180;
- for (int i = 270; i < 280; ++i)
- for (int j = 50; j < 60; ++j)
+ for (int i = 8; i < 16; ++i)
+ for (int j = 2; j < 4; ++j)
s6.points.insert(point2d(i, j));
s6.value = 210;
- for (int i = 0; i < 300; ++i)
- for (int j = 0; j < 200; ++j)
+ for (int i = 0; i < 16; ++i)
+ for (int j = 0; j < 8; ++j)
s7.points.insert(point2d(i, j));
s7.value = 10;
- util::tree_fast<T> tree(s1);
+ util::tree_fast<I> tree(s1);
tree.add_child(tree.root_, s2);
- tree.add_child(tree.search(s1), s3);
- tree.add_child(tree.search(s2), s4);
- tree.add_child(tree.search(s2), s5);
- tree.add_child(tree.search(s4), s6);
+ tree.add_child(tree.root_, s3);
+ tree.add_child(tree.root_, s4);
+ tree.add_child(tree.root_, s5);
+ tree.add_child(tree.root_, s6);
tree.add_parent(s7);
- image2d<int_u8> out (300,300);
- util::tree_fast_to_image(tree, out);
- io::pgm::save(out, "out.pgm");
- std::cout << "out.pgm generate"
- << std::endl;
+ image2d<int_u8> output (16, 16);
+ level::fill(output, 0);
+ util::tree_fast_to_image(tree, output);
+
+ int_u8 vs[16][16] = {
+
+ {110, 110, 110, 110, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {110, 110, 110, 110, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {110, 110, 110, 110, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {110, 110, 110, 110, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0}
+
+ };
+
+ image2d<int_u8> ref (make::image2d(vs));
+ mln_assertion(ref == output);
}
Index: trunk/milena/tests/util/graph.cc
===================================================================
--- trunk/milena/tests/util/graph.cc (revision 1539)
+++ trunk/milena/tests/util/graph.cc (revision 1540)
@@ -33,6 +33,7 @@
*/
#include <mln/util/graph.hh>
+#include <iostream>
int main ()
{
Index: trunk/milena/tests/util/tree_to_image.cc
===================================================================
--- trunk/milena/tests/util/tree_to_image.cc (revision 1539)
+++ trunk/milena/tests/util/tree_to_image.cc (revision 1540)
@@ -26,7 +26,7 @@
// Public License.
/*!
- * \file tests/tree_to_image.cc
+ * \file tests/util/tree_to_image.cc
*
* \brief test of mln::util::tree_to_image
*
@@ -62,6 +62,7 @@
typedef fllt_node<point2d , int_u8> I;
image2d<int_u8> output (16, 16);
+ level::fill(output, 0);
I s1;
I s2;
@@ -120,14 +121,14 @@
{ 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
{ 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
{ 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
- {180, 180, 16, 16, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
- {180, 180, 16, 16, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
- {180, 180, 16, 16, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
- {180, 180, 16, 16, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
- {180, 180, 16, 16, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 0, 0, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 0, 0, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 0, 0, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 0, 0, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ {180, 180, 0, 0, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
{180, 180, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
- { 16, 16, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
- { 16, 16, 16, 16, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0}
+ { 0, 0, 210, 210, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0}
};
Index: trunk/milena/tests/util/Makefile.am
===================================================================
--- trunk/milena/tests/util/Makefile.am (revision 1539)
+++ trunk/milena/tests/util/Makefile.am (revision 1540)
@@ -9,7 +9,8 @@
tree \
tree_fast \
tree_fast_to_image \
-tree_to_image
+tree_to_image \
+tree_fast_to_image
branch_iter_SOURCES = branch_iter.cc
@@ -21,6 +22,7 @@
tree_fast_SOURCES = tree_fast.cc
tree_fast_to_image_SOURCES = tree_to_image.cc
tree_to_image_SOURCES = tree_to_image.cc
+tree_fast_to_image_SOURCES = tree_fast_to_image.cc
TESTS = $(check_PROGRAMS)
Index: trunk/milena/mln/util/graph.hh
===================================================================
--- trunk/milena/mln/util/graph.hh (revision 1539)
+++ trunk/milena/mln/util/graph.hh (revision 1540)
@@ -30,7 +30,7 @@
# include <mln/core/concept/object.hh>
# include <cstddef>
-# include <iostream>
+# include <ostream>
# include <vector>
# include <list>
# include <algorithm>
@@ -46,6 +46,9 @@
namespace util
{
+ /*! \brief Structure of generic node.
+ *
+ */
template<typename T>
struct s_node
{
@@ -53,12 +56,20 @@
std::vector<unsigned> links;
};
+
+ /*! \brief Structure of node with void parameter.
+ *
+ */
template<>
struct s_node<void>
{
std::list<unsigned> links;
};
+
+ /*! \brief Structure of generic edge.
+ *
+ */
template<typename T>
struct s_edge
{
@@ -67,6 +78,9 @@
unsigned node2;
};
+ /*! \brief Structure of edge with void parameter.
+ *
+ */
template<>
struct s_edge <void>
{
@@ -74,18 +88,65 @@
unsigned node2;
};
+ /*! \brief Generic graph using s_node and s_edge.
+ *
+ */
template<typename N, typename E = void>
struct graph
{
+ /*! \brief Constructor.
+ *
+ */
graph ();
+ /*! \brief Add a void node.
+ *
+ */
void add_node (void);
+
+
+ /*! \brief Add a void edge between \p n1 and \p n2.
+ *
+ * \param[in] n1 The first node to link.
+ * \param[in] n2 The second node to link.
+ *
+ * \pre n1 < nb_node_.
+ * \pre n2 < nb_node_.
+ *
+ */
void add_edge (unsigned n1, unsigned n2);
+
+
+ /*! \brief Check the consistency of the graph.
+ *
+ * Check if all edge have their node in the graph.
+ *
+ * \pre nodes_.size () == nb_node_.
+ * \pre links_.size () == nb_link_.
+ *
+ */
void consistency () const;
- void print_debug () const;
+
+
+ /*! \brief Print on \p ostr the graph.
+ *
+ * \param[in] ostr The output stream.
+ *
+ */
+ void print_debug (std::ostream& ostr) const;
+
+
+
+ /// The nuber of nodes.
unsigned nb_node_;
+
+ /// The nuber of links.
unsigned nb_link_;
+
+ /// The vector where is stocked the pointers of nodes.
std::vector<struct s_node<N>*> nodes_;
+
+ /// The vector where is stocked the pointers of links.
std::vector<struct s_edge<E>*> links_;
};
@@ -151,27 +212,23 @@
template<typename N, typename E>
void
- graph<N, E>::print_debug () const
+ graph<N, E>::print_debug (std::ostream& ostr) const
{
- std::cout << "nodes :"
- << std::endl;
+ ostr << "nodes :" << std::endl;
typename std::vector<struct s_node<N>*>::const_iterator it = nodes_.begin ();
int i = 0;
for (; it != nodes_.end (); ++it, ++i)
{
- std::cout << "node number = "
- << i
- << " nbh : ";
+ ostr << "node number = " << i << " nbh : ";
typename std::list<unsigned>::const_iterator it2 = (*it)->links.begin ();
for (; it2 != (*it)->links.end (); ++it2)
{
- std::cout << (*it2)
- << " ";
+ ostr << (*it2) << " ";
}
- std::cout << std::endl;
+ ostr << std::endl;
}
- std::cout << std::endl;
+ ostr << std::endl;
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/util/nil.hh
===================================================================
--- trunk/milena/mln/util/nil.hh (revision 1539)
+++ trunk/milena/mln/util/nil.hh (revision 1540)
@@ -42,7 +42,9 @@
namespace util
{
- /// Nil structure.
+ /*! \brief Nil structure.
+ *
+ */
struct nil : public Object< nil >
{
nil();
Index: trunk/milena/mln/util/ignore.hh
===================================================================
--- trunk/milena/mln/util/ignore.hh (revision 1539)
+++ trunk/milena/mln/util/ignore.hh (revision 1540)
@@ -42,7 +42,9 @@
namespace util
{
- /// Ignore structure.
+ /*! \brief Ignore structure.
+ *
+ */
struct ignore : public Object< ignore >
{
ignore();
Index: trunk/milena/mln/util/tree_to_image.hh
===================================================================
--- trunk/milena/mln/util/tree_to_image.hh (revision 1539)
+++ trunk/milena/mln/util/tree_to_image.hh (revision 1540)
@@ -45,28 +45,48 @@
namespace util
{
+ /*! Convert a tree into an image.
+ *
+ * \param[in] tree The tree to convert.
+ * \param[out] output_ The image containing tree informations.
+ *
+ */
template <typename T, typename I>
void
tree_to_image (tree<T>& tree, Image<I>& output_);
- template <typename P, typename J>
- void
- display_set(const Image<J>& ima_, p_set<P>& s);
-
+ /*! Display a tree.
+ *
+ * \param[in] ima The domain of output image.
+ * \param[in] tree The tree to display.
+ *
+ */
template <typename I, typename J>
void
display_tree(const Image<J>& ima_, tree<I>& tree);
+
+ /*! Display an arborescence from \p node.
+ *
+ * \param[in] ima The domain of output image.
+ * \param[in] node The root node to display.
+ *
+ */
template <typename I, typename J>
void
display_branch(const Image<J>& ima_, node<I>* node);
# ifndef MLN_INCLUDE_ONLY
+ namespace impl
+ {
+
template <typename T, typename I>
void
tree_to_image_rec(node<T>* node, Image<I>& output_)
{
+ trace::entering("util::impl::tree_to_image_rec");
+
I& output = exact(output_);
mln_piter(p_set<point2d>) p(node->elt().points);
@@ -83,14 +103,44 @@
if (*it)
tree_to_image_rec((*it), output);
}
+ trace::exiting("util::impl::tree_to_image_rec");
}
- template <typename T, typename I>
+ template <typename T, typename J>
void
- tree_to_image (tree<T>& tree, Image<I>& output_)
+ display_tree_rec(const Image<J>& ima_, node<T>* node, int level)
{
- I& output = exact(output_);
- tree_to_image_rec(tree.root(), output);
+ trace::entering("util::impl::display_tree_rec");
+
+ const J& ima = exact(ima_);
+ display_set(ima, node->elt().points);
+ typename mln::util::node<T>::children_t::iterator it = node->children().begin();
+ for (;
+ it != node->children().end(); ++it)
+ display_tree_rec(ima, (*it), level + 1);
+
+ trace::exiting("util::impl::display_tree_rec");
+ }
+
+
+ template <typename T, typename J, typename K>
+ void
+ display_branch_rec(const Image<J>& ima_, node<T>* node, Image<K>& output_)
+ {
+ trace::entering("util::impl::display_branch_rec");
+
+ K& output = exact(output_);
+ const J& ima = exact(ima_);
+
+ mln_piter(p_set<point2d>) p(node->elt().points);
+ for_all (p)
+ output(p) = true;
+ typename mln::util::node<T>::children_t::iterator it = node->children().begin();
+ for (;
+ it != node->children().end(); ++it)
+ display_branch_rec(ima, (*it), output);
+
+ trace::exiting("util::impl::display_branch_rec");
}
@@ -98,6 +148,8 @@
void
display_set(const Image<J>& ima_, p_set<P>& s)
{
+ trace::entering("util::impl::display_set");
+
const J& ima = exact(ima_);
image2d<bool> out (ima.bbox ());
@@ -105,64 +157,60 @@
mln_piter(p_set<P>) p (s);
for_all (p)
out(p) = true;
+
+ trace::exiting("util::impl::display_set");
}
- template <typename T, typename J>
+ } // end of namespace mln::util::impl
+
+
+
+ template <typename T, typename I>
void
- display_tree_rec(const Image<J>& ima_, node<T>* node, int level)
+ tree_to_image (tree<T>& tree, Image<I>& output_)
{
- const J& ima = exact(ima_);
- std::cout << level << std::endl;
- std::cout << std::endl;
- display_set(ima, node->elt().points);
- typename mln::util::node<T>::children_t::iterator it = node->children().begin();
- for (;
- it != node->children().end(); ++it)
- display_tree_rec(ima, (*it), level + 1);
- std::cout << std::endl;
- std::cout << std::endl;
- std::cout << std::endl;
- std::cout << std::endl;
+ trace::entering("util::tree_to_image");
+
+ I& output = exact(output_);
+ impl::tree_to_image_rec(tree.root(), output);
+
+ trace::exiting("util::tree_to_image");
}
+
template <typename I, typename J>
void
display_tree(const Image<J>& ima_, tree<I>& tree)
{
- const J& ima = exact(ima_);
- int level = 0;
+ trace::entering("util::display_tree");
- mln_assertion(tree.root());
- display_tree_rec(ima, tree.root(), level);
- }
+ mln_precondition(tree.root());
- template <typename T, typename J, typename K>
- void
- display_branch_rec(const Image<J>& ima_, node<T>* node, Image<K>& output_)
- {
- K& output = exact(output_);
const J& ima = exact(ima_);
+ int level = 0;
- mln_piter(p_set<point2d>) p(node->elt().points);
- for_all (p)
- output(p) = true;
- typename mln::util::node<T>::children_t::iterator it = node->children().begin();
- for (;
- it != node->children().end(); ++it)
- display_branch_rec(ima, (*it), output);
+ impl::display_tree_rec(ima, tree.root(), level);
+
+ trace::exiting("util::display_tree");
}
+
template <typename I, typename J>
void
display_branch(const Image<J>& ima_, node<I>* node)
{
+ trace::entering("util::display_branch");
+
+ mln_assertion(node);
+
const J& ima = exact(ima_);
- image2d<bool> output (ima.domain ());
+ image2d<bool> output (ima.domain ());
level::fill(output, false);
- mln_assertion(node);
- display_branch_rec(ima, node, output);
+ impl::display_branch_rec(ima, node, output);
+
+ trace::exiting("util::display_branch");
}
Index: trunk/milena/mln/util/eat.hh
===================================================================
--- trunk/milena/mln/util/eat.hh (revision 1539)
+++ trunk/milena/mln/util/eat.hh (revision 1540)
@@ -42,7 +42,9 @@
namespace util
{
- /// Eat structure.
+ /*! \brief Eat structure.
+ *
+ */
struct eat : public Object< eat >
{
eat();
Index: trunk/milena/mln/util/branch_iter_ind.hh
===================================================================
--- trunk/milena/mln/util/branch_iter_ind.hh (revision 1539)
+++ trunk/milena/mln/util/branch_iter_ind.hh (revision 1540)
@@ -60,8 +60,9 @@
/*! \brief Basic 2D image class.
*
- * The parameter \c T is the type of node's data. branch_iter_ind is used to pre-order walk a branch.
-
+ * The parameter \c T is the type of node's data. branch_iter_ind
+ * is used to pre-order walk a branch.
+ *
*/
template <typename T>
class branch_iter_ind
@@ -87,6 +88,7 @@
/// Give how deep is the iterator in the branch.
unsigned deepness() const;
+
private:
/// The branch to iter.
util::branch<T> branch_;
Index: trunk/milena/mln/util/tree_fast.hh
===================================================================
--- trunk/milena/mln/util/tree_fast.hh (revision 1539)
+++ trunk/milena/mln/util/tree_fast.hh (revision 1540)
@@ -29,7 +29,6 @@
# define MLN_UTIL_TREE_FAST_HH
# include <vector>
-# include <iostream>
# include <mln/core/contract.hh>
@@ -49,19 +48,70 @@
template <typename T>
struct tree_fast
{
+ /*! \brief Constructor.
+ *
+ */
tree_fast();
+
+ /*! \brief Constructor.
+ *
+ * \param[in] elt The value of the root of the tree.
+ */
tree_fast(T& elt);
+ /*! \brief Return the size of the tree.
+ *
+ * \return the number of node of the tree.
+ */
const unsigned size() const;
+
+
+ /*! \brief Check if the tree has \p elt.
+ *
+ * \return true if it has it else false.
+ */
bool has (T& elt) const;
+
+
+ /*! \brief Search the position of the node with \p elt.
+ *
+ * \param[in] elt The value of the searched node.
+ *
+ * \return the position of the node if it's found else UINT_MAX.
+ */
unsigned search (T& elt) const;
+
+
+ /*! \brief Check if the node at position \p i is the root node.
+ *
+ * \return true if it's the node root it else false.
+ */
bool is_root (unsigned i) const;
+
+
+ /*! \brief Add a child with value \p elt to the \p i th node.
+ *
+ * \return The position of the add child.
+ */
unsigned add_child (unsigned i, T& elt);
+
+
+ /*! \brief Add a parent with value \p elt to this tree.
+ *
+ * \return The position of the new root of this tree.
+ */
unsigned add_parent (T& elt);
+ /// The vector of the value of all node of the tree.
std::vector<T> data_;
+
+ /// The vector of the parent's position of all node of the tree.
std::vector<unsigned> parent_;
+
+ /// The vector of the vector children position of all node of the tree.
std::vector<std::vector<unsigned> > child_;
+
+ /// The position of the root in data_.
unsigned root_;
};
@@ -108,8 +158,9 @@
for (unsigned i = 0; i < data_.size (); ++i)
if (data_[i] == elt)
return i;
- std::cerr << "BUGG !!!!"
- << std::endl;
+
+ /// Bug the search failed.
+ mln_assertion (false);
return (unsigned)(-1);
}
Index: trunk/milena/mln/util/tree.hh
===================================================================
--- trunk/milena/mln/util/tree.hh (revision 1539)
+++ trunk/milena/mln/util/tree.hh (revision 1540)
@@ -30,7 +30,7 @@
# include <vector>
# include <algorithm>
-# include <iostream>
+# include <ostream>
# include <algorithm>
# include <mln/core/contract.hh>
@@ -52,79 +52,229 @@
template <typename T> class tree;
template <typename T> class branch;
+
+ /*! \brief Class of generic node for tree.
+ *
+ */
template <typename T>
class node
{
public:
typedef std::vector< node<T>* > children_t;
- /// \{ Constructors
+
+ /*! \brief Constructor.
+ *
+ */
node();
+
+ /*! \brief Constructor.
+ *
+ * \param[in] elt The element of node.
+ */
node(T elt);
- /// \}
- /// \{ Acccess to the element.
+
+ /*! \brief The getter of the element.
+ *
+ * \return The element of the node.
+ */
T& elt();
+
+ /*! \brief The const getter of the element.
+ *
+ * \return The element of the node in const.
+ */
const T& elt() const;
- /// \}
- /// Access to the children
- const children_t& children() const;
+
+ /*! \brief The getter of the children.
+ *
+ * \return The children of the node.
+ */
children_t& children();
- /// Access to the parent node.
+
+ /*! \brief The getter of the children.
+ *
+ * \return The children of the node in const.
+ */
+ const children_t& children() const;
+
+
+ /*! \brief The getter of the parent.
+ *
+ * \return The parent of the node.
+ */
node<T>* parent();
- //node<T>*& parent();
- /// \{ Add a child to the node
+
+ /*! \brief Create a node with \p elt which become the child of
+ * the current node.
+ *
+ * \param[in] elt The element of the new child to add.
+ *
+ * \return The new node created.
+ */
node<T>* add_child(T elt);
+
+ /*! \brief Bind \p node to the current node and become its
+ * child.
+ *
+ * \param[in] node The new child node.
+ *
+ * \return The child node.
+ */
node<T>* add_child(node<T>* node);
- /// \}
+ /*! \brief Bind \p node to the current node and become its
+ * parent.
+ *
+ * \param[in] node The new parent node.
+ *
+ */
void set_parent(node<T>* parent);
+
+ /*! \brief Delete the current node.
+ *
+ */
node<T>* delete_node();
- void print(int level);
+
+ /*! \brief Print on \p ostr the arborescence with the current
+ * node as root.
+ *
+ * \param[in] ostr The output stream.
+ *
+ */
+ void print(std::ostream& ostr, int level = 0);
+
+ /*! \brief Check the consistency of the node.
+ *
+ * \return true if no error, else false.
+ */
bool check_consistency();
- int search_rec(node<T>** res, T& elt);
+
+
+ /*! \brief Search the node with value \p elt in the arborescence
+ * of the current node.
+ *
+ * \param[in] elt The value of the searched node.
+ *
+ * \return If not found 0 else the node with \p elt value.
+ */
node<T>* search(T& elt);
+ /// The using method for method search.
+ int search_rec(node<T>** res, T& elt);
+
private:
- //FIXME tree<T>& tree_;
+
+ /// The value.
T elt_;
+
+ /// The node parent.
node<T>* parent_;
+
+ /// The children.
std::vector< node<T>* > child_;
};
+
+
+ /*! \brief Class of generic tree.
+ *
+ */
template <typename T>
class tree
{
public:
+
typedef node<T> node_t;
+
+ /*! \brief Constructor.
+ *
+ */
tree();
+
+ /*! \brief Constructor.
+ *
+ * \param[in] root The root of the tree.
+ */
tree(node<T>* root);
+
+ /*! \brief The getter of the root.
+ *
+ * \return The root's node of the the current tree.
+ */
node<T>* root();
+
+ /*! \brief Convert the tree into brach.
+ *
+ * \return The root's node of the the current tree.
+ */
branch<T> main_branch();
+
+ /*! \brief Check the consistency of the tree.
+ *
+ * \return true if no error, else false.
+ */
bool check_consistency();
+
+
+ /*! \brief Bind a new tree upper the current.
+ *
+ * \param[in] elt The new value of the new node of the new tree
+ * add upper the current.
+ */
void add_tree_up (T& elt);
+
+ /*! \brief Bind a new tree downer the current.
+ *
+ * \param[in] elt The new value of the new node of the new tree
+ * add downer the current.
+ */
void add_tree_down (T& elt);
private:
+
+ /// The root's node.
node<T>* root_;
};
+ /*! \brief Class of generic branch.
+ *
+ */
template <typename T>
class branch
{
public:
+
+ /*! \brief Constructor.
+ *
+ * \param[in] tree The tree of the branch.
+ * \param[in] apex The apex of the branch.
+ */
branch(tree<T>& tree, node<T>& apex);
+ /*! \brief The getter of the appex.
+ *
+ * \return The node appex of the current branch.
+ */
node<T>& apex();
+
+ /*! \brief The getter of the tree.
+ *
+ * \return The tree of the current branch.
+ */
tree<T>& tree();
private:
+ /// The tree of this branch.
util::tree<T>& tree_;
+
+ /// The node apex of this branch.
node<T>& apex_;
};
@@ -280,11 +430,11 @@
template <typename T>
void
- node<T>::print(int level)
+ node<T>::print(std::ostream& ostr, int level)
{
- std::cout << level << std::endl;
+ ostr << level << std::endl;
- std::cout << " elt " << this->elt() << std::endl;
+ ostr << " elt " << this->elt() << std::endl;
for (typename std::vector<node<T>* >::iterator it = this->child_.begin();
Index: trunk/milena/mln/util/pix.hh
===================================================================
--- trunk/milena/mln/util/pix.hh (revision 1539)
+++ trunk/milena/mln/util/pix.hh (revision 1540)
@@ -39,10 +39,12 @@
namespace mln
{
- /// FIXME : doc
namespace select
{
+ /*! \brief Structure p_of.
+ *
+ */
template <typename P>
struct p_of : P
{
@@ -57,19 +59,53 @@
namespace util
{
- /// Pix structure.
+ /*! \brief Structure pix.
+ *
+ */
template <typename I>
struct pix
{
+
+ /// Point_Site associated type.
typedef mln_psite(I) psite;
+
+ /// Value associated type.
typedef mln_value(I) value;
+ /*! \brief Constructor.
+ *
+ * \param[in] ima The image.
+ * \param[in] p The p_site.
+ */
pix(const Image<I>& ima, const mln_psite(I)& p);
+
+ /*! \brief The getter of the image associate to pix structure.
+ *
+ * \return The image ima_.
+ *
+ */
const I& ima() const;
+
+ /*! \brief The getter of psite associate to pix structure.
+ *
+ * \return The psite p_.
+ *
+ */
const mln_psite(I)& p() const;
+
+ /*! \brief The getter of value associate to pix structure.
+ *
+ * \return The value of pix.
+ *
+ */
mln_rvalue(I) v() const;
+
private:
+
+ /// The image associate to pix.
const I& ima_;
+
+ /// The psite associate to pix.
const mln_psite(I)& p_;
};
Index: trunk/milena/mln/util/tree_fast_to_image.hh
===================================================================
--- trunk/milena/mln/util/tree_fast_to_image.hh (revision 1539)
+++ trunk/milena/mln/util/tree_fast_to_image.hh (revision 1540)
@@ -46,16 +46,27 @@
namespace util
{
+ /*! Convert a tree_fast into an image.
+ *
+ * \param[in] tree The tree to convert.
+ * \param[out] output_ The image containing tree informations.
+ *
+ */
template <typename T, typename I>
void
tree_fast_to_image(tree_fast<T>& tree, Image<I>& output_);
# ifndef MLN_INCLUDE_ONLY
+ namespace impl
+ {
+
template <typename T, typename I>
void
tree_fast_to_image(tree_fast<T>& tree, Image<I>& output_)
{
+ trace::entering("util::impl::tree_fast_to_image");
+
I& output = exact(output_);
std::list<unsigned> l;
@@ -74,6 +85,23 @@
}
l.pop_front();
}
+
+ trace::exiting("util::impl::tree_fast_to_image");
+ }
+
+ } // end of mln::util::impl
+
+
+
+ template <typename T, typename I>
+ void
+ tree_fast_to_image(tree_fast<T>& tree, Image<I>& output_)
+ {
+ trace::entering("util::tree_fast_to_image");
+
+ impl::tree_fast_to_image(tree, output_);
+
+ trace::exiting("util::tree_fast_to_image");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/util/branch_iter.hh
===================================================================
--- trunk/milena/mln/util/branch_iter.hh (revision 1539)
+++ trunk/milena/mln/util/branch_iter.hh (revision 1540)
@@ -46,7 +46,8 @@
/*! \brief Basic 2D image class.
*
- * The parameter \c T is the type of node's data. branch_iter is used to pre-order walk a branch.
+ * The parameter \c T is the type of node's data. branch_iter is
+ * used to pre-order walk a branch.
*
*/
template <typename T>
1
0
https://svn.lrde.epita.fr/svn/oln/branches/olena-ng
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add support for Vcs back.
* vcs/oln.rb: New.
oln.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: vcs/oln.rb
--- vcs/oln.rb (revision 1538)
+++ vcs/oln.rb (working copy)
@@ -6,7 +6,7 @@
protocol_version '0.1'
def olena_commit! ( *args )
- common_commit!("1539: <%= title %>", *args) do |subject|
+ common_commit!("olena-ng 1539: <%= title %>", *args) do |subject|
mail!(:to => %w[olena-patches(a)lrde.epita.fr], :subject => subject)
end
end
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Moves the io's tests.
* tests/Makefile.am: Makefile update due to test moves.
* tests/io/Makefile.am: Likewise.
* tests/io/fits/Makefile.am: Likewise.
* tests/io/pbm/Makefile.am: Likewise.
* tests/io/pgm/Makefile.am: Likewise.
* tests/io/ppm/Makefile.am: Likewise.
* sandbox/garrigues/io_fits.cc: Remove.
* tests/io/fits/io_fits.cc: New.
* tests/io_pbm.cc: Rename as...
* tests/io/pbm/pbm.cc: ...this.
* tests/io_pgm.cc: Rename as...
* tests/io/pgm/pgm.cc: ...this.
* tests/io_pgm16.cc: Rename as...
* tests/io/pgm/pgm16.cc: ...this.
* tests/io_pgm19.cc: Rename as...
* tests/io/pgm/pgm19.cc: ...this.
* tests/io_pgm27.cc: Rename as...
* tests/io/pgm/pgm27.cc: ...this.
* tests/io_ppm.cc: Rename as...
* tests/io/ppm/ppm.cc: ...this.
* tests/io_ppm16.cc: Rename as...
* tests/io/ppm/ppm16.cc: ...this.
* tests/io_ppm23.cc: Rename as...
* tests/io/ppm/ppm23.cc: ...this.
* tests/new_io_pgm.cc: Remove, now into tests/io/pgm/pgm.cc.
Fix style and doc.
* mln/accu/compute.hh,
* mln/io/ppm/load.hh: Fix.
---
trunk/milena/mln/accu/compute.hh | 3
trunk/milena/tests/Makefile.am | 17 -----
trunk/milena/tests/io/Makefile.am | 8 ++
trunk/milena/tests/io/fits/Makefile.am | 7 ++
trunk/milena/tests/io/fits/io_fits.cc | 77 +++++++++++++++++++++++
trunk/milena/tests/io/pbm/Makefile.am | 7 ++
trunk/milena/tests/io/pbm/pbm.cc | 55 ++++++++++++++++
trunk/milena/tests/io/pgm/Makefile.am | 12 +++
trunk/milena/tests/io/pgm/pgm.cc | 62 ++++++++++++++++++
trunk/milena/tests/io/pgm/pgm16.cc | 95 ++++++++++++++++++++++++++++
trunk/milena/tests/io/pgm/pgm19.cc | 95 ++++++++++++++++++++++++++++
trunk/milena/tests/io/pgm/pgm27.cc | 95 ++++++++++++++++++++++++++++
trunk/milena/tests/io/ppm/Makefile.am | 12 +++
trunk/milena/tests/io/ppm/ppm.cc | 49 ++++++++++++++
trunk/milena/tests/io/ppm/ppm16.cc | 110 +++++++++++++++++++++++++++++++++
trunk/milena/tests/io/ppm/ppm23.cc | 110 +++++++++++++++++++++++++++++++++
16 files changed, 796 insertions(+), 18 deletions(-)
Index: trunk/milena/tests/io_pgm.cc (deleted)
===================================================================
Index: trunk/milena/tests/io_pgm19.cc (deleted)
===================================================================
Index: trunk/milena/tests/io_ppm23.cc (deleted)
===================================================================
Index: trunk/milena/tests/new_io_pgm.cc (deleted)
===================================================================
Index: trunk/milena/tests/io_pbm.cc (deleted)
===================================================================
Index: trunk/milena/tests/io_ppm.cc (deleted)
===================================================================
Index: trunk/milena/tests/io_ppm16.cc (deleted)
===================================================================
Index: trunk/milena/tests/io_pgm27.cc (deleted)
===================================================================
Index: trunk/milena/tests/io_pgm16.cc (deleted)
===================================================================
Index: trunk/milena/tests/Makefile.am
===================================================================
--- trunk/milena/tests/Makefile.am (revision 1536)
+++ trunk/milena/tests/Makefile.am (revision 1537)
@@ -68,13 +68,6 @@
image_if_value \
interpolated \
io_pbm \
- io_pgm16 \
- io_pgm19 \
- io_pgm27 \
- io_pgm \
- io_ppm16 \
- io_ppm23 \
- io_ppm \
\
labeling_algo \
labeling_estimate \
@@ -109,7 +102,6 @@
morpho_opening_area \
morpho_thinning \
\
- new_io_pgm \
norm_l2 \
\
pixel \
@@ -215,14 +207,6 @@
image_if_interval_SOURCES = image_if_interval.cc
image_if_value_SOURCES = image_if_value.cc
interpolated_SOURCES = interpolated.cc
-io_pbm_SOURCES = io_pbm.cc
-io_pgm16_SOURCES = io_pgm16.cc
-io_pgm19_SOURCES = io_pgm19.cc
-io_pgm27_SOURCES = io_pgm27.cc
-io_pgm_SOURCES = io_pgm.cc
-io_ppm16_SOURCES = io_ppm16.cc
-io_ppm23_SOURCES = io_ppm23.cc
-io_ppm_SOURCES = io_ppm.cc
labeling_algo_SOURCES = labeling_algo.cc
labeling_estimate_SOURCES = labeling_estimate.cc
@@ -257,7 +241,6 @@
morpho_opening_area_SOURCES = morpho_opening_area.cc
morpho_thinning_SOURCES = morpho_thinning.cc
-new_io_pgm_SOURCES = new_io_pgm.cc
norm_l2_SOURCES = norm_l2.cc
pixel_SOURCES = pixel.cc
Index: trunk/milena/tests/io/pgm/pgm27.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm27.cc (revision 0)
+++ trunk/milena/tests/io/pgm/pgm27.cc (revision 1537)
@@ -0,0 +1,95 @@
+// 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/io_pgm27.cc
+ *
+ * \brief Test on mln::io::pgm::load and mln::io::pgm::save.
+ */
+
+
+#include <mln/core/image2d.hh>
+
+#include <mln/value/int_u8.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/level/transform.hh>
+#include <mln/level/compare.hh>
+
+
+ using namespace mln;
+
+struct to27bits : mln::Function_v2v<to27bits>
+{
+
+ typedef value::int_u<27> result;
+ result operator()(value::int_u8 v) const
+ {
+ result ret(v * 524288);
+ return ret;
+ }
+};
+
+struct to8bits : mln::Function_v2v<to8bits>
+{
+
+ typedef value::int_u8 result;
+ result operator()(value::int_u<27> v) const
+ {
+ result ret(v / 524288);
+ return ret;
+ }
+};
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+ using value::int_u;
+ typedef value::int_u<27> int_u27;
+
+ image2d<int_u8>
+ lena = io::pgm::load<int_u8>("../img/lena.pgm");
+ image2d<int_u27> out(lena.domain());
+
+ level::transform(lena, to27bits(), out);
+
+ io::pgm::save(out, "out27.pgm");
+
+ image2d<int_u27> lena2;
+ io::pgm::load(lena2, "out27.pgm");
+
+ image2d<int_u8> out2(lena.domain());
+
+ level::transform(lena2, to8bits(), out2);
+
+ io::pgm::save(out2, "out8.pgm");
+
+ assert(out2 == lena);
+
+}
Index: trunk/milena/tests/io/pgm/pgm19.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm19.cc (revision 0)
+++ trunk/milena/tests/io/pgm/pgm19.cc (revision 1537)
@@ -0,0 +1,95 @@
+// 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/io_pgm19.cc
+ *
+ * \brief Test on mln::io::pgm::load and mln::io::pgm::save.
+ */
+
+#include <mln/core/image2d.hh>
+
+#include <mln/value/int_u8.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/level/transform.hh>
+#include <mln/level/compare.hh>
+
+
+ using namespace mln;
+
+struct to19bits : mln::Function_v2v<to19bits>
+{
+
+ typedef value::int_u<19> result;
+ result operator()(value::int_u8 v) const
+ {
+ result ret(v * 524288);
+ return ret;
+ }
+};
+
+struct to8bits : mln::Function_v2v<to8bits>
+{
+
+ typedef value::int_u8 result;
+ result operator()(value::int_u<19> v) const
+ {
+ result ret(v / 524288);
+ return ret;
+ }
+};
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+ using value::int_u;
+ typedef value::int_u<19> int_u19;
+
+ border::thickness = 52;
+
+ image2d<int_u8>
+ lena = io::pgm::load<int_u8>("../img/lena.pgm");
+ image2d<int_u19> out(lena.domain());
+
+ level::transform(lena, to19bits(), out);
+
+ io::pgm::save(out, "out19.pgm");
+
+ image2d<int_u19>
+ lena2 = io::pgm::load<int_u19>("out19.pgm");
+ image2d<int_u8> out2(lena.domain());
+
+ level::transform(lena2, to8bits(), out2);
+
+ io::pgm::save(out2, "out8.pgm");
+
+ assert(out2 == lena);
+
+}
Index: trunk/milena/tests/io/pgm/pgm.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm.cc (revision 0)
+++ trunk/milena/tests/io/pgm/pgm.cc (revision 1537)
@@ -0,0 +1,62 @@
+// 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/io_pgm.cc
+ *
+ * \brief Test on mln::io::pgm::load and mln::io::pgm::save.
+ */
+
+
+#include <mln/core/image2d.hh>
+
+#include <mln/value/int_u8.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ {
+ image2d<int_u8>
+ lena = io::pgm::load<int_u8>("../img/lena.pgm");
+
+ io::pgm::save(lena, "out.pgm");
+ }
+
+
+ {
+ image2d< value::int_u<8> >
+ lena;
+ io::pgm::load(lena, "../img/lena.pgm");
+
+ io::pgm::save(lena, "out.pgm");
+ }
+
+}
Index: trunk/milena/tests/io/pgm/Makefile.am
===================================================================
--- trunk/milena/tests/io/pgm/Makefile.am (revision 1536)
+++ trunk/milena/tests/io/pgm/Makefile.am (revision 1537)
@@ -1,3 +1,15 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ pgm16 \
+ pgm19 \
+ pgm27 \
+ pgm
+
+pgm16_SOURCES = pgm16.cc
+pgm19_SOURCES = pgm19.cc
+pgm27_SOURCES = pgm27.cc
+pgm_SOURCES = pgm.cc
+
Index: trunk/milena/tests/io/pgm/pgm16.cc
===================================================================
--- trunk/milena/tests/io/pgm/pgm16.cc (revision 0)
+++ trunk/milena/tests/io/pgm/pgm16.cc (revision 1537)
@@ -0,0 +1,95 @@
+// 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/io_pgm16.cc
+ *
+ * \brief Test on mln::io::pgm::load and mln::io::pgm::save.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u16.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/level/transform.hh>
+
+
+ using namespace mln;
+
+struct to16bits : mln::Function_v2v<to16bits>
+{
+
+ typedef value::int_u16 result;
+ result operator()(value::int_u8 v) const
+ {
+ result ret(v * 256);
+ return ret;
+ }
+};
+
+struct to8bits : mln::Function_v2v<to8bits>
+{
+
+ typedef value::int_u8 result;
+ result operator()(value::int_u16 v) const
+ {
+ result ret(v / 256);
+ return ret;
+ }
+};
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+ using value::int_u16;
+
+ win::rectangle2d rect(51, 51);
+ border::thickness = 52;
+
+ image2d<int_u8>
+ lena = io::pgm::load<int_u8>("../img/lena.pgm");
+ image2d<int_u16> out(lena.domain());
+
+ level::transform(lena, to16bits(), out);
+
+ io::pgm::save(out, "out16.pgm");
+
+ image2d<int_u16>
+ lena2 = io::pgm::load<int_u16>("out16.pgm");
+ image2d<int_u8> out2(lena.domain());
+
+ level::transform(lena2, to8bits(), out2);
+
+ io::pgm::save(out2, "out8.pgm");
+
+
+}
Index: trunk/milena/tests/io/fits/io_fits.cc
===================================================================
--- trunk/milena/tests/io/fits/io_fits.cc (revision 0)
+++ trunk/milena/tests/io/fits/io_fits.cc (revision 1537)
@@ -0,0 +1,77 @@
+// 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_b.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_b<float>
+ fits_in = io::fits::load("../../img/test.fits");
+
+ debug::println(fits_in);
+
+ io::pfm::save(fits_in, "out.pfm");
+
+ image2d_b<float>
+ pfm = io::pfm::load("out.pfm");
+
+ io::pfm::save(fits_in, "out2.pfm");
+
+ image2d_b<float>
+ pfm2 = io::pfm::load("out2.pfm");
+
+ image2d_b<float>::fwd_piter p(fits_in.domain());
+ for_all(p)
+ if (fits_in(p) != pfm(p))
+ std::cout << "at " << p
+ << " ref :" << fits_in(p)
+ << " pfm2 : " << pfm(p) << std::endl;
+
+ mln_assertion(fits_in == pfm2);
+
+ // }
+ // {
+ // image2d_b<int_u8>
+ // lena = io::fits::load<int_u8>("../img/lena.fits");
+
+ // io::fits::save(lena, "out.fits");
+ }
+}
Index: trunk/milena/tests/io/fits/Makefile.am
===================================================================
--- trunk/milena/tests/io/fits/Makefile.am (revision 1536)
+++ trunk/milena/tests/io/fits/Makefile.am (revision 1537)
@@ -1,3 +1,10 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ fits \
+
+fits_SOURCES = fits.cc
+
+TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/io/Makefile.am
===================================================================
--- trunk/milena/tests/io/Makefile.am (revision 1536)
+++ trunk/milena/tests/io/Makefile.am (revision 1537)
@@ -1,3 +1,11 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
+
+SUBDIRS = \
+ fits \
+ pbm \
+ pfm \
+ pgm \
+ pnm \
+ ppm
Index: trunk/milena/tests/io/ppm/ppm.cc
===================================================================
--- trunk/milena/tests/io/ppm/ppm.cc (revision 0)
+++ trunk/milena/tests/io/ppm/ppm.cc (revision 1537)
@@ -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.
+
+/*! \file tests/io_ppm.cc
+ *
+ * \brief Test on mln::io::ppm::load and mln::io::ppm::save.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/value/rgb8.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/ppm/save.hh>
+
+
+
+
+int main()
+{
+ using namespace mln;
+ using value::rgb8;
+
+ image2d<rgb8> lena = io::ppm::load("../img/lena.ppm");
+ io::ppm::save(lena, "out.ppm");
+}
Index: trunk/milena/tests/io/ppm/ppm23.cc
===================================================================
--- trunk/milena/tests/io/ppm/ppm23.cc (revision 0)
+++ trunk/milena/tests/io/ppm/ppm23.cc (revision 1537)
@@ -0,0 +1,110 @@
+// 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/io_ppm23.cc
+ *
+ * \brief Test on mln::io::ppm::load and mln::io::ppm::save.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+
+#include <mln/value/rgb8.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/level/compare.hh>
+
+
+using namespace mln;
+
+typedef value::rgb<23> rgb23;
+
+struct to23bits : mln::Function_v2v<to23bits>
+{
+
+ typedef rgb23 result;
+ result operator()(value::rgb8 v) const
+ {
+ result ret(v.red().to_enc() * 256,
+ v.green().to_enc() * 256,
+ v.blue().to_enc() * 256);
+ return ret;
+ }
+};
+
+struct to8bits : mln::Function_v2v<to8bits>
+{
+
+ typedef value::rgb8 result;
+ result operator()(rgb23 v) const
+ {
+ result ret(v.red().to_enc() / 256,
+ v.green().to_enc() / 256,
+ v.blue().to_enc() / 256);
+ return ret;
+ }
+};
+
+int main()
+{
+ using namespace mln;
+ using value::rgb8;
+
+ typedef image2d<rgb8> I;
+
+
+ // load a 8bits image A
+ image2d<rgb8>
+ a = io::ppm::load<rgb8>("../img/lena.ppm");
+ image2d<rgb23> b(a.domain());
+
+ image2d<rgb8>::fwd_piter p(b.domain());
+
+ // save it as a 23bits ppm image B
+ to23bits f;
+ for_all(p)
+ b(p) = f(a(p));
+ io::ppm::save(b, "out23.ppm");
+
+ // reload B into C
+ image2d<rgb23>
+ c = io::ppm::load<rgb23>("out23.ppm");
+ image2d<rgb8> d(a.domain());
+
+
+ // save C as a 8bits ppm image D
+ to8bits g;
+ for_all(p)
+ d(p) = g(c(p));
+ io::ppm::save(d, "out8.ppm");
+
+ // D should equals A
+ mln_assertion(d == a);
+
+}
Index: trunk/milena/tests/io/ppm/ppm16.cc
===================================================================
--- trunk/milena/tests/io/ppm/ppm16.cc (revision 0)
+++ trunk/milena/tests/io/ppm/ppm16.cc (revision 1537)
@@ -0,0 +1,110 @@
+// 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/io_ppm16.cc
+ *
+ * \brief Test on mln::io::ppm::load and mln::io::ppm::save.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+
+#include <mln/value/rgb8.hh>
+#include <mln/value/rgb16.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/level/compare.hh>
+
+
+using namespace mln;
+
+struct to16bits : mln::Function_v2v<to16bits>
+{
+
+ typedef value::rgb16 result;
+ result operator()(value::rgb8 v) const
+ {
+ result ret(v.red().to_enc() * 256,
+ v.green().to_enc() * 256,
+ v.blue().to_enc() * 256);
+ return ret;
+ }
+};
+
+struct to8bits : mln::Function_v2v<to8bits>
+{
+
+ typedef value::rgb8 result;
+ result operator()(value::rgb16 v) const
+ {
+ result ret(v.red().to_enc() / 256,
+ v.green().to_enc() / 256,
+ v.blue().to_enc() / 256);
+ return ret;
+ }
+};
+
+int main()
+{
+ using namespace mln;
+ using value::rgb8;
+ using value::rgb16;
+
+ typedef image2d<rgb8> I;
+
+
+ // load a 8bits image A
+ image2d<rgb8>
+ a = io::ppm::load<rgb8>("../img/lena.ppm");
+ image2d<rgb16> b(a.domain());
+
+ image2d<rgb8>::fwd_piter p(b.domain());
+
+ // save it as a 16bits ppm image B
+ to16bits f;
+ for_all(p)
+ b(p) = f(a(p));
+ io::ppm::save(b, "out16.ppm");
+
+ // reload B into C
+ image2d<rgb16>
+ c = io::ppm::load<rgb16>("out16.ppm");
+ image2d<rgb8> d(a.domain());
+
+
+ // save C as a 8bits ppm image D
+ to8bits g;
+ for_all(p)
+ d(p) = g(c(p));
+ io::ppm::save(d, "out8.ppm");
+
+ // D should equals A
+ mln_assertion(d == a);
+
+}
Index: trunk/milena/tests/io/ppm/Makefile.am
===================================================================
--- trunk/milena/tests/io/ppm/Makefile.am (revision 1536)
+++ trunk/milena/tests/io/ppm/Makefile.am (revision 1537)
@@ -1,3 +1,15 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ ppm16 \
+ ppm23 \
+ ppm
+
+ppm16_SOURCES = ppm16.cc
+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 0)
+++ trunk/milena/tests/io/pbm/pbm.cc (revision 1537)
@@ -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.
+
+/*! \file tests/io_pbm.cc
+ *
+ * \brief Test on mln::io::pbm::.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/io/pbm/save.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<bool> pic = io::pbm::load("../img/picasso.pbm");
+ io::pbm::save(pic, "pic.pbm");
+}
+
+
+// sample binary image to test with xv, imview, and display
+// to bring into the fore the binary image bug with raw pbm.
+
+// | | | | -
+// | | - - -
+// | - - - -
+// - - - - -
+// - - - - -
+// - - - - -
Index: trunk/milena/tests/io/pbm/Makefile.am
===================================================================
--- trunk/milena/tests/io/pbm/Makefile.am (revision 1536)
+++ trunk/milena/tests/io/pbm/Makefile.am (revision 1537)
@@ -1,3 +1,10 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ pbm
+
+pbm_SOURCES = pbm.cc
+
+TESTS = $(check_PROGRAMS)
Index: trunk/milena/mln/accu/compute.hh
===================================================================
--- trunk/milena/mln/accu/compute.hh (revision 1536)
+++ trunk/milena/mln/accu/compute.hh (revision 1537)
@@ -51,7 +51,8 @@
* \param[in] input The input image.
*
* This routine runs: \n
- * FIXME
+ * a.take(make::pix(input, p));
+ * on all pixels on the images.
*
* \warning This routine does not perform a.init().
*/
Index: trunk/milena/mln/io/ppm/load.hh
===================================================================
Index: trunk/milena/sandbox/garrigues/io_fits.cc (deleted)
===================================================================
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
svn ignore .deps directories.
---
0 files changed
Property changes on: trunk/milena/tests/arith
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/level
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/accu
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/win
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/display
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/fun/x2x
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/border
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/set
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/canvas/browsing
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/util
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/histo
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/draw
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/logical
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
+ Makefile.in
Makefile
.deps
Property changes on: trunk/milena/tests/norm
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
.deps
+ Makefile.in
Makefile
.deps
.deps
Property changes on: trunk/milena/tests
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
.deps
+ Makefile.in
Makefile
.deps
.deps
1
0
26 Nov '07
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
svn ignore .deps directories. Update makefiles.
* milena/tests/Makefile.am: Move accu's checks...
* milena/tests/accu/Makefile.am: ...here.
---
Makefile.am | 9 +--------
accu/Makefile.am | 11 +++++++++++
2 files changed, 12 insertions(+), 8 deletions(-)
Index: trunk/milena/tests/accu/Makefile.am
===================================================================
--- trunk/milena/tests/accu/Makefile.am (revision 1534)
+++ trunk/milena/tests/accu/Makefile.am (revision 1535)
@@ -1,3 +1,14 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ all \
+ min \
+ nil
+
+all_SOURCES = all.cc
+min_SOURCES = min.cc
+nil_SOURCES = nil.cc
+
+TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/Makefile.am
===================================================================
--- trunk/milena/tests/Makefile.am (revision 1534)
+++ trunk/milena/tests/Makefile.am (revision 1535)
@@ -4,6 +4,7 @@
SUBDIRS = \
arith \
+ accu \
border \
canvas \
draw \
@@ -15,10 +16,6 @@
win
check_PROGRAMS = \
- accu_all \
- accu_min \
- accu_nil \
- \
border_resize_image1d_1 \
border_resize_image1d_2 \
border_resize_image1d_3 \
@@ -167,10 +164,6 @@
w_window2d_int \
w_window3d_int
-accu_all_SOURCES = accu_all.cc
-accu_min_SOURCES = accu_min.cc
-accu_nil_SOURCES = accu_nil.cc
-
border_resize_image1d_1_SOURCES = border_resize_image1d_1.cc
border_resize_image1d_2_SOURCES = border_resize_image1d_2.cc
border_resize_image1d_3_SOURCES = border_resize_image1d_3.cc
1
0