URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-05-28 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Move tests for component tree filtering.
* mln/morpho/tree/filter/filter.hh:
Special increasing attribute filtering routine.
* tests/morpho/tree/Makefile.am,
* tests/morpho/tree/filter/Makefile.am,
* tests/morpho/tree/filter/filter.cc,
* tests/morpho/tree/filter,
* tests/unit_test/unit-tests.mk,
Tests for tree filtering.
---
mln/morpho/tree/filter/filter.hh | 99 ++++++++++++++++++++++++++++++
tests/morpho/tree/Makefile.am | 3
tests/morpho/tree/filter/Makefile.am | 10 +++
tests/morpho/tree/filter/filter.cc | 114 +++++++++++++++++++++++++++++++++++
tests/unit_test/unit-tests.mk | 20 ++++++
5 files changed, 246 insertions(+)
Index: trunk/milena/tests/morpho/tree/filter/Makefile.am
===================================================================
--- trunk/milena/tests/morpho/tree/filter/Makefile.am (revision 0)
+++ trunk/milena/tests/morpho/tree/filter/Makefile.am (revision 3898)
@@ -0,0 +1,10 @@
+## Process this file through Automake to create Makefile.in.
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ filter
+
+filter_SOURCES = filter.cc
+
+TESTS = $(check_PROGRAMS)
Property changes on: trunk/milena/tests/morpho/tree/filter/Makefile.am
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/tests/morpho/tree/filter/filter.cc
===================================================================
--- trunk/milena/tests/morpho/tree/filter/filter.cc (revision 0)
+++ trunk/milena/tests/morpho/tree/filter/filter.cc (revision 3898)
@@ -0,0 +1,114 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// 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/morpho/tree/filter/filter.cc
+///
+/// Test on:
+/// mln::morpho::reconstruction::filter::min
+/// mln::morpho::reconstruction::filter::max
+/// mln::morpho::reconstruction::filter::direct
+/// mln::morpho::reconstruction::filter::subtractive
+
+
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/var.hh>
+#include <mln/pw/all.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/level/sort_psites.hh>
+#include <mln/morpho/tree/data.hh>
+#include <mln/morpho/tree/compute_attribute_image.hh>
+#include <mln/morpho/attribute/card.hh>
+
+#include <mln/morpho/tree/filter/all.hh>
+#include <mln/morpho/tree/propagate_representative.hh>
+
+#include <mln/morpho/closing/area.hh>
+
+#include "tests/data.hh"
+
+#include <iostream>
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+
+ typedef image2d<int_u8> I;
+ I input;
+ io::pgm::load(input, MLN_IMG_DIR "/tiny.pgm");
+
+ typedef p_array< mln_site_(I) > S;
+ typedef morpho::tree::data<I,S> tree_t;
+
+ S sorted_sites = level::sort_psites_decreasing(input);
+ tree_t tree(input, sorted_sites, c4());
+
+ // Test with increasing attribute -> area closing.
+ {
+ typedef morpho::attribute::card<I> attribute_t;
+ typedef mln_ch_value_(I, unsigned) A;
+
+ A a = morpho::tree::compute_attribute_image(attribute_t (), tree);
+
+ unsigned lambda = 5;
+ mln_VAR(predicate, pw::value(a) >= pw::cst(lambda));
+ I ref = morpho::closing::area(input, c4(), lambda);
+
+ {
+ I out = duplicate(input);
+ morpho::tree::filter::min(tree, out, predicate);
+ morpho::tree::propagate_representative(tree, out);
+ mln_assertion(out == ref);
+ }
+
+ {
+ I out = duplicate(input);
+ morpho::tree::filter::max(tree, out, predicate);
+ morpho::tree::propagate_representative(tree, out);
+ mln_assertion(out == ref);
+ }
+
+ {
+ I out = duplicate(input);
+ morpho::tree::filter::direct(tree, out, predicate);
+ morpho::tree::propagate_representative(tree, out);
+ mln_assertion(out == ref);
+ }
+
+ // Not for subtractive strategy (removal procedure differs).
+ }
+}
+
+
Index: trunk/milena/tests/morpho/tree/Makefile.am
===================================================================
--- trunk/milena/tests/morpho/tree/Makefile.am (revision 3897)
+++ trunk/milena/tests/morpho/tree/Makefile.am (revision 3898)
@@ -14,3 +14,6 @@
max_SOURCES = max.cc
TESTS = $(check_PROGRAMS)
+
+SUBDIRS = \
+ filter
\ No newline at end of file
Index: trunk/milena/tests/unit_test/unit-tests.mk
===================================================================
--- trunk/milena/tests/unit_test/unit-tests.mk (revision 3897)
+++ trunk/milena/tests/unit_test/unit-tests.mk (revision 3898)
@@ -921,7 +921,16 @@
mln_morpho_tree_compute_attribute_image \
mln_morpho_tree_compute_parent \
mln_morpho_tree_data \
+mln_morpho_tree_filter_all \
+mln_morpho_tree_filter_direct \
+mln_morpho_tree_filter_filter \
+mln_morpho_tree_filter_max \
+mln_morpho_tree_filter_min \
+mln_morpho_tree_filter_subtractive \
mln_morpho_tree_max \
+mln_morpho_tree_propagate_if \
+mln_morpho_tree_propagate_node \
+mln_morpho_tree_propagate_representative \
mln_morpho_tree_utils \
mln_morpho_watershed_all \
mln_morpho_watershed_flooding \
@@ -1222,6 +1231,7 @@
mln_value_stack \
mln_value_super_value \
mln_value_viter \
+mln_version \
mln_win_all \
mln_win_backdiag2d \
mln_win_ball \
@@ -2183,7 +2193,16 @@
mln_morpho_tree_compute_attribute_image_SOURCES = mln_morpho_tree_compute_attribute_image.cc
mln_morpho_tree_compute_parent_SOURCES = mln_morpho_tree_compute_parent.cc
mln_morpho_tree_data_SOURCES = mln_morpho_tree_data.cc
+mln_morpho_tree_filter_all_SOURCES = mln_morpho_tree_filter_all.cc
+mln_morpho_tree_filter_direct_SOURCES = mln_morpho_tree_filter_direct.cc
+mln_morpho_tree_filter_filter_SOURCES = mln_morpho_tree_filter_filter.cc
+mln_morpho_tree_filter_max_SOURCES = mln_morpho_tree_filter_max.cc
+mln_morpho_tree_filter_min_SOURCES = mln_morpho_tree_filter_min.cc
+mln_morpho_tree_filter_subtractive_SOURCES = mln_morpho_tree_filter_subtractive.cc
mln_morpho_tree_max_SOURCES = mln_morpho_tree_max.cc
+mln_morpho_tree_propagate_if_SOURCES = mln_morpho_tree_propagate_if.cc
+mln_morpho_tree_propagate_node_SOURCES = mln_morpho_tree_propagate_node.cc
+mln_morpho_tree_propagate_representative_SOURCES = mln_morpho_tree_propagate_representative.cc
mln_morpho_tree_utils_SOURCES = mln_morpho_tree_utils.cc
mln_morpho_watershed_all_SOURCES = mln_morpho_watershed_all.cc
mln_morpho_watershed_flooding_SOURCES = mln_morpho_watershed_flooding.cc
@@ -2484,6 +2503,7 @@
mln_value_stack_SOURCES = mln_value_stack.cc
mln_value_super_value_SOURCES = mln_value_super_value.cc
mln_value_viter_SOURCES = mln_value_viter.cc
+mln_version_SOURCES = mln_version.cc
mln_win_all_SOURCES = mln_win_all.cc
mln_win_backdiag2d_SOURCES = mln_win_backdiag2d.cc
mln_win_ball_SOURCES = mln_win_ball.cc
Index: trunk/milena/mln/morpho/tree/filter/filter.hh
===================================================================
--- trunk/milena/mln/morpho/tree/filter/filter.hh (revision 0)
+++ trunk/milena/mln/morpho/tree/filter/filter.hh (revision 3898)
@@ -0,0 +1,99 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// 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_MORPHO_TREE_FILTER_FILTER_HH_
+# define MLN_MORPHO_TREE_FILTER_FILTER_HH_
+
+/**
+** \file mln/morpho/tree/filter/filter.hh
+**
+**
+*/
+
+# include <mln/core/concept/function.hh>
+# include <mln/morpho/tree/data.hh>
+# include <mln/morpho/tree/propagate_if.hh>
+
+namespace mln {
+ namespace morpho {
+ namespace tree {
+ namespace filter {
+
+
+ /**
+ ** Filter the image \p f_ with a given value. The
+ ** sub-components of nodes that does not match the predicate
+ ** \p pred_ are filled with the given value \p v.
+ **
+ ** @param tree Component tree.
+ ** @param f_ Image function.
+ ** @param pred_ Predicate.
+ ** @param v Value to propagate.
+ */
+ template <typename T, typename F, typename P2B>
+ inline
+ void
+ filter(const T& tree, Image<F>& f_, const Function_p2b<P2B>& pred_, const mln_value(F)& v);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T, typename F, typename P2B>
+ inline
+ void
+ filter(const T& tree, Image<F>& f_, const Function_p2b<P2B>& pred_, const mln_value(F)& v)
+ {
+ F& f = exact(f_);
+ const P2B& pred = exact(pred_);
+
+ trace::entering("mln::morpho::tree::filter::filter");
+
+ mln_ch_value(F, bool) mark;
+ initialize(mark, f);
+ mln::data::fill(mark, false);
+
+ mln_dn_node_piter(T) n(tree);
+ for_all(n)
+ if (mark(tree.parent(n)) || !pred(n))
+ {
+ f(n) = v;
+ mark(n) = true;
+ }
+
+ trace::exiting("mln::morpho::tree::filter::filter");
+ }
+
+# endif /* !MLN_INCLUDE_ONLY */
+
+ } // end of namespace mln::morpho::tree::filter
+ } // end of namespace mln::morpho::tree
+ } // end of namespace mln::morpho
+} // end of namespace mln
+
+
+#endif /* !MLN_MORPHO_TREE_FILTER_FILTER_HH_ */
Property changes on: trunk/milena/mln/morpho/tree/filter/filter.hh
___________________________________________________________________
Added: svn:mergeinfo
#178: Improve the way Trimesh is handled within Olena
----------------------------------------+-----------------------------------
Reporter: levill_r | Owner: Olena Team
Type: enhancement | Status: new
Priority: major | Milestone: Olena 1.0
Component: Olena | Version: 1.0
Keywords: distribution configuration |
----------------------------------------+-----------------------------------
Motivation/rationale:
1. Most Olena users do not want Trimesh.
1. We probably get rid of Trimesh someday (I need to check-in some
replacement code first!).
To do:
* Add a `--with-trimesh` option in source:trunk/configure.ac, along with
an Automake conditional (e.g., `WITH_TRIMESH`), set to `no` by default.
* Use this conditional to enable/disable the trimesh directory in the
`SUBDIRS` variable of source:trunk/external/Makefile.am.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/178>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
#86: Simplify the creation and maintenance of Makefile.am's under milena/tests/
--------------------------+-------------------------------------------------
Reporter: levill_r | Owner: levill_r
Type: enhancement | Status: new
Priority: minor | Milestone: Olena 1.1
Component: Milena | Version: 1.0
Resolution: | Keywords:
--------------------------+-------------------------------------------------
Changes (by levill_r):
* milestone: Olena 1.0 => Olena 1.1
Old description:
> Currently, a `Makefile.am` in a subdirectory of `milena/tests/`, e.g.
> `milena/tests/foo/Makefile.am` looks like this:
>
> {{{
> ## Process this file through Automake to create Makefile.in -*- Makefile
> -*-
>
> include $(top_srcdir)/milena/tests/tests.mk
>
> check_PROGRAMS = \
> bar \
> baz
>
> bar_SOURCES = bar.cc
> baz_SOURCES = baz.cc
>
> TESTS = $(check_PROGRAMS)
> }}}
>
> But as the `check_PROGRAMS` variable grows, so does the number of
> `*_SOURCES` variables.
>
> Automake provides a solution to handle this more or less nicely when
> tests are written in the C language: when a program `quux` listed in
> `check_PROGRAMS` has no corresponding `quux_SOURCES`, Automake acts as if
> the following line were written in the `Makefile.am`:
>
> quux_SOURCES = quux.c
>
> It would be nice from Automake to provide an option to change the
> extension of this pattern from `.c` to `.cc`. Unfortunalety, we cannot.
> :-(
>
> A solution would be to ''generate'' the list of sources with a shell
> script, as we do it in the `Makefile.am`'s of the tests of the Tiger
> Compiler project. I we do so, careful with the dependencies!
New description:
Currently, a `Makefile.am` in a subdirectory of `milena/tests/`, e.g.
`milena/tests/foo/Makefile.am` looks like this:
{{{
## Process this file through Automake to create Makefile.in -*- Makefile
-*-
include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
bar \
baz
bar_SOURCES = bar.cc
baz_SOURCES = baz.cc
TESTS = $(check_PROGRAMS)
}}}
But as the `check_PROGRAMS` variable grows, so does the number of
`*_SOURCES` variables.
Automake provides a solution to handle this more or less nicely when tests
are written in the C language: when a program `quux` listed in
`check_PROGRAMS` has no corresponding `quux_SOURCES`, Automake acts as if
the following line were written in the `Makefile.am`:
quux_SOURCES = quux.c
It would be nice from Automake to provide an option to change the
extension of this pattern from `.c` to `.cc`. Unfortunalety, we cannot.
:-(
A solution would be to ''generate'' the list of sources with a shell
script, as we do it in the `Makefile.am`'s of the tests of the Tiger
Compiler project. If we do so, be careful with the dependencies!
--
Comment:
Not a real requirement for [milestone:"Olena 1.0" Olena 1.0]; postponing.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/86#comment:1>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
#95: Create an Olena 1.x port for the MacPorts (Mac OS X)
-----------------------+----------------------------------------------------
Reporter: levill_r | Owner: Olena Team
Type: task | Status: new
Priority: minor | Milestone: Olena 1.1
Component: Milena | Version: 1.0
Resolution: | Keywords:
-----------------------+----------------------------------------------------
Changes (by levill_r):
* milestone: Olena 1.0 => Olena 1.1
Comment:
Not a hard requirement for [milestone:"Olena 1.0" Olena 1.0]; postponing.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/95#comment:3>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
#95: Create an Olena 1.0 port for the MacPorts (Mac OS X)
-----------------------+----------------------------------------------------
Reporter: levill_r | Owner: Olena Team
Type: task | Status: new
Priority: minor | Milestone: Olena 1.0
Component: Milena | Version: 1.0
Resolution: | Keywords:
-----------------------+----------------------------------------------------
Old description:
> Don't forget to add the right dependencies (and suggested packages, if
> available).
>
> Don't mess with the numbering scheme: think about it twice! For
> instance, keep in mind that `1.0a` is after `1.0` in the lexical order.
> Find some documentation about this.
>
> Ideas:
> * Create packages for the different variant of Darwin (at least Tiger
> and Leopard).
> * Several packages might be useful (not necessarily for the 1.0 release,
> but later). E.g., a package (possibly virtual) for Olena, and another
> one for Milena.
>
> See also #93 and #94.
New description:
Don't forget to add the right dependencies (and suggested packages, if
available).
Don't mess up with the numbering scheme: think about it twice! For
instance, keep in mind that `1.0a` is after `1.0` in the lexical order.
Find some documentation about this.
Ideas:
* Create packages for the different variants of Darwin (at least Tiger
and Leopard).
* Several packages might be useful (not necessarily for the 1.0 release,
but later). E.g., a package (possibly virtual) for Olena, and another one
for Milena.
See also #93 and #94.
--
Comment(by levill_r):
Typos.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/95#comment:2>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
#106: Implement border::mirror for 3D images
----------------------+-----------------------------------------------------
Reporter: duhamel | Owner: Olena Team
Type: task | Status: new
Priority: major | Milestone: Olena 1.0
Component: Milena | Version: 1.0
Resolution: | Keywords:
----------------------+-----------------------------------------------------
Changes (by levill_r):
* priority: minor => major
Old description:
> In source:trunk/milena/mln/border/mirror.hh
>
> Implement 1d and 3d version for border::mirror algorithm.
New description:
In source:trunk/milena/mln/border/mirror.hh.
Implement ~~1D and~~ 3D version for `border::mirror` algorithm.
Note that the code for the 2D (and maybe 1D) version(s) could be factored.
--
--
Ticket URL: <https://trac.lrde.org/olena/ticket/106#comment:2>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.