https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix labeling fast version.
* doc/tutorial/slides.tex: Augment.
* mln/value/other.hh: New.
* mln/value/internal/iterable_set.hh (nvalues): Update;
replace mln_card_ by mln_trait_value_card.
* mln/win/rectangle2d.hh,
* mln/win/octagon2d.hh: Typo in doc.
* mln/canvas/labeling.hh,
* mln/labeling/level.hh: Fix fast version.
doc/tutorial/slides.tex | 44 +++++++++----
mln/canvas/labeling.hh | 12 +--
mln/labeling/level.hh | 2
mln/value/internal/iterable_set.hh | 5 -
mln/value/other.hh | 125 +++++++++++++++++++++++++++++++++++++
mln/win/octagon2d.hh | 2
mln/win/rectangle2d.hh | 2
7 files changed, 166 insertions(+), 26 deletions(-)
Index: doc/tutorial/slides.tex
--- doc/tutorial/slides.tex (revision 1422)
+++ doc/tutorial/slides.tex (working copy)
@@ -296,7 +296,6 @@
\item Efficient so that one can process large images.
\item Quite as easy to use than a C or Java library.
\item Many tools to help writing readable algorithms in a concise way.
- \item C++.
\end{itemize}
\end{frame}
@@ -306,7 +305,14 @@
\begin{frame}
\frametitle{Genericity}
- FIXME
+ \begin{block}{\mln is generic}
+ \begin{itemize}
+ \item Put shortly it works on various types of images.
+ \item Algorithms are highly reusable.
+ \end{itemize}
+ \end{block}
+
+% FIXME: Say more.
\end{frame}
@@ -315,7 +321,14 @@
\begin{frame}
\frametitle{Efficiency}
- FIXME
+ \begin{block}{\mln is efficient}
+ \begin{itemize}
+ \item Written in C++ without the cost of function calls.
+ \item Specialized algorithms are provided.
+ \end{itemize}
+ \end{block}
+
+% FIXME: Say more.
\end{frame}
@@ -324,7 +337,14 @@
\begin{frame}
\frametitle{Easy to Use}
- FIXME
+ \begin{block}{\mln is easy to use}
+ \begin{itemize}
+ \item Just slightly more difficult to use than a library in C or Java.
+ \item The user mainly write procedure calls.
+ \end{itemize}
+ \end{block}
+
+% FIXME: Say more.
\end{frame}
@@ -333,16 +353,14 @@
\begin{frame}
\frametitle{Many Tools}
- FIXME
-
-\end{frame}
-
-
-%........................................................................
-\begin{frame}
- \frametitle{C++}
+ \begin{block}{\mln provides many tools}
+ \begin{itemize}
+ \item A maximal amount of work is saved for the user.
+ \item Claim: you do not think that IP people are ready to add tools to a lib.
+ \end{itemize}
+ \end{block}
- FIXME
+% FIXME: Say more.
\end{frame}
Index: mln/value/other.hh
--- mln/value/other.hh (revision 0)
+++ mln/value/other.hh (revision 0)
@@ -0,0 +1,125 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_VALUE_OTHER_HH
+# define MLN_VALUE_OTHER_HH
+
+/*! \file mln/value/other.hh
+ *
+ * \brief Definition of the mln::value::other routine.
+ */
+
+# include <mln/core/concept/value.hh>
+# include <mln/value/set.hh>
+# include <mln/value/concept/all.hh>
+
+
+namespace mln
+{
+
+ namespace value
+ {
+
+
+ /// Give an other value than \p val.
+ template <typename V>
+ V other(const V& val);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ template <typename V>
+ V
+ other_(const void*, const V& val) // Surely a builtin.
+ {
+ return val + 1;
+ }
+
+ bool
+ other_(const void*, const bool& val)
+ {
+ return ! val;
+ }
+
+
+ template <typename V>
+ V
+ other_(mln::trait::value::quant::high, const Value<V>& val_)
+ {
+ const V& val = exact(val_);
+ return val.other();
+ }
+
+ template <typename V>
+ V
+ other_(mln::trait::value::quant::high, const value::Scalar<V>& val_)
+ {
+ const V& val = exact(val_);
+ return (mln_max(V) - val) + mln_min(V);
+ }
+
+ template <typename V>
+ V
+ other_(mln::trait::value::quant::low, const Value<V>& val_)
+ {
+ const V& val = exact(val_);
+ value::set<V> s;
+ std::size_t i = s.index_of(val);
+ mln_assertion(s.nvalues() >= 2);
+ return i = 0 ? s[1] : s[0];
+ }
+
+ template <typename V>
+ V
+ other_(const Value<V>*, const V& val)
+ {
+ return other_(mln_trait_value_quant(V)(), val);
+ }
+
+ } // end of namespace mln::value::internal
+
+
+ template <typename V>
+ V other(const V& val)
+ {
+ V tmp = internal::other_(&val, val);
+ mln_postcondition(tmp != val);
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_OTHER_HH
Index: mln/value/internal/iterable_set.hh
--- mln/value/internal/iterable_set.hh (revision 1422)
+++ mln/value/internal/iterable_set.hh (working copy)
@@ -97,7 +97,6 @@
{
mln_precondition(i < nvalues());
return mln::value::internal::convert_<T>::value_at_index(i);
- // FIXME: Was: mln_min(T) + i;
}
template <typename T, typename E>
@@ -105,14 +104,14 @@
iterable_set<T,E>::index_of(const T& v) const
{
return mln::value::internal::convert_<T>::index_of_value(v);
- // FIXME: Was: v - mln_min(T);
}
template <typename T, typename E>
std::size_t
iterable_set<T,E>::nvalues() const
{
- return mln_card_(T);
+ typedef mln_trait_value_card(T) card_;
+ return card_::value;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/win/rectangle2d.hh
--- mln/win/rectangle2d.hh (revision 1422)
+++ mln/win/rectangle2d.hh (working copy)
@@ -190,7 +190,7 @@
-// when rectangle2d is involved, one surely also wants:
+// When rectangle2d is involved, one surely also wants:
# include <mln/win/hline2d.hh>
# include <mln/win/vline2d.hh>
Index: mln/win/octagon2d.hh
--- mln/win/octagon2d.hh (revision 1422)
+++ mln/win/octagon2d.hh (working copy)
@@ -207,7 +207,7 @@
-// when rectangle2d is involved, one surely also wants:
+// When rectangle2d is involved, one surely also wants:
# include <mln/win/hline2d.hh>
# include <mln/win/vline2d.hh>
# include <mln/win/diag2d.hh>
Index: mln/canvas/labeling.hh
--- mln/canvas/labeling.hh (revision 1422)
+++ mln/canvas/labeling.hh (working copy)
@@ -181,12 +181,14 @@
initialize(parent, f.input);
f.nlabels = 0;
f.init();
+ // make_set for all points:
+ for (unsigned p = 0; p < parent.ncells(); ++p)
+ parent[p] = p;
}
// first pass
{
mln_bkd_pixter(const I) p(f.input);
- // mln_nixter(const I, N) n(p, f.nbh);
typedef window<mln_dpoint(I)> W;
W win = mln::convert::to_upper_window(f.nbh);
@@ -194,7 +196,7 @@
for_all(p) if (f.handles(p))
{
- make_set(p);
+ f.init_attr(p);
for_all(n)
if (f.equiv(n, p))
do_union(n, p);
@@ -228,12 +230,6 @@
} // end of run()
- void make_set(unsigned p)
- {
- parent[p] = p;
- f.init_attr(p);
- }
-
bool is_root(unsigned p) const
{
return parent[p] = p;
Index: mln/labeling/level.hh
--- mln/labeling/level.hh (revision 1422)
+++ mln/labeling/level.hh (working copy)
@@ -38,6 +38,8 @@
# include <mln/labeling/base.hh>
# include <mln/level/fill.hh>
# include <mln/border/resize.hh>
+# include <mln/border/fill.hh>
+# include <mln/value/other.hh>