Commit ae793da6 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Small fixes.

	* headers.mk: update distributed header list.

	* doc/ref_guide/ref_guide.tex: update reference to clone().

	* doc/tutorial/tutorial.tex: fix references.

	* mln/accu/center.hh: Fix meta accu.

	* mln/canvas/browsing/depth_first_search.hh: update functor interface.

	* mln/core/concept/function.hh: Introduce Function_i2b.

	* mln/debug/colorize.hh: call srand.

	* mln/fun/i2v/array.hh: update from_to overloads: add a special case
	for element[0].

	* mln/io/pgm/save.hh: Check if the image is compatible with pgm
	format.

	* mln/labeling/level.hh,
	* mln/labeling/regional_maxima.hh: avoid warnings.

	* mln/labeling/relabel.hh: update call to make::relabelfun.

	* mln/make/graph.hh: adjust extension to structural element.

	* mln/util/array.hh:
	  - add subject_impl specialization.
	  - Update from_to overloads: add a special case for element[0].

	* tests/accu/site_set/rectangularity.cc: add more tests.

	* tests/unit_test/unit-tests.mk: update unit test list.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3569 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 4d468626
2009-03-24 Guillaume Lazzara <lazzara@lrde.epita.fr>
Small fixes.
* headers.mk: update distributed header list.
* doc/Doxyfile.in: Do not use mln:: prefix in class name lists.
* doc/ref_guide/ref_guide.tex: update reference to clone().
* doc/tutorial/tutorial.tex: fix references.
* mln/accu/center.hh: Fix meta accu.
* mln/canvas/browsing/depth_first_search.hh: update functor interface.
* mln/core/concept/function.hh: Introduce Function_i2b.
* mln/debug/colorize.hh: call srand.
* mln/fun/i2v/array.hh: update from_to overloads: add a special case
for element[0].
* mln/io/pgm/save.hh: Check if the image is compatible with pgm
format.
* mln/labeling/level.hh,
* mln/labeling/regional_maxima.hh: avoid warnings.
* mln/labeling/relabel.hh: update call to make::relabelfun.
* mln/make/graph.hh: adjust extension to structural element.
* mln/util/array.hh:
- add subject_impl specialization.
- Update from_to overloads: add a special case for element[0].
* tests/accu/site_set/rectangularity.cc: add more tests.
* tests/unit_test/unit-tests.mk: update unit test list.
2009-03-24 Guillaume Lazzara <lazzara@lrde.epita.fr>
 
Fix compilation issues with Cygwin.
......@@ -118,7 +118,7 @@ VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
IGNORE_PREFIX = mln::
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
......
......@@ -1483,7 +1483,7 @@ variable behaves like some mathematical variable. Put differently it is just a
name to designate an image:
\doxycode{ima2d-5}
If a deep copy of the image is needed, a clone() routine is available:
If a deep copy of the image is needed, a duplicate() routine is available:
\doxycode{ima2d-6-clone}
Output:
\doxyoutput{ima2d-6-clone}
......@@ -1499,7 +1499,7 @@ Output:
\begin{tabular}{l|p{8cm}}
\hline
Routine name & Description \\ \hline
level::clone() & creates a deep copy of an object. Any shared data is
duplicate() & creates a deep copy of an object. Any shared data is
duplicated. \\
data::fill() & fill an object with a value. \\
......
......@@ -318,7 +318,6 @@ $$
\backslash endhtmlonly
\backslash page tutorial Tutorial
- \backslash subpage tuto0
- \backslash subpage tuto1
- \backslash subpage tuto2
- \backslash subpage tuto3
......@@ -347,7 +346,6 @@ A copy of the license is provided in the file COPYING.DOC.
\tableofcontents
\end{latexonly}
%\begin{htmlonly}
%====================================
\doxychapter{tuto1}{Welcome}
......@@ -475,7 +473,7 @@ We invite you to take a look at the description of the directory structure
(\ref{tuto1dirstruct}.
If you encounter any issues in the installation process or if you have any
question, do not forget to join the mailing lists (\ref{tuto1mailinglists}
and/or use the other documentations ressources (\ref{tuto1ressources}).
and/or use the other documentations ressources (\ref{tuto1documentation}).
......@@ -488,11 +486,7 @@ and/or use the other documentations ressources (\ref{tuto1ressources}).
Milena's packages can be downloaded from:
\begin{center}
\begin{verbatim}
http://www.lrde.epita.fr/Olena/Download
\end{verbatim}
\end{center}
\href{http://www.lrde.epita.fr/Olena/Download}
On this page you will find the latest and past releases.
Currently, we provide only '.tar.gz' and 'tar.bz2' archives.
......@@ -521,7 +515,7 @@ We invite you to take a look at the description of the directory structure
(\ref{tuto1dirstruct}.
If you encounter any issues in the installation process or if you have any
question, do not forget to join the mailing lists (\ref{tuto1mailinglists}
and/or use the other documentations ressources (\ref{tuto1ressources}).
and/or use the other documentations ressources (\ref{tuto1documentation}).
......@@ -666,7 +660,7 @@ List of \hpath{doc}'s subdirectories:
%**************************
\doxysection{tuto1ressources}{Documentation}
\doxysection{tuto1documentation}{Documentation}
This tutorial is not the only documentation of Milena. Other documents are available:
......@@ -696,7 +690,7 @@ This tutorial is not the only documentation of Milena. Other documents are avail
%**************************
\doxysection{tuto1ressources}{Community and Support}
\doxysection{tuto1community}{Community and Support}
Even though Milena is currently developped by the LRDE in EPITA, we are open
for new contributors.
......@@ -730,23 +724,27 @@ the mailing-lists (\ref{tuto1mailinglists}).
There are other ways to get to know what is the status of the project.
\begin{itemize}
\item Olena's trac --- \href{https://trac.lrde.org/olena} --- Here is the
roadmap, the current open tickets/bugs/improvements which are taken in
consideration. A source browser is also available.
\item Olena's Buildfarm --- https://buildfarm.lrde.org/buildfarm/oln/ --- The
official buildfarm. Every night and after each commit, tests are compiled and run.
The buildfarm can show you whether it is safe to update your svn copy of Milena or not\ldots
\item Test failures --- http://www.lrde.epita.fr/dload/olena/test-failures-daily.html
--- Through this page, you can see exactly which tests do not compile or pass.
This page is updated every night.
\item Olena's trac\\
\href{https://trac.lrde.org/olena} \\
Here is the roadmap, the current open tickets/bugs/improvements which
are taken in consideration. A source browser is also available.
\item Olena's Buildfarm \\
\href{https://buildfarm.lrde.org/buildfarm/oln/} \\
The official buildfarm. Every night and after each commit, tests
are compiled and run. The buildfarm can show you whether it is safe
to update your svn copy of Milena or not\ldots
\item Test failures
\href{http://www.lrde.epita.fr/dload/olena/test-failures-daily.html}
Through this page, you can see exactly which tests do not compile or pass.
This page is updated every night.
\end{itemize}
%**************************
\doxysection{tuto1ressources}{A brief history of Milena}
\doxysection{tuto1briefhistory}{A brief history of Milena}
The Olena project aims at building a scientific computation platform oriented
towards image processing, image recognition, and artificial vision.
......@@ -787,7 +785,6 @@ If you want to reach us directly, you can contact one of the following people:
%\begin{htmlonly}
%====================================
\doxychapter{tuto2}{Installation}
......@@ -960,7 +957,7 @@ Text and image outputs will be respectively stored in
\doxysubsection{tuto2examples}{Tools}
\doxysubsection{tuto2tools}{Tools}
Few tools are provided with Milena. They can be considered as full program
examples.
......@@ -979,7 +976,7 @@ $ make
\end{verbatim}
\doxysubsection{tuto2examples}{Tests}
\doxysubsection{tuto2tests}{Tests}
The test suite used for Milena's development is shipped with the library.
......@@ -1008,7 +1005,6 @@ In the installed path prefix, Milena's files are located in:
%\begin{htmlonly}
%====================================
\doxychapter{tuto3}{Getting started with Milena}
......
......@@ -116,7 +116,6 @@ mln/data/all.hh \
mln/data/paste.hh \
mln/data/fill_with_image.hh \
mln/data/fill_with_image.spe.hh \
mln/data/swap.hh \
mln/data/fill_with_value.hh \
mln/data/fill_with_value.spe.hh \
mln/data/fill.hh \
......@@ -331,6 +330,7 @@ mln/value/all.hh \
mln/value/super_value.hh \
mln/value/builtin/symbolics.hh \
mln/value/builtin/ops.hh \
mln/value/builtin/carrays.hh \
mln/value/builtin/all.hh \
mln/value/builtin/promotions.hh \
mln/value/builtin/integers.hh \
......@@ -373,6 +373,9 @@ mln/value/label_8.hh \
mln/value/essential.hh \
mln/accu/tuple.hh \
mln/accu/min_h.hh \
mln/accu/site_set/rectangularity.hh \
mln/accu/site_set/all.hh \
mln/accu/site_set/essential.hh \
mln/accu/stat/deviation.hh \
mln/accu/max.hh \
mln/accu/lor.hh \
......@@ -380,6 +383,7 @@ mln/accu/rank.hh \
mln/accu/transform_stop.hh \
mln/accu/maj_h.hh \
mln/accu/min_max.hh \
mln/accu/internal/couple.hh \
mln/accu/internal/base.hh \
mln/accu/transform_snake.hh \
mln/accu/rank_high_quant.hh \
......@@ -417,6 +421,7 @@ mln/accu/image/all.hh \
mln/accu/image/set_value.hh \
mln/accu/image/take.hh \
mln/accu/image/take_as_init.hh \
mln/accu/image/essential.hh \
mln/accu/center.hh \
mln/accu/line.hh \
mln/accu/essential.hh \
......@@ -479,8 +484,11 @@ mln/trait/promote.hh \
mln/trait/solve_binary.hh \
mln/trait/value_.hh \
mln/trait/all.hh \
mln/trait/value/internal/all.hh \
mln/trait/value/internal/comp.hh \
mln/trait/value/all.hh \
mln/trait/value/nature.hh \
mln/trait/value/comp.hh \
mln/trait/value/quant.hh \
mln/trait/value/kind.hh \
mln/trait/value/print.hh \
......@@ -651,7 +659,6 @@ mln/morpho/closing/leveling.hh \
mln/morpho/closing/area_on_vertices.hh \
mln/morpho/closing/area.hh \
mln/morpho/closing/volume.hh \
mln/morpho/closing/sum.hh \
mln/morpho/closing/height.hh \
mln/morpho/closing/structural.hh \
mln/morpho/closing/essential.hh \
......@@ -1021,6 +1028,7 @@ mln/test/predicate.hh \
mln/test/all.hh \
mln/test/positive.hh \
mln/test/essential.hh \
mln/transform/distance_and_closest_point_geodesic.hh \
mln/transform/distance_geodesic.hh \
mln/transform/internal/all.hh \
mln/transform/internal/closest_point_functor.hh \
......@@ -1028,9 +1036,9 @@ mln/transform/internal/distance_functor.hh \
mln/transform/internal/influence_zone_functor.hh \
mln/transform/all.hh \
mln/transform/influence_zone_front.hh \
mln/transform/distance_and_influence_zone_geodesic.hh \
mln/transform/distance_front.hh \
mln/transform/influence_zone_geodesic.hh \
mln/transform/closest_point_geodesic.hh \
mln/transform/essential.hh \
mln/arith/includes.hh \
mln/arith/min.spe.hh \
......
......@@ -84,10 +84,10 @@ namespace mln
struct center : public Meta_Accumulator< center >
{
template <typename P, typename V>
template <typename P>
struct with
{
typedef accu::center<P, V> ret;
typedef accu::center<P> ret;
};
};
......@@ -136,6 +136,7 @@ namespace mln
V
center<P,V>::to_result() const
{
mln_precondition(is_valid());
return center_ / nsites_;
}
......
......@@ -103,26 +103,26 @@ namespace mln
mln_vertex_iter(G) v(g);
for_all(v)
if (f.to_be_treated(v.id()))
if (f.to_be_treated(v.id())) // <--- to_be_treated
{
std::queue<unsigned> queue;
queue.push(v.id());
f.update_treated(v.id());
f.new_component_from_vertex(v.id()); // <--- new_component_from_vertex
while (!queue.empty())
{
util::vertex<G> current_v = g.vertex(queue.front());
f.process_vertex(current_v);
queue.pop();
for (unsigned nv = 0; nv < current_v.nmax_nbh_vertices(); ++nv)
if (f.to_be_queued(current_v.ith_nbh_vertex(nv)))
if (f.to_be_queued(current_v.ith_nbh_vertex(nv))) // <--- to_be_queued
{
f.update_queued(current_v.ith_nbh_vertex(nv));
f.added_to_queue(current_v.ith_nbh_vertex(nv)); // <--- added_to_queue
queue.push(current_v.ith_nbh_vertex(nv));
}
}
f.next();
f.next_component(); // <-- next_component
}
f.final();
f.final(); // <-- final
trace::exiting("canvas::browsing::depth_first_search");
}
......
......@@ -44,6 +44,7 @@ namespace mln
template <typename E> struct Function_v2v;
template <typename E> struct Function_v2w2v;
template <typename E> struct Function_v2w_w2v;
template <typename E> struct Function_i2b;
template <typename E> struct Function_i2v;
template <typename E> struct Function_p2v;
template <typename E> struct Function_v2b;
......@@ -175,6 +176,29 @@ namespace mln
};
/*-----------------.
| Index -> bool. |
`-----------------*/
template <>
struct Function_i2b<void> { typedef Function_v2b<void> super; };
/// Base class for implementation of function-objects from
/// index to value.
///
/// The parameter \a E is the exact type.
///
template <typename E>
struct Function_i2b : public Function_v2b<E>
{
typedef Function_i2b<void> category;
typedef bool result;
protected:
Function_i2b();
Function_i2b(const Function_i2b&);
};
/*-----------------.
| Index -> Value. |
`-----------------*/
......@@ -474,6 +498,20 @@ namespace mln
{
}
template <typename E>
inline
Function_i2b<E>::Function_i2b()
{
}
template <typename E>
inline
Function_i2b<E>::Function_i2b(const Function_i2b<E>& rhs)
: Function_v2b<E>(rhs)
{
}
template <typename E>
inline
Function_i2v<E>::Function_i2v()
......
......@@ -117,6 +117,7 @@ namespace mln
int diff_size = f.size() - label_count;
if (diff_size < 0)
{
srand(1);
f.resize(label_count);
unsigned i = f.size() + diff_size;
// We want to treat comp 0 differently since it is the background.
......
......@@ -43,7 +43,7 @@
# include <mln/core/concept/function.hh>
# include <mln/fun/internal/array_base.hh>
# include <mln/util/array.hh>
# include <mln/metal/equal.hh>
namespace mln
{
......@@ -102,16 +102,36 @@ namespace mln
namespace i2v
{
namespace internal
{
template <typename T, bool B = false >
struct array_selector_
: public Function_i2v< i2v::array<T> >
{
};
template <typename T>
struct array_selector_<T,true>
: public Function_i2b< i2v::array<T> >
{
};
} // end of namespace mln::fun::i2v::internal
template <typename T>
class array : public Function_i2v< array<T> >,
public internal::array_base<T>
class array : public internal::array_selector_<T,mlc_equal(T,bool)::value>,
public fun::internal::array_base<T>
{
typedef internal::array_base<T> super_base_;
typedef fun::internal::array_base<T> super_base_;
public:
/// Mutable result type. The function results can be modified.
typedef typename super_base_::mutable_result mutable_result;
typedef typename fun::internal::array_base<T>::result result;
/// Constructors
/// \{
......@@ -175,7 +195,15 @@ namespace mln
{
mlc_converts_to(T,U)::check();
for (unsigned i = 0; i < from.nelements(); ++i)
to.reserve(from.nelements());
//Special case. Handle background component data.
if (from[0].is_valid())
to.append(convert::to<U>(from[0]));
else
to.append(U());
for (unsigned i = 1; i < from.nelements(); ++i)
to.append(convert::to<U>(from[i]));
}
......@@ -194,7 +222,15 @@ namespace mln
{
mlc_converts_to(T,U)::check();
for (unsigned i = 0; i < from.size(); ++i)
to.reserve(from.nelements());
//Special case. Handle background component data.
if (from[0].is_valid())
to.append(convert::to<U>(from[0]));
else
to.append(U());
for (unsigned i = 1; i < from.size(); ++i)
to.append(convert::to<U>(from[i]));
}
......
......@@ -43,8 +43,9 @@
# include <mln/io/pnm/save.hh>
# include <mln/geom/size2d.hh>
# include <mln/metal/templated_by.hh>
# include <mln/metal/bexpr.hh>
# include <mln/metal/is_not_a.hh>
# include <mln/value/concept/vectorial.hh>
namespace mln
......@@ -78,11 +79,10 @@ namespace mln
inline
void save(const Image<I>& ima, const std::string& filename)
{
// FIXME : this is too restrictive. Check if I is compatible with PGM.
// mln::metal::or_<
// mln::metal::templated_by<mln_value(I), value::int_u >,
// mln::metal::templated_by<mln_value(I), value::int_u_sat >
// >::check();
// FIXME: Is it exhaustive?
mlc_is_not_a(mln_value(I), value::Vectorial)::check();
mlc_converts_to(mln_value(I),unsigned)::check();
trace::entering("mln::io::pgm::save");
io::pnm::save(PGM, exact(ima), filename);
trace::exiting("mln::io::pgm::save");
......
......@@ -111,9 +111,9 @@ namespace mln
bool handles(const P& p) const { return input(p) == val; }
bool equiv(const P& n, const P&) const { return input(n) == val; }
bool labels(const P&) const { return true; }
void do_no_union(const P& n, const P& p) {}
void do_no_union(const P&, const P&) {}
void init_attr(const P&) {}
void merge_attr(const P& r, const P& p) {}
void merge_attr(const P&, const P&) {}
// Fastest implementation
......
......@@ -95,7 +95,7 @@ namespace mln
// Fastest implementation
void init_() { data::fill(attr, true); }
bool handles_(unsigned p) const { return true; }
bool handles_(unsigned) const { return true; }
bool labels_(unsigned p) const { return attr.element(p); }
bool equiv_(unsigned n, unsigned p) const { return input.element(n) ==
input.element(p); }
......
......@@ -187,7 +187,7 @@ namespace mln
typedef fun::l2l::relabel<mln_value(I)> fv2v_t;
fv2v_t fv2v = make::relabelfun(fv2b, nlabels, new_nlabels);
mln_concrete(I) output = labeling::relabel(label, nlabels, new_nlabels, fv2v);
mln_concrete(I) output = labeling::relabel(label, new_nlabels, fv2v);
trace::exiting("labeling::relabel");
return output;
......
......@@ -34,6 +34,9 @@
/// Create a graph from an influence zone image.
///
/// \sa transform::influence_zone_geodesic.
///
/// \todo Add dispatch for fast images.
/// \todo Use an adjacency matrix when available in the library.
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
......@@ -100,6 +103,7 @@ namespace mln
mln::image2d<bool> adj(mln::box2d(nlabels.next(), nlabels.next()));
data::fill(adj, false);
extension::adjust_fill(iz, nbh, 0u);
typedef mln_value(I) L;
mln_piter(I) p(iz.domain());
......
......@@ -56,7 +56,6 @@ namespace mln
} // end of namespace mln::util
namespace convert
{
......@@ -174,8 +173,12 @@ namespace mln
/// Operator<<.
template <typename T>
std::ostream& operator<<(std::ostream& ostr,
const mln::util::array<T>& a);
const array<T>& a);
/// Operator==
template <typename T>
bool operator==(const array<T>& lhs,
const array<T>& rhs);
// array_fwd_iter<T>
......@@ -272,6 +275,48 @@ namespace mln
} // end of namespace mln::util
namespace internal
{
template <typename T, typename E>
struct subject_impl<const util::array<T>&, E>
{
unsigned nelements() const;
bool is_empty() const;
const T& operator[](unsigned i) const;
const std::vector<T>& std_vector() const;
private:
const E& exact_() const;
};
template <typename T, typename E>
struct subject_impl<util::array<T>&, E>
: subject_impl<const util::array<T>&, E>
{
void reserve(unsigned n);
void resize(unsigned n);
void resize(unsigned n, const T& value);
util::array<T>& append(const T& elt);
template <typename U>
util::array<T>& append(const util::array<U>& other);
T& operator[](unsigned i);
void clear();
std::vector<T>& hook_std_vector_();
private: