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
- 9625 discussions
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Check correct filtering.
* jardonnet/n_cmpt/n_cmpt3.hh: Update, Fix, Remove.
* jardonnet/n_cmpt/test3.cc: Volume closing.
n_cmpt3.hh | 91 ++++++++++++++++++++++++++++---------------------------------
test3.cc | 36 ++++++++++++++++++++++++
2 files changed, 78 insertions(+), 49 deletions(-)
Index: jardonnet/n_cmpt/n_cmpt3.hh
--- jardonnet/n_cmpt/n_cmpt3.hh (revision 2982)
+++ jardonnet/n_cmpt/n_cmpt3.hh (working copy)
@@ -50,21 +50,6 @@
# ifndef MLN_INCLUDE_ONLY
template<typename I>
- mln_ch_value(I, util::set<mln_psite(I)>)
- minima_sets(const I& ima)
- {
- mln_ch_value(I, util::set<mln_psite(I)>) ima_set(ima.domain());
-
- mln_piter(I) p(ima.domain());
- for_all(p)
- {
- if (ima(p) != literal::zero)
- ima_set(p).insert(p);
- }
- return ima_set;
- }
-
- template <typename I>
inline
mln_psite(I)
find_root(I& parent,
@@ -96,6 +81,8 @@
{
unsigned label;
+ debug::println(ima);
+
// get /ima/ regional minima
mln_ch_value(I, unsigned) min = labeling::regional_minima(ima, nbh, label);
std::cout << "/ima/ regional minima" << std::endl;
@@ -105,9 +92,12 @@
typedef p_array<mln_psite(I)> S;
typedef image2d<unsigned> V;
typedef accu::volume<I> A;
+
S sp = level::sort_psites_decreasing(ima);
morpho::tree::data<I,S> t(ima, sp, nbh);
V volume = morpho::tree::compute_attribute_image(A(), t);
+ sp = level::sort_psites_increasing(volume);
+ debug::println(volume);
// get /volume/ regional minima
mln_ch_value(I, unsigned) min_v = labeling::regional_minima(volume, nbh, label);
@@ -117,38 +107,39 @@
// tester minima de ima == minima de attr
//mln_assertion(min == min_v);
- mln_ch_value(I, util::set<mln_psite(I)>) volume_set = minima_sets(volume);
+ mln_ch_value(I, util::set<unsigned>) volume_set;
+ initialize(volume_set, min_v);
// number of minima
- int cmpts = count_minima(min_v);
+ int cmpts = label;
std::cout << "Nb of regionnal minima : " << cmpts << std::endl;
// prepare union find
typedef mln_psite(V) P;
//data
- mln_ch_value(V, accu::volume<V>) data;
- initialize(data, volume);
+ mln_ch_value(V, accu::volume<V>) data(volume.domain());
//deja_vu
- mln_ch_value(V, bool) deja_vu;
- initialize(deja_vu, volume);
+ mln_ch_value(V, bool) deja_vu(volume.domain());
mln::level::fill(deja_vu, false);
//parent
- mln_ch_value(V, P) parent;
- initialize(parent, volume);
+ mln_ch_value(V, P) parent(volume.domain());
{
mln_fwd_piter(S) p(sp);
for_all(p)
+ {
parent(p) = p;
+ if (min_v(p) != 0) // p in a reg min of the attribute image
+ volume_set(p).insert(min_v(p));
+ }
}
+ debug::println(volume_set);
// union find sur volume
mln_fwd_piter(S) p(sp);
mln_niter(N) n(nbh, p);
for_all(p)
{
- // Make set.
- data(p).take_as_init(make::pix(volume, p));
for_all(n)
{
if (volume.domain().has(n) && deja_vu(n))
@@ -157,31 +148,30 @@
P r = find_root(parent, n);
if (r != p)
{
- if (volume(r) != volume(p) && (data(p).to_result() > lambda))
- {
- data(p).set_value(lambda);
- continue;
- }
-
- if (volume(r) != volume(p))
- {
- std::cout << "1: volume"<<r<<" != volume"<<p<<"" << " with data"<<p<< " = " <<
- data(p).to_result() << std::endl;
- if (not volume_set(p).is_empty())
- {
- std::cout << "2: not volume_set"<<p<<".is_empty()" << std::endl;
- if (volume_set(p) != volume_set(r))
- {
- std::cout << "3: volume_set"<<p<<" != volume_set"<<r<< std::endl;
- cmpts--;
- }
- }
- }
+ if (volume(p) > lambda)
+ goto step2;
+// if (volume(r) != volume(p) && (data(p).to_result() > lambda))
+// {
+// data(p).set_value(lambda);
+// continue;
+// }
+
+// if (volume(r) != volume(p))
+// {
+// std::cout << "1: volume"<<r<<" != volume"<<p<<"" << " with data"<<p<< " = " <<
+// data(p).to_result() << std::endl;
+// if (not volume_set(p).is_empty())
+// {
+// std::cout << "2: not volume_set"<<p<<".is_empty()" << std::endl;
+// if (volume_set(p) != volume_set(r))
+// {
+// std::cout << "3: volume_set"<<p<<" != volume_set"<<r<< std::endl;
+// cmpts--;
+// }
+// }
+// }
// propagate set
volume_set(p).insert(volume_set(r));
- assert(data(p).to_result() != 0);
- // propagate attribute
- data(p).take(data(r));
// build tree
parent(r) = p;
}
@@ -190,7 +180,9 @@
deja_vu(p) = true;
}
- std::cout << "Nb cmpts after processing : " << cmpts << std::endl;
+ debug::println(volume_set);
+ step2:
+// std::cout << "Nb cmpts after processing : " << cmpts << std::endl;
// second pass
I output(ima.domain());
@@ -202,6 +194,7 @@
else
output(p) = output(parent(p));
}
+
return output;
}
Index: jardonnet/n_cmpt/test3.cc
--- jardonnet/n_cmpt/test3.cc (revision 0)
+++ jardonnet/n_cmpt/test3.cc (revision 0)
@@ -0,0 +1,36 @@
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/morpho/closing_volume.hh>
+
+using namespace mln;
+using namespace mln::value;
+
+bool usage(int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ std::cout << argv[0] << " ima.pgm lambda" << std::endl;
+ return false;
+ }
+ return true;
+}
+
+int main(int argc, char ** argv)
+{
+ if (not usage(argc,argv))
+ return 1;
+
+ image2d<int_u8> ima;
+ io::pgm::load(ima, argv[1]);
+ unsigned lambda = atoi(argv[2]);
+
+ io::pgm::save(morpho::closing_volume(ima, c4(), lambda),
+ "out.pgm");
+}
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Update n_cmpt3.
* jardonnet/n_cmpt/n_cmpt3.hh: Minor fix and display.
n_cmpt3.hh | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
Index: jardonnet/n_cmpt/n_cmpt3.hh
--- jardonnet/n_cmpt/n_cmpt3.hh (revision 2981)
+++ jardonnet/n_cmpt/n_cmpt3.hh (working copy)
@@ -117,7 +117,7 @@
// tester minima de ima == minima de attr
//mln_assertion(min == min_v);
- mln_ch_value(I, util::set<mln_psite(I)>) ima_set = minima_sets(volume);
+ mln_ch_value(I, util::set<mln_psite(I)>) volume_set = minima_sets(volume);
// number of minima
int cmpts = count_minima(min_v);
@@ -126,13 +126,16 @@
// prepare union find
typedef mln_psite(V) P;
+ //data
+ mln_ch_value(V, accu::volume<V>) data;
+ initialize(data, volume);
+ //deja_vu
mln_ch_value(V, bool) deja_vu;
- initialize(deja_vu, ima);
- mln_ch_value(V, P) parent;
- initialize(parent, ima);
- mln_ch_value(V, A) data;
- initialize(data, ima);
+ initialize(deja_vu, volume);
mln::level::fill(deja_vu, false);
+ //parent
+ mln_ch_value(V, P) parent;
+ initialize(parent, volume);
{
mln_fwd_piter(S) p(sp);
for_all(p)
@@ -145,7 +148,7 @@
for_all(p)
{
// Make set.
- data(p).take_as_init(make::pix(ima, p));
+ data(p).take_as_init(make::pix(volume, p));
for_all(n)
{
if (volume.domain().has(n) && deja_vu(n))
@@ -154,26 +157,32 @@
P r = find_root(parent, n);
if (r != p)
{
- if (ima(r) != ima(p) && (data(p).to_result() > lambda))
+ if (volume(r) != volume(p) && (data(p).to_result() > lambda))
{
data(p).set_value(lambda);
continue;
}
- if (ima(r) != ima(p))
+ if (volume(r) != volume(p))
{
- std::cout << "1: ima(r) != ima(p)" << std::endl;
- if (not ima_set(p).is_empty())
+ std::cout << "1: volume"<<r<<" != volume"<<p<<"" << " with data"<<p<< " = " <<
+ data(p).to_result() << std::endl;
+ if (not volume_set(p).is_empty())
{
- std::cout << "2: not ima_set(p).is_empty()" << std::endl;
- if (ima_set(p) != ima_set(r))
+ std::cout << "2: not volume_set"<<p<<".is_empty()" << std::endl;
+ if (volume_set(p) != volume_set(r))
{
- std::cout << "3: ima_set(p) != ima_set(r)" << std::endl;
+ std::cout << "3: volume_set"<<p<<" != volume_set"<<r<< std::endl;
cmpts--;
}
}
}
- ima_set(p).insert(ima_set(r));
+ // propagate set
+ volume_set(p).insert(volume_set(r));
+ assert(data(p).to_result() != 0);
+ // propagate attribute
+ data(p).take(data(r));
+ // build tree
parent(r) = p;
}
}
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Attribute filtering v3.
* jardonnet/n_cmpt/n_cmpt3.hh: Make use of an image of set.
* jardonnet/n_cmpt/n_cmpt3.cc: New.
* jardonnet/n_cmpt/Makefile: Add rule.
* jardonnet/n_cmpt/check/test4.pgm: New test image.
Makefile | 6 +
n_cmpt3.cc | 37 ++++++++++
n_cmpt3.hh | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 247 insertions(+), 2 deletions(-)
Index: jardonnet/n_cmpt/n_cmpt3.hh
--- jardonnet/n_cmpt/n_cmpt3.hh (revision 0)
+++ jardonnet/n_cmpt/n_cmpt3.hh (revision 0)
@@ -0,0 +1,206 @@
+// Copyright (C) 2008 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_N_CMPT3_HH
+# define MLN_N_CMPT3_HH
+
+# include <mln/labeling/regional_minima.hh>
+# include <mln/core/alias/neighb2d.hh>
+# include <mln/util/set.hh>
+
+# include <mln/debug/println.hh>
+
+# include <mln/accu/volume.hh>
+# include <mln/morpho/tree/data.hh>
+# include <mln/morpho/tree/compute_attribute_image.hh>
+
+namespace mln
+{
+
+ namespace n_cmpt
+ {
+
+ template < typename I >
+ void n_cmpt3(const I& (((((((ima))))))));
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template<typename I>
+ mln_ch_value(I, util::set<mln_psite(I)>)
+ minima_sets(const I& ima)
+ {
+ mln_ch_value(I, util::set<mln_psite(I)>) ima_set(ima.domain());
+
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ {
+ if (ima(p) != literal::zero)
+ ima_set(p).insert(p);
+ }
+ return ima_set;
+ }
+
+ template <typename I>
+ inline
+ mln_psite(I)
+ find_root(I& parent,
+ const mln_psite(I)& x)
+ {
+ if (parent(x) == x)
+ return x;
+ else
+ return parent(x) = find_root(parent, parent(x));
+ }
+
+ template < typename I >
+ unsigned count_minima(const I& ima)
+ {
+ unsigned cmpt = 0;
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ {
+ if (ima(p) != literal::zero)
+ cmpt++;
+ }
+ return cmpt;
+ }
+
+ template < typename I, typename N>
+ I
+ n_cmpt3(const I& ima, const N& nbh,
+ unsigned lambda)
+ {
+ unsigned label;
+
+ // get /ima/ regional minima
+ mln_ch_value(I, unsigned) min = labeling::regional_minima(ima, nbh, label);
+ std::cout << "/ima/ regional minima" << std::endl;
+ debug::println(min);
+
+ // compute volume image
+ typedef p_array<mln_psite(I)> S;
+ typedef image2d<unsigned> V;
+ typedef accu::volume<I> A;
+ S sp = level::sort_psites_decreasing(ima);
+ morpho::tree::data<I,S> t(ima, sp, nbh);
+ V volume = morpho::tree::compute_attribute_image(A(), t);
+
+ // get /volume/ regional minima
+ mln_ch_value(I, unsigned) min_v = labeling::regional_minima(volume, nbh, label);
+ std::cout << "/volume/ regional minima" << std::endl;
+ debug::println(min_v);
+
+ // tester minima de ima == minima de attr
+ //mln_assertion(min == min_v);
+
+ mln_ch_value(I, util::set<mln_psite(I)>) ima_set = minima_sets(volume);
+
+ // number of minima
+ int cmpts = count_minima(min_v);
+
+ std::cout << "Nb of regionnal minima : " << cmpts << std::endl;
+
+ // prepare union find
+ typedef mln_psite(V) P;
+ mln_ch_value(V, bool) deja_vu;
+ initialize(deja_vu, ima);
+ mln_ch_value(V, P) parent;
+ initialize(parent, ima);
+ mln_ch_value(V, A) data;
+ initialize(data, ima);
+ mln::level::fill(deja_vu, false);
+ {
+ mln_fwd_piter(S) p(sp);
+ for_all(p)
+ parent(p) = p;
+ }
+
+ // union find sur volume
+ mln_fwd_piter(S) p(sp);
+ mln_niter(N) n(nbh, p);
+ for_all(p)
+ {
+ // Make set.
+ data(p).take_as_init(make::pix(ima, p));
+ for_all(n)
+ {
+ if (volume.domain().has(n) && deja_vu(n))
+ {
+ //do_union(n, p);
+ P r = find_root(parent, n);
+ if (r != p)
+ {
+ if (ima(r) != ima(p) && (data(p).to_result() > lambda))
+ {
+ data(p).set_value(lambda);
+ continue;
+ }
+
+ if (ima(r) != ima(p))
+ {
+ std::cout << "1: ima(r) != ima(p)" << std::endl;
+ if (not ima_set(p).is_empty())
+ {
+ std::cout << "2: not ima_set(p).is_empty()" << std::endl;
+ if (ima_set(p) != ima_set(r))
+ {
+ std::cout << "3: ima_set(p) != ima_set(r)" << std::endl;
+ cmpts--;
+ }
+ }
+ }
+ ima_set(p).insert(ima_set(r));
+ parent(r) = p;
+ }
+ }
+ }
+ deja_vu(p) = true;
+ }
+
+ std::cout << "Nb cmpts after processing : " << cmpts << std::endl;
+
+ // second pass
+ I output(ima.domain());
+ {
+ mln_bkd_piter(S) p(sp);
+ for_all(p)
+ if (parent(p) == p) // p is root.
+ output(p) = ima(p);
+ else
+ output(p) = output(parent(p));
+ }
+ return output;
+ }
+
+ } // end of namespace n_cmpt
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+#endif /* MLN_N_CMPT3_HH */
+
Index: jardonnet/n_cmpt/n_cmpt3.cc
--- jardonnet/n_cmpt/n_cmpt3.cc (revision 0)
+++ jardonnet/n_cmpt/n_cmpt3.cc (revision 0)
@@ -0,0 +1,37 @@
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/value/int_u8.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include "n_cmpt3.hh"
+
+using namespace mln;
+using namespace mln::value;
+
+bool usage(int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ std::cout << argv[0] << " ima.pgm lambda" << std::endl;
+ return false;
+ }
+ return true;
+}
+
+int main(int argc, char ** argv)
+{
+ if (not usage(argc,argv))
+ return 1;
+
+ image2d<int_u8> ima;
+ io::pgm::load(ima, argv[1]);
+ unsigned lambda = atoi(argv[2]);
+
+ io::pgm::save(n_cmpt::n_cmpt3(ima, c4(), lambda),
+ "out.pgm");
+}
Index: jardonnet/n_cmpt/Makefile
--- jardonnet/n_cmpt/Makefile (revision 2980)
+++ jardonnet/n_cmpt/Makefile (working copy)
@@ -4,8 +4,14 @@
n_cmpt2: n_cmpt2.hh n_cmpt2.cc
g++ -I../../.. -Wall -W -Wextra n_cmpt2.cc -DNDEBUG -O1 -o n_cmpt2
+n_cmpt3: n_cmpt3.hh n_cmpt3.cc
+ g++ -I../../.. -Wall -W -Wextra n_cmpt3.cc -DNDEBUG -O1 -o n_cmpt3
+
debug: n_cmpt.hh n_cmpt.cc
- g++ -I../../.. -Wall -W -Wextra n_cmpt.cc -g -g3 -DNDEBUG -o n_cmpt
+ g++ -I../../.. -Wall -W -Wextra n_cmpt.cc -g -g3 -o n_cmpt
debug2: n_cmpt2.hh n_cmpt2.cc
- g++ -I../../.. -Wall -W -Wextra n_cmpt2.cc -g -g3 -DNDEBUG -o n_cmpt2
\ No newline at end of file
+ g++ -I../../.. -Wall -W -Wextra n_cmpt2.cc -g -g3 -o n_cmpt2
+
+debug3: n_cmpt3.hh n_cmpt3.cc
+ g++ -I../../.. -Wall -W -Wextra n_cmpt3.cc -g -g3 -o n_cmpt3
Index: jardonnet/n_cmpt/check/test4.pgm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: jardonnet/n_cmpt/check/test4.pgm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
1
0
* canvas/browsing/dir_struct_elt_incr_update.hh,
* core/image/image1d.hh,
* core/image/image2d.hh,
* core/internal/image_base.hh,
* geom/max_col.hh,
* geom/max_ind.hh,
* geom/max_row.hh,
* geom/max_sli.hh,
* geom/min_col.hh,
* geom/min_ind.hh,
* geom/min_row.hh,
* geom/min_sli.hh,
* io/pbm/load.hh,
* io/pfm/load.hh,
* io/pfm/save.hh,
* io/pnm/load.hh,
* linear/gaussian.hh,
* subsampling/gaussian_subsampling.hh,
* subsampling/subsampling.hh: Use mln_deduce(I, site, coord) instead
of mln_coord(I) which is not valid anymore.
---
milena/ChangeLog | 25 +++++++++++++
.../canvas/browsing/dir_struct_elt_incr_update.hh | 2 +-
milena/mln/core/image/image1d.hh | 3 --
milena/mln/core/image/image2d.hh | 15 +++-----
milena/mln/core/internal/image_base.hh | 3 --
milena/mln/geom/max_col.hh | 12 +++---
milena/mln/geom/max_ind.hh | 14 ++++----
milena/mln/geom/max_row.hh | 18 +++++-----
milena/mln/geom/max_sli.hh | 14 ++++----
milena/mln/geom/min_col.hh | 18 +++++-----
milena/mln/geom/min_ind.hh | 14 ++++----
milena/mln/geom/min_row.hh | 12 +++---
milena/mln/geom/min_sli.hh | 14 ++++----
milena/mln/io/pbm/load.hh | 39 +++++++++-----------
milena/mln/io/pfm/load.hh | 4 +-
milena/mln/io/pfm/save.hh | 4 +-
milena/mln/io/pnm/load.hh | 2 +-
milena/mln/linear/gaussian.hh | 31 ++++++++--------
milena/mln/subsampling/gaussian_subsampling.hh | 19 ++++------
milena/mln/subsampling/subsampling.hh | 24 +++++-------
20 files changed, 146 insertions(+), 141 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 8fa2f02..c4ee716 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,30 @@
2008-12-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Fix wrong use of mln_coord().
+
+ * canvas/browsing/dir_struct_elt_incr_update.hh,
+ * core/image/image1d.hh,
+ * core/image/image2d.hh,
+ * core/internal/image_base.hh,
+ * geom/max_col.hh,
+ * geom/max_ind.hh,
+ * geom/max_row.hh,
+ * geom/max_sli.hh,
+ * geom/min_col.hh,
+ * geom/min_ind.hh,
+ * geom/min_row.hh,
+ * geom/min_sli.hh,
+ * io/pbm/load.hh,
+ * io/pfm/load.hh,
+ * io/pfm/save.hh,
+ * io/pnm/load.hh,
+ * linear/gaussian.hh,
+ * subsampling/gaussian_subsampling.hh,
+ * subsampling/subsampling.hh: Use mln_deduce(I, site, coord) instead
+ of mln_coord(I) which is not valid anymore.
+
+2008-12-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Fix tutorial generation.
* doc/Doxyfile.in: add a missing example path.
diff --git a/milena/mln/canvas/browsing/dir_struct_elt_incr_update.hh b/milena/mln/canvas/browsing/dir_struct_elt_incr_update.hh
index a5cc7fd..b62ddfe 100644
--- a/milena/mln/canvas/browsing/dir_struct_elt_incr_update.hh
+++ b/milena/mln/canvas/browsing/dir_struct_elt_incr_update.hh
@@ -110,7 +110,7 @@ namespace mln
pmin = f.input.domain().pmin(),
pmax = f.input.domain().pmax();
- const mln_coord(I)
+ const mln_deduce(I, site, coord)
pmin_dir = pmin[f.dir],
pmax_dir = pmax[f.dir],
pmin_dir_plus_half_length = pmin_dir + f.length / 2,
diff --git a/milena/mln/core/image/image1d.hh b/milena/mln/core/image/image1d.hh
index 27f7d39..4e5bbf5 100644
--- a/milena/mln/core/image/image1d.hh
+++ b/milena/mln/core/image/image1d.hh
@@ -130,9 +130,6 @@ namespace mln
{
typedef internal::image_primary< T, mln::box1d, image1d<T> > super_;
- /// Coordinate associated type.
- typedef int coord;
-
/// Value associated type.
typedef T value;
diff --git a/milena/mln/core/image/image2d.hh b/milena/mln/core/image/image2d.hh
index e1a6e5a..b58dfed 100644
--- a/milena/mln/core/image/image2d.hh
+++ b/milena/mln/core/image/image2d.hh
@@ -123,21 +123,18 @@ namespace mln
- /*! \brief Basic 2D image class.
- *
- * The parameter \c T is the type of pixel values. This image class
- * stores data in memory and has a virtual border with constant
- * thickness around data.
- */
+ /// Basic 2D image class.
+ ///
+ /// The parameter \c T is the type of pixel values. This image class
+ /// stores data in memory and has a virtual border with constant
+ /// thickness around data.
+ ///
template <typename T>
class image2d : public internal::image_primary< T, mln::box2d, image2d<T> >
{
typedef internal::image_primary< T, mln::box2d, image2d<T> > super_;
public:
- /// Coordinate associated type.
- typedef int coord;
-
/// Value associated type.
typedef T value;
diff --git a/milena/mln/core/internal/image_base.hh b/milena/mln/core/internal/image_base.hh
index 20eb39b..d940291 100644
--- a/milena/mln/core/internal/image_base.hh
+++ b/milena/mln/core/internal/image_base.hh
@@ -84,9 +84,6 @@ namespace mln
public image_checked_<E>
{
- /// Coordinate associated type.
- typedef mln_deduce(S, site, coord) coord;
-
/// Value associated type.
typedef T value;
diff --git a/milena/mln/geom/max_col.hh b/milena/mln/geom/max_col.hh
index 31cbb9a..ca7c305 100644
--- a/milena/mln/geom/max_col.hh
+++ b/milena/mln/geom/max_col.hh
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_GEOM_MAX_COL_HH
# define MLN_GEOM_MAX_COL_HH
-/*! \file mln/geom/max_col.hh
- *
- * \brief Give the maximum column of an image.
- */
+/// \file mln/geom/max_col.hh
+///
+/// Give the maximum column of an image.
# include <mln/core/concept/image.hh>
# include <mln/geom/bbox.hh>
@@ -49,7 +49,7 @@ namespace mln
/// Give the maximum col of an box 2d or 3d.
template <typename B>
- mln_coord(B::point) max_col(const Box<B>& b);
+ mln_deduce(B, point, coord) max_col(const Box<B>& b);
# ifndef MLN_INCLUDE_ONLY
@@ -64,7 +64,7 @@ namespace mln
template <typename B>
inline
- mln_coord(B::point) max_col(const Box<B>& b)
+ mln_deduce(B, point, coord) max_col(const Box<B>& b)
{
metal::not_<metal::equal<metal::int_<B::dim>, metal::int_<1> > >::check();
return exact(b).pmax().col();
diff --git a/milena/mln/geom/max_ind.hh b/milena/mln/geom/max_ind.hh
index 4ff4303..9a794e0 100644
--- a/milena/mln/geom/max_ind.hh
+++ b/milena/mln/geom/max_ind.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_GEOM_MAX_IND_HH
# define MLN_GEOM_MAX_IND_HH
-/*! \file mln/geom/max_ind.hh
- *
- * \brief Give the maximum ind of an image.
- */
+/// \file mln/geom/max_ind.hh
+///
+/// Give the maximum ind of an image.
# include <mln/core/concept/image.hh>
@@ -44,14 +44,14 @@ namespace mln
/// Give the maximum ind of an image.
template <typename I>
- mln_coord(I) max_ind(const Image<I>& ima);
+ mln_deduce(I, site, coord) max_ind(const Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- mln_coord(I) max_ind(const Image<I>& ima)
+ mln_deduce(I, site, coord) max_ind(const Image<I>& ima)
{
mln_precondition(exact(ima).has_data());
return exact(ima).bbox().pmax().ind();
diff --git a/milena/mln/geom/max_row.hh b/milena/mln/geom/max_row.hh
index 5697a4a..ba6bc00 100644
--- a/milena/mln/geom/max_row.hh
+++ b/milena/mln/geom/max_row.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_GEOM_MAX_ROW_HH
# define MLN_GEOM_MAX_ROW_HH
-/*! \file mln/geom/max_row.hh
- *
- * \brief Give the maximum row of an image.
- */
+/// \file mln/geom/max_row.hh
+///
+/// Give the maximum row of an image.
# include <mln/core/concept/image.hh>
# include <mln/geom/bbox.hh>
@@ -45,18 +45,18 @@ namespace mln
/// Give the maximum row of an image.
template <typename I>
- mln_coord(I) max_row(const Image<I>& ima);
+ mln_deduce(I, site, coord) max_row(const Image<I>& ima);
/// Give the maximum row of an box 2d or 3d.
template <typename B>
- mln_coord(B::point) max_row(const Box<B>& b);
+ mln_deduce(B, point, coord) max_row(const Box<B>& b);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- mln_coord(I) max_row(const Image<I>& ima)
+ mln_deduce(I, site, coord) max_row(const Image<I>& ima)
{
mln_precondition(exact(ima).has_data());
return geom::bbox(ima).pmax().row();
@@ -65,7 +65,7 @@ namespace mln
template <typename B>
inline
- mln_coord(B::point) max_row(const Box<B>& b)
+ mln_deduce(B, point, coord) max_row(const Box<B>& b)
{
metal::not_<metal::equal<metal::int_<B::dim>, metal::int_<1> > >::check();
return exact(b).pmax().row();
diff --git a/milena/mln/geom/max_sli.hh b/milena/mln/geom/max_sli.hh
index 86deba5..2556d78 100644
--- a/milena/mln/geom/max_sli.hh
+++ b/milena/mln/geom/max_sli.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_GEOM_MAX_SLI_HH
# define MLN_GEOM_MAX_SLI_HH
-/*! \file mln/geom/max_sli.hh
- *
- * \brief Give the maximum sli of an image.
- */
+/// \file mln/geom/max_sli.hh
+///
+/// Give the maximum sli of an image.
# include <mln/core/concept/image.hh>
@@ -44,14 +44,14 @@ namespace mln
/// Give the maximum sli of an image.
template <typename I>
- mln_coord(I) max_sli(const Image<I>& ima);
+ mln_deduce(I, site, coord) max_sli(const Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- mln_coord(I) max_sli(const Image<I>& ima)
+ mln_deduce(I, site, coord) max_sli(const Image<I>& ima)
{
mln_precondition(exact(ima).has_data());
return exact(ima).bbox().pmax().sli();
diff --git a/milena/mln/geom/min_col.hh b/milena/mln/geom/min_col.hh
index 6993d6f..1e01a93 100644
--- a/milena/mln/geom/min_col.hh
+++ b/milena/mln/geom/min_col.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_GEOM_MIN_COL_HH
# define MLN_GEOM_MIN_COL_HH
-/*! \file mln/geom/min_col.hh
- *
- * \brief Give the minimum column of an image.
- */
+/// \file mln/geom/min_col.hh
+///
+/// Give the minimum column of an image.
# include <mln/core/concept/image.hh>
# include <mln/geom/bbox.hh>
@@ -45,18 +45,18 @@ namespace mln
/// Give the minimum column of an image.
template <typename I>
- mln_coord(I) min_col(const Image<I>& ima);
+ mln_deduce(I, site, coord) min_col(const Image<I>& ima);
/// Give the minimum column of an box 2d or 3d.
template <typename B>
- mln_coord(B::point) min_col(const Box<B>& b);
+ mln_deduce(B, point, coord) min_col(const Box<B>& b);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- mln_coord(I) min_col(const Image<I>& ima)
+ mln_deduce(I, site, coord) min_col(const Image<I>& ima)
{
mln_precondition(exact(ima).has_data());
return geom::bbox(ima).pmin().col();
@@ -65,7 +65,7 @@ namespace mln
template <typename B>
inline
- mln_coord(B::point) min_col(const Box<B>& b)
+ mln_deduce(B, point, coord) min_col(const Box<B>& b)
{
metal::not_<metal::equal<metal::int_<B::dim>, metal::int_<1> > >::check();
return exact(b).pmin().col();
diff --git a/milena/mln/geom/min_ind.hh b/milena/mln/geom/min_ind.hh
index ce84967..abf4ecd 100644
--- a/milena/mln/geom/min_ind.hh
+++ b/milena/mln/geom/min_ind.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_GEOM_MIN_IND_HH
# define MLN_GEOM_MIN_IND_HH
-/*! \file mln/geom/min_ind.hh
- *
- * \brief Give the minimum ind of an image.
- */
+/// \file mln/geom/min_ind.hh
+///
+/// Give the minimum ind of an image.
# include <mln/core/concept/image.hh>
@@ -44,14 +44,14 @@ namespace mln
/// Give the minimum ind of an image.
template <typename I>
- mln_coord(I) min_ind(const Image<I>& ima);
+ mln_deduce(I, site, coord) min_ind(const Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- mln_coord(I) min_ind(const Image<I>& ima)
+ mln_deduce(I, site, coord) min_ind(const Image<I>& ima)
{
mln_precondition(exact(ima).has_data());
return exact(ima).bbox().pmin().ind();
diff --git a/milena/mln/geom/min_row.hh b/milena/mln/geom/min_row.hh
index 5f2c191..e0878de 100644
--- a/milena/mln/geom/min_row.hh
+++ b/milena/mln/geom/min_row.hh
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_GEOM_MIN_ROW_HH
# define MLN_GEOM_MIN_ROW_HH
-/*! \file mln/geom/min_row.hh
- *
- * \brief Give the minimum row of an image.
- */
+/// \file mln/geom/min_row.hh
+///
+/// Give the minimum row of an image.
# include <mln/core/concept/image.hh>
# include <mln/geom/bbox.hh>
@@ -52,7 +52,7 @@ namespace mln
/// Give the minimum row of an box 2d or 3d.
template <typename B>
- mln_coord(B::point) min_row(const Box<B>& b);
+ mln_deduce(B, point, coord) min_row(const Box<B>& b);
# ifndef MLN_INCLUDE_ONLY
@@ -68,7 +68,7 @@ namespace mln
template <typename B>
inline
- mln_coord(B::point) min_row(const Box<B>& b)
+ mln_deduce(B, point, coord) min_row(const Box<B>& b)
{
metal::not_<metal::equal<metal::int_<B::dim>, metal::int_<1> > >::check();
return exact(b).pmin().row();
diff --git a/milena/mln/geom/min_sli.hh b/milena/mln/geom/min_sli.hh
index 303117d..a01de7d 100644
--- a/milena/mln/geom/min_sli.hh
+++ b/milena/mln/geom/min_sli.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_GEOM_MIN_SLI_HH
# define MLN_GEOM_MIN_SLI_HH
-/*! \file mln/geom/min_sli.hh
- *
- * \brief Give the minimum sli of an image.
- */
+/// \file mln/geom/min_sli.hh
+///
+/// Give the minimum sli of an image.
# include <mln/core/concept/image.hh>
@@ -44,14 +44,14 @@ namespace mln
/// Give the minimum sli of an image.
template <typename I>
- mln_coord(I) min_sli(const Image<I>& ima);
+ mln_deduce(I, site, coord) min_sli(const Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- mln_coord(I) min_sli(const Image<I>& ima)
+ mln_deduce(I, site, coord) min_sli(const Image<I>& ima)
{
mln_precondition(exact(ima).has_data());
return exact(ima).bbox().pmin().sli();
diff --git a/milena/mln/io/pbm/load.hh b/milena/mln/io/pbm/load.hh
index b2ba586..9a16638 100644
--- a/milena/mln/io/pbm/load.hh
+++ b/milena/mln/io/pbm/load.hh
@@ -1,5 +1,5 @@
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
-// Research and Development Laboratory
+// 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
@@ -29,13 +29,10 @@
#ifndef MLN_IO_PBM_LOAD_HH
# define MLN_IO_PBM_LOAD_HH
-/*!
- * \file mln/io/pbm/load.hh
- *
- * \brief Define a function which loads an image of kind pbm with
- * given path.
- *
- */
+/// \file mln/io/pbm/load.hh
+///
+/// Define a function which loads an image of kind pbm with
+/// given path.
# include <iostream>
@@ -55,21 +52,21 @@ namespace mln
{
- /*! Load a pbm image in a Milena image.
- *
- * \param[out] ima A reference to the image2d<bool> which will receive
- * data.
- * \param[in] filename The source.
- */
+ /// Load a pbm image in a Milena image.
+ ///
+ /// \param[out] ima A reference to the image2d<bool> which will receive
+ /// data.
+ /// \param[in] filename The source.
+ ///
void load(image2d<bool>& ima,
const std::string& filename);
- /*! Load a pbm image in a image2d<float>.
- *
- * \param[in] filename The image source.
- *
- * \return An image2d<float> which contains loaded data.
- */
+ /// Load a pbm image in a image2d<float>.
+ ///
+ /// \param[in] filename The image source.
+ ///
+ /// \return An image2d<float> which contains loaded data.
+ ///
image2d<bool> load(const std::string& filename);
# ifndef MLN_INCLUDE_ONLY
@@ -102,7 +99,7 @@ namespace mln
{
point2d p = point2d(0, ima.domain().pmin().col());
typedef mln_value(I) V;
- const mln_coord(I)
+ const mln_deduce(I, site, coord)
min_row = geom::min_row(ima),
max_row = geom::max_row(ima),
min_col = geom::min_col(ima),
diff --git a/milena/mln/io/pfm/load.hh b/milena/mln/io/pfm/load.hh
index 96bc20d..5ea3a23 100644
--- a/milena/mln/io/pfm/load.hh
+++ b/milena/mln/io/pfm/load.hh
@@ -1,5 +1,5 @@
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
-// Research and Development Laboratory
+// 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
@@ -124,7 +124,7 @@ namespace mln
{
point2d p = point2d(0, 0);
- const mln_coord(I)
+ const mln_deduce(I, site, coord)
min_row = geom::min_row(ima),
max_row = geom::max_row(ima);
diff --git a/milena/mln/io/pfm/save.hh b/milena/mln/io/pfm/save.hh
index 53f18e6..1743e20 100644
--- a/milena/mln/io/pfm/save.hh
+++ b/milena/mln/io/pfm/save.hh
@@ -1,5 +1,5 @@
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 EPITA
-// Research and Development Laboratory
+// 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
@@ -89,7 +89,7 @@ namespace mln
unsigned int
ncols = geom::ncols(ima);
- const mln_coord(I)
+ const mln_deduce(I, site, coord)
min_row = geom::min_row(ima),
max_row = geom::max_row(ima);
diff --git a/milena/mln/io/pnm/load.hh b/milena/mln/io/pnm/load.hh
index d2c2f6b..ed5e3c5 100644
--- a/milena/mln/io/pnm/load.hh
+++ b/milena/mln/io/pnm/load.hh
@@ -123,7 +123,7 @@ namespace mln
{
point2d p = point2d(0, ima.domain().pmin().col());
typedef mln_value(I) V;
- const mln_coord(I)
+ const mln_deduce(I, site, coord)
min_row = geom::min_row(ima),
max_row = geom::max_row(ima);
diff --git a/milena/mln/linear/gaussian.hh b/milena/mln/linear/gaussian.hh
index 70efc64..88f30a2 100644
--- a/milena/mln/linear/gaussian.hh
+++ b/milena/mln/linear/gaussian.hh
@@ -1,5 +1,5 @@
// Copyright (C) 2001, 2002, 2003, 2004, 2008 EPITA Research and
-// Laboratory
+// 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
@@ -29,13 +29,12 @@
#ifndef MLN_LINEAR_GAUSSIAN_HH
# define MLN_LINEAR_GAUSSIAN_HH
-/*! \file mln/linear/gaussian.hh
- *
- * \brief Gaussian filter.
- *
- * \todo Add a clean reference David Deriche
- * Recursively implementing the gaussian and its derivatives (1993)
- */
+/// \file mln/linear/gaussian.hh
+///
+/// Gaussian filter.
+///
+/// \todo Add a clean reference David Deriche
+/// Recursively implementing the gaussian and its derivatives (1993)
# include <mln/core/concept/image.hh>
# include <mln/core/alias/point2d.hh>
@@ -61,10 +60,10 @@ namespace mln
namespace linear
{
- /*! Gaussian filter of an image \p input
- *
- * \pre output.domain = input.domain
- */
+ /// Gaussian filter of an image \p input
+ ///
+ /// \pre output.domain = input.domain
+ ///
template <class I>
mln_concrete(I)
gaussian(const Image<I>& input, float sigma);
@@ -84,9 +83,9 @@ namespace mln
struct recursivefilter_coef_
{
- /*!
- ** \brief Constructor.
- */
+ ///
+ /// Constructor.
+ ///
recursivefilter_coef_(float a0, float a1,
float b0, float b1,
float c0, float c1,
@@ -205,7 +204,7 @@ namespace mln
- c.d[3] * tmp1[0];
mln_psite(I) current(start + d + d + d + d);
- for (mln_coord(I) i = 4; i < len; ++i)
+ for (mln_deduce(I, site, coord) i = 4; i < len; ++i)
{
tmp1[i] =
c.n[0] * ima(current)
diff --git a/milena/mln/subsampling/gaussian_subsampling.hh b/milena/mln/subsampling/gaussian_subsampling.hh
index 09d8e53..b4aa2e0 100644
--- a/milena/mln/subsampling/gaussian_subsampling.hh
+++ b/milena/mln/subsampling/gaussian_subsampling.hh
@@ -1,4 +1,5 @@
// Copyright (C) 2008 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
@@ -28,10 +29,9 @@
#ifndef MLN_SUBSAMPLING_GAUSSIAN_SUBSAMPLING_HH
# define MLN_SUBSAMPLING_GAUSSIAN_SUBSAMPLING_HH
-/*! \file mln/binarization/threshold.hh
- *
- * \brief Produce a subsampled image
- */
+/// \file mln/binarization/threshold.hh
+///
+/// Produce a subsampled image
# include <mln/geom/ncols.hh>
# include <mln/geom/nrows.hh>
@@ -46,18 +46,15 @@ namespace mln
{
namespace subsampling
- {
+ {
- /*! Gaussian subsampling FIXME : doxy
- *
- *
- */
+ /// Gaussian subsampling FIXME : doxy
template <typename I>
inline
mln_concrete(I)
gaussian_subsampling(const Image<I>& input, float sigma
const mln_dpsite(I)& first_p,
- const mln_coord(I)& gap);
+ const mln_deduce(I, site, coord)& gap);
# ifndef MLN_INCLUDE_ONLY
@@ -67,7 +64,7 @@ namespace mln
mln_concrete(I)
gaussian_subsampling(const Image<I>& input, float sigma,
const mln_dpsite(I)& first_p,
- const mln_coord(I)& gap)
+ const mln_deduce(I, site, coord)& gap)
{
trace::entering("subsampling::gaussian_subsampling");
mln_precondition(exact(input).has_data());
diff --git a/milena/mln/subsampling/subsampling.hh b/milena/mln/subsampling/subsampling.hh
index cc36334..11a5944 100644
--- a/milena/mln/subsampling/subsampling.hh
+++ b/milena/mln/subsampling/subsampling.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 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
@@ -28,10 +28,9 @@
#ifndef MLN_SUBSAMPLING_SUBSAMPLING_HH
# define MLN_SUBSAMPLING_SUBSAMPLING_HH
-/*! \file mln/binarization/threshold.hh
- *
- * \brief Produce a subsampled image
- */
+/// \file mln/binarization/threshold.hh
+///
+/// Produce a subsampled image
# include <mln/geom/ncols.hh>
# include <mln/geom/nrows.hh>
@@ -41,18 +40,15 @@ namespace mln
{
namespace subsampling
- {
+ {
- /*! Subsampling FIXME : doxy
- *
- *
- */
+ /// Subsampling FIXME : doxy
template <typename I>
inline
mln_concrete(I)
subsampling(const Image<I>& input,
const mln_deduce(I, site, delta)& first_p,
- const mln_coord(I)& gap);
+ const mln_deduce(I, site, coord)& gap);
# ifndef MLN_INCLUDE_ONLY
@@ -77,7 +73,7 @@ namespace mln
{
point2d p1(i, j);
point2d p2(first_p[0] + i * gap, first_p[1] + j * gap);
-
+
output(p1) = input(p2);
}
@@ -93,14 +89,14 @@ namespace mln
mln_concrete(I)
subsampling(const Image<I>& input,
const mln_deduce(I, site, delta)& first_p,
- const mln_coord(I)& gap)
+ const mln_deduce(I, site, coord)& gap)
{
trace::entering("subsampling::subsampling");
mln_precondition(exact(input).has_data());
mln_concrete(I) output(geom::nrows(input) / gap,
geom::ncols(input) / gap); // FIXME: only 2d here
-
+
output = impl::subsampling_(exact(input), first_p, gap);
trace::exiting("subsampling::subsampling");
--
1.5.6.5
1
0
* doc/Doxyfile.in: add a missing example path.
* doc/tutorial/outputs/ima2d-decl-2-blobs.txt: remove since
generated.
* doc/tutorial/tutorial.tex: fix wrong includes.
---
milena/ChangeLog | 14 +++++++-
milena/doc/Doxyfile.in | 1 +
milena/doc/tutorial/outputs/ima2d-decl-2-blobs.txt | 7 ----
milena/doc/tutorial/tutorial.tex | 36 ++++++++++----------
4 files changed, 32 insertions(+), 26 deletions(-)
delete mode 100644 milena/doc/tutorial/outputs/ima2d-decl-2-blobs.txt
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 6913b27..8fa2f02 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,15 @@
+2008-12-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix tutorial generation.
+
+ * doc/Doxyfile.in: add a missing example path.
+
+ * doc/tutorial/outputs/ima2d-decl-2-blobs.txt: remove since
+ generated.
+
+ * doc/tutorial/tutorial.tex: fix wrong includes.
+
+
2008-12-01 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make doc examples tuto_one compile again.
@@ -52,7 +64,7 @@
Fix more tests.
* mln/accu/count_adjacent_vertices.hh: make it work with the
-new graph images.
+ new graph images.
* mln/accu/median_alt.hh: fix compilation issue.
diff --git a/milena/doc/Doxyfile.in b/milena/doc/Doxyfile.in
index e56c529..bc28c77 100644
--- a/milena/doc/Doxyfile.in
+++ b/milena/doc/Doxyfile.in
@@ -86,6 +86,7 @@ EXCLUDE_SYMLINKS = YES
EXCLUDE_PATTERNS = *spe.hh
EXCLUDE_SYMBOLS =
EXAMPLE_PATH = @top_srcdir@/milena/doc/tutorial/samples \
+ @top_builddir@/milena/doc/tutorial/samples \
@top_builddir@/milena/doc/tutorial/outputs \
@top_builddir@/milena/doc/tutorial/outputs/splitted \
@top_srcdir@/milena/doc/tutorial/outputs
diff --git a/milena/doc/tutorial/outputs/ima2d-decl-2-blobs.txt b/milena/doc/tutorial/outputs/ima2d-decl-2-blobs.txt
deleted file mode 100644
index b48c715..0000000
--- a/milena/doc/tutorial/outputs/ima2d-decl-2-blobs.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-0 1 1 0 0
-0 1 1 0 0
-0 0 0 0 0
-2 2 0 3 0
-2 0 3 3 3
-2 0 0 0 0
-
diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex
index 49ef8a1..1c4bb16 100644
--- a/milena/doc/tutorial/tutorial.tex
+++ b/milena/doc/tutorial/tutorial.tex
@@ -94,9 +94,9 @@ showstringspaces=false,linewidth=14cm}
\backslash htmlonly%
}
-\newcommand{\doxyfigure}[2]{
+\newcommand{\doxyfigure}[3][1]{
\backslash endhtmlonly%
-\backslash image html #1.png%
+\backslash image html #2-#1.png%
\backslash htmlonly%
}
@@ -122,8 +122,8 @@ $$
\renewcommand{\doxyrawcode}[1]{\lstinputlisting[frame=single]{samples/#1.cc.raw}}
\renewcommand{\doxyoutput}[1]{\lstinputlisting[frame=single]{outputs/#1.txt}}
\renewcommand{\doxymoutput}[2][1]{\lstinputlisting[frame=single]{outputs/splitted/#2-#1.txt}}
-\renewcommand{\doxyfigure}[2]{%
-\pgfimage[width=#2]{figures/#1}%
+\renewcommand{\doxyfigure}[3][1]{%
+\pgfimage[width=#3]{figures/#2-#1}%
\label{#1}%
}
\renewenvironment{doxymath}
@@ -800,7 +800,7 @@ Output:
\bigskip
\begin{tabular}{c c}
-\doxyfigure{ima2d-rot-1}{3cm} & \doxyfigure{ima2d-rot-2}{3cm} \\
+\doxyfigure[1]{ima2d-rot}{3cm} & \doxyfigure[2]{ima2d-rot}{3cm} \\
\multicolumn{2}{c}{\var{ima1} and its border before rotation (left) and \var{ima2}
and its border after rotation (right).} \\
\end{tabular}
@@ -1053,7 +1053,7 @@ These predefined neighborhood can be passed directly to a function. The headers
located in \header{mln/core/alias/neigh*.hh}.
Use case example:
-\doxycode{ima2d-decl-2-blobs}
+\doxycode[2]{labeling-compute}
\doxysubsection{customse}{Custom structural elements}
@@ -1439,7 +1439,7 @@ Consider the following image:
Output: \\
\begin{center}
-\doxyfigure{labeling-compute-1}{3cm}
+\doxyfigure[1]{labeling-compute}{3cm}
\end{center}
Then label this image thanks to \code{labeling::blobs()}:
@@ -1448,7 +1448,7 @@ Then label this image thanks to \code{labeling::blobs()}:
Output: \\
\begin{center}
-\doxyfigure{labeling-compute-2}{3cm}
+\doxyfigure[2]{labeling-compute}{3cm}
\end{center}
Note that this routine returns the number of components in its third parameter.
@@ -1480,14 +1480,14 @@ Example:
Make a binary image:
\doxycode[1]{logical-not}
\begin{center}
-\doxyfigure{logical-not-1}{3cm}
+\doxyfigure[1]{logical-not}{3cm}
\end{center}
Return the result in a new image:
\doxycode[2]{logical-not}
\begin{center}
\begin{tabular}{c c}
-\doxyfigure{logical-not-1}{3cm} & \doxyfigure{logical-not-2}{3cm} \\
+\doxyfigure[1]{logical-not}{3cm} & \doxyfigure[2]{logical-not}{3cm} \\
\multicolumn{2}{c}{\var{ima} (left) and \var{ima_neg} (right) after having
called logical::not\_().} \\
\end{tabular}
@@ -1497,7 +1497,7 @@ Or, work in place:
\doxycode[3]{logical-not}
Then, \var{ima} looks like:
\begin{center}
-\doxyfigure{logical-not-3}{3cm}
+\doxyfigure[3]{logical-not}{3cm}
\end{center}
@@ -1590,7 +1590,7 @@ Consider the following image:
Then label this image thanks to \code{labeling::blobs()}:
\doxycode[2]{labeling-compute}
Output:
-\doxymoutput[1]{labeling-compute}
+\doxyfigure[2]{labeling-compute}{3cm}
Then, use \code{labeling::compute()} with the bbox accumulator:
\doxycode[3]{labeling-compute}
@@ -1603,7 +1603,7 @@ In this case, it returns an array of \type{box2d}.
set the background to 0, we will want to iterate from 1 to nlabels included.
\doxycode[4]{labeling-compute}
Output:
-\doxymoutput[2]{labeling-compute}
+\doxyoutput{labeling-compute}
\subsection{Routines based on accumulators and *::compute()}
@@ -1670,7 +1670,7 @@ following declaration:
\doxycode[1]{fill-part-image}
Output:
\begin{center}
-\doxyfigure{fill-subdomain-1}{3cm}
+\doxyfigure[1]{fill-subdomain}{3cm}
\end{center}
\doxysubsection{restrictsiteset}{Restrict an image with a site set}
@@ -1688,7 +1688,7 @@ First, find and label the components.
\doxycode[2]{fill-subdomain}
Output:
\begin{center}
-\doxyfigure{fill-subdomain-2}{3cm}
+\doxyfigure[2]{fill-subdomain}{3cm}
\end{center}
Then, restrict the image to the sites being part of component 2.
@@ -1696,7 +1696,7 @@ Then, restrict the image to the sites being part of component 2.
\var{lbl\_2} is a new image. \var{lbl\_2} looks like:
\begin{center}
-\doxyfigure{fill-subdomain-3}{3cm}
+\doxyfigure[3]{fill-subdomain}{3cm}
\end{center}
Finally, create a new color image, fill it with black and fill the sites part of
@@ -1704,7 +1704,7 @@ component 2 with red.
\doxycode[4]{fill-subdomain}
Output:
\begin{center}
-\doxyfigure{fill-subdomain-4}{3cm}
+\doxyfigure[4]{fill-subdomain}{3cm}
\end{center}
The previous example can be written more quickly:
@@ -1722,7 +1722,7 @@ Restrict the image with it:
Output:
\begin{center}
-\doxyfigure{fill-subimage-cfun-1}{3cm}
+\doxyfigure[1]{fill-subimage-cfun}{3cm}
\end{center}
%
\medskip
--
1.5.6.5
1
0
* scribo/demat.hh: Remove components which does not include more than
3 bounding boxes.
---
milena/sandbox/ChangeLog | 7 +++
milena/sandbox/scribo/demat.hh | 84 ++++++++++++++++++++++++++++++---------
2 files changed, 71 insertions(+), 20 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index c2d4117..26a5bb7 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,10 @@
+2008-12-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Improve component cleanup.
+
+ * scribo/demat.hh: Remove components which does not include more than
+ 3 bounding boxes.
+
2008-12-01 Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
N components extraction based on value iterator.
diff --git a/milena/sandbox/scribo/demat.hh b/milena/sandbox/scribo/demat.hh
index 8b59a11..88ae58a 100644
--- a/milena/sandbox/scribo/demat.hh
+++ b/milena/sandbox/scribo/demat.hh
@@ -82,6 +82,7 @@ namespace scribo
unsigned max_dist_lines;
int max_txt_box_height;
unsigned rank_filter;
+ bool treat_tables;
};
@@ -159,7 +160,7 @@ namespace scribo
void save_lbl_image(const image2d<V>& lbl, unsigned nlabels,
const char *filename)
{
- image2d<rgb8> output = debug::colorize<image2d<rgb8>, image2d<V> >(lbl, nlabels);
+ image2d<rgb8> output = debug::colorize(rgb8(), lbl, nlabels);
io::ppm::save(output, output_file(filename));
}
@@ -318,12 +319,12 @@ namespace scribo
/// Connect lines if they are close to each other.
void
- connect_lines(const image2d<bool>& in,
- const util::array<int>& aligned_lines,
+ connect_lines(const util::array<int>& aligned_lines,
util::array<box2d>& boxes,
- unsigned dim)
+ unsigned dim,
+ unsigned dim_size)
{
- image1d<int> l(in.nrows());
+ image1d<int> l(dim_size);
level::fill(l, -1);
for_all_elements(i, aligned_lines)
@@ -360,8 +361,8 @@ namespace scribo
geom::max_col(in), tblboxes.first,
1);
- connect_lines(in, rows, tblboxes.first, 0);
- connect_lines(in, cols, tblboxes.second, 1);
+ connect_lines(rows, tblboxes.first, 0, in.nrows());
+ connect_lines(cols, tblboxes.second, 1, in.ncols());
image2d<bool> res;
initialize(res, in);
@@ -534,7 +535,7 @@ namespace scribo
// Lignes verticales
std::cout << "Removing vertical lines" << std::endl;
win::vline2d vline(settings.ero_line_width);
- image2d<bool> vfilter = morpho::rank_filter(in, win_c4p(), settings.rank_filter);
+ image2d<bool> vfilter = morpho::rank_filter(in, vline, settings.rank_filter);
#ifndef NOUT
io::pbm::save(vfilter, output_file("vertical-erosion.pbm"));
@@ -622,7 +623,7 @@ namespace scribo
/// Return false if the components is smaller than a given size.
bool operator()(const label16& l) const
{
- return nsitecomp_[l].first >= settings.min_comp_size;
+ return nsitecomp_[l] >= settings.min_comp_size;
}
const util::array<R>& nsitecomp_;
@@ -656,24 +657,27 @@ namespace scribo
void
cleanup_components(image2d<label16>& lbl,
- label16& nlabels, bool treat_tables)
+ label16& nlabels)
{
std::cout << "Cleanup components..." << std::endl;
typedef accu::count<mln_psite_(image2d<label16>)> accu_count_t;
typedef accu::bbox<mln_psite_(image2d<label16>)> accu_bbox_t;
typedef accu::pair<accu_count_t, accu_bbox_t> accu_pair_t;
- typedef mln_result_(accu_pair_t) accu_res_t;
- typedef util::array<accu_res_t> nsitecomp_t;
+ typedef mln_result_(accu_pair_t) accu_pair_res_t;
+ typedef mln_result_(accu_count_t) accu_count_res_t;
- nsitecomp_t nsitecomp = labeling::compute(accu_pair_t(), lbl, nlabels);
- if (treat_tables)
+ if (settings.treat_tables)
{
- remove_small_comps<accu_res_t> fl2b(nsitecomp);
+ typedef util::array<accu_count_res_t> nsitecomp_t;
+ nsitecomp_t nsitecomp = labeling::compute(accu_count_t(), lbl, nlabels);
+ remove_small_comps<accu_count_res_t> fl2b(nsitecomp);
labeling::relabel_inplace(lbl, nlabels, fl2b);
} else
{
- remove_smallandlarge_comps<accu_res_t> fl2b(nsitecomp);
+ typedef util::array<accu_pair_res_t> nsitecomp_t;
+ nsitecomp_t nsitecomp = labeling::compute(accu_pair_t(), lbl, nlabels);
+ remove_smallandlarge_comps<accu_pair_res_t> fl2b(nsitecomp);
labeling::relabel_inplace(lbl, nlabels, fl2b);
}
}
@@ -693,17 +697,54 @@ namespace scribo
tboxes[relabel_fun(i)].take(cboxes[i]);
//Update labels
+ //FIXME: use labeling::Relabel
level::transform_inplace(lbl, relabel_fun);
#ifndef NOUT
save_lbl_image(lbl, ncomp, "lbl-grouped-boxes.pgm");
#endif
+ //FIXME: use from_to
util::array<box2d> result;
for_all_ncomponents(i, ncomp)
if (tboxes[i].is_valid())
result.append(tboxes[i].to_result());
+#ifndef NOUT
+ image2d<label16> lbl2 = clone(lbl);
+ util::array<unsigned> treated(g.v_nmax(), mln_max(unsigned));
+ util::set<unsigned> comp_vertices;
+ mln_vertex_iter_(util::graph) v(g);
+ for_all(v)
+ if (treated[v.id()] == mln_max(unsigned))
+ {
+ std::queue<unsigned> queue;
+ queue.push(v.id());
+ comp_vertices.insert(v.id());
+ while (!queue.empty())
+ {
+ util::vertex<util::graph> current_v = g.vertex(queue.front());
+ queue.pop();
+ for (unsigned nv = 0; nv < current_v.nmax_nbh_vertices(); ++nv)
+ if (!comp_vertices.has(current_v.ith_nbh_vertex(nv)))
+ {
+ comp_vertices.insert(current_v.ith_nbh_vertex(nv));
+ queue.push(current_v.ith_nbh_vertex(nv));
+ }
+ }
+ unsigned compsize = comp_vertices.nelements();
+ for (unsigned i = 0; i < comp_vertices.nelements(); ++i)
+ treated[comp_vertices[i]] = compsize;
+ comp_vertices.clear();
+ }
+
+ for_all_ncomponents(i, ncomp)
+ if (tboxes[i].is_valid())
+ if (treated[i] < 3)
+ level::fill((lbl2 | (tboxes[i].to_result() | (pw::value(lbl2) == pw::cst(i)))).rw(), 0u);
+ save_lbl_image(lbl2, ncomp, "lbl-grouped-boxes-cleaned.pgm");
+#endif
+
return result;
}
@@ -789,7 +830,7 @@ namespace scribo
std::cout << "map text to cells" << std::endl;
label16 nlabels;
image2d<label16> tblelbl = labeling::background(table, c8(), nlabels);
- image2d<rgb8> color = debug::colorize<image2d<rgb8>, image2d<label16> >(tblelbl, nlabels);
+ image2d<rgb8> color = debug::colorize(rgb8(), tblelbl, nlabels);
# ifndef NOUT
io::ppm::save(color, output_file("cells-labels.ppm"));
@@ -826,10 +867,13 @@ namespace scribo
using value::rgb8;
using value::label16;
+
+ //Useful debug variables
border::thickness = 3;
trace::quiet = true;
- //Useful debug variables
+
+ internal::settings.treat_tables = treat_tables;
internal::input_file = basename(argv[1]);
//Load image
@@ -846,7 +890,7 @@ namespace scribo
//Label and remove small components.
label16 nlabels;
image2d<label16> lbl = labeling::blobs(in, c8(), nlabels);
- internal::cleanup_components(lbl, nlabels, treat_tables);
+ internal::cleanup_components(lbl, nlabels);
std::pair<util::array<box2d>,
util::array<box2d> > tblboxes;
@@ -859,7 +903,7 @@ namespace scribo
table = internal::rebuild_table(in, tblboxes);
lbl = labeling::blobs(in, c8(), nlabels);
- internal::cleanup_components(lbl, nlabels, treat_tables);
+ internal::cleanup_components(lbl, nlabels);
#ifndef NOUT
internal::save_lbl_image(lbl, nlabels, "lbl-small-comps-removed.pgm");
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make doc examples tuto_one compile again.
* mln/core/concept/window.hh (mln_is_fastest_IW): New.
* mln/accu/transform_directional.hh,
* mln/accu/transform_diagonal.hh,
* mln/accu/transform.hh,
* mln/accu/transform_stop.hh,
* mln/accu/transform_snake.hh: Check in dispatch that win is
simple to choose the fastest specialization.
accu/transform.hh | 6 +++---
accu/transform_diagonal.hh | 12 ++++++------
accu/transform_directional.hh | 6 +++---
accu/transform_snake.hh | 6 +++---
accu/transform_stop.hh | 6 +++---
core/concept/window.hh | 7 +++++++
6 files changed, 25 insertions(+), 18 deletions(-)
Index: mln/core/concept/window.hh
--- mln/core/concept/window.hh (revision 2976)
+++ mln/core/concept/window.hh (working copy)
@@ -60,6 +60,13 @@
mln::trait::window::definition::unique) > >
+# define mln_is_fastest_IW(I, W) \
+ \
+mlc_and(mlc_is(mln_trait_image_speed(I), \
+ trait::image::speed::fastest), \
+ mln_is_simple_window(W))
+
+
namespace mln
{
Index: mln/accu/transform_directional.hh
--- mln/accu/transform_directional.hh (revision 2976)
+++ mln/accu/transform_directional.hh (working copy)
@@ -253,7 +253,7 @@
template <typename A, typename I, typename W>
inline
mln_ch_value(I, mln_result(A))
- transform_directional_dispatch(trait::image::speed::any,
+ transform_directional_dispatch(metal::false_,
const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win,
unsigned dir)
@@ -267,7 +267,7 @@
template <typename A, typename I, typename W>
inline
mln_ch_value(I, mln_result(A))
- transform_directional_dispatch(trait::image::speed::fastest,
+ transform_directional_dispatch(metal::true_,
const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win,
unsigned dir)
@@ -285,7 +285,7 @@
const Image<I>& input, const Window<W>& win,
unsigned dir)
{
- return transform_directional_dispatch(mln_trait_image_speed(I)(),
+ return transform_directional_dispatch(mln_is_fastest_IW(I, W)(),
a, input, win, dir);
}
Index: mln/accu/transform_diagonal.hh
--- mln/accu/transform_diagonal.hh (revision 2976)
+++ mln/accu/transform_diagonal.hh (working copy)
@@ -357,7 +357,7 @@
template <typename A, typename I>
inline
mln_ch_value(I, mln_result(A))
- transform_diagonal_dispatch(trait::image::speed::any,
+ transform_diagonal_dispatch(metal::false_,
const Accumulator<A>& a,
const Image<I>& input, const win::diag2d& win)
{
@@ -367,10 +367,10 @@
return f.output;
}
- template <typename A, typename I>
+ template <typename B, typename A, typename I>
inline
mln_ch_value(I, mln_result(A))
- transform_diagonal_dispatch(trait::image::speed::any,
+ transform_diagonal_dispatch(metal::false_,
const Accumulator<A>& a,
const Image<I>& input, const win::backdiag2d& win)
{
@@ -383,7 +383,7 @@
template <typename A, typename I>
inline
mln_ch_value(I, mln_result(A))
- transform_diagonal_dispatch(trait::image::speed::fastest,
+ transform_diagonal_dispatch(metal::true_,
const Accumulator<A>& a,
const Image<I>& input, const win::diag2d& win)
{
@@ -396,7 +396,7 @@
template <typename A, typename I>
inline
mln_ch_value(I, mln_result(A))
- transform_diagonal_dispatch(trait::image::speed::fastest,
+ transform_diagonal_dispatch(metal::true_,
const Accumulator<A>& a,
const Image<I>& input, const win::backdiag2d& win)
{
@@ -412,7 +412,7 @@
transform_diagonal_dispatch(const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win)
{
- return transform_diagonal_dispatch(mln_trait_image_speed(I)(),
+ return transform_diagonal_dispatch(mln_is_fastest_IW(I, W)(),
a, input, exact(win));
}
Index: mln/accu/transform.hh
--- mln/accu/transform.hh (revision 2976)
+++ mln/accu/transform.hh (working copy)
@@ -154,7 +154,7 @@
template <typename I, typename A, typename W>
mln_ch_value(I, mln_result(A))
- transform_dispatch(trait::image::speed::any,
+ transform_dispatch(metal::false_,
const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
{
return impl::generic::transform(input, a, win);
@@ -162,7 +162,7 @@
template <typename I, typename A, typename W>
mln_ch_value(I, mln_result(A))
- transform_dispatch(trait::image::speed::fastest,
+ transform_dispatch(metal::true_,
const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
{
return impl::transform_fastest(input, a, win);
@@ -172,7 +172,7 @@
mln_ch_value(I, mln_result(A))
transform_dispatch(const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
{
- return transform_dispatch(mln_trait_image_speed(I)(),
+ return transform_dispatch(mln_is_fastest_IW(I, W)(),
input, a, win);
}
Index: mln/accu/transform_stop.hh
--- mln/accu/transform_stop.hh (revision 2976)
+++ mln/accu/transform_stop.hh (working copy)
@@ -158,7 +158,7 @@
template <typename I, typename A, typename W>
mln_ch_value(I, mln_result(A))
- transform_stop_dispatch(trait::image::speed::any,
+ transform_stop_dispatch(metal::false_,
const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
{
return impl::generic::transform_stop(input, a, win);
@@ -166,7 +166,7 @@
template <typename I, typename A, typename W>
mln_ch_value(I, mln_result(A))
- transform_stop_dispatch(trait::image::speed::fastest,
+ transform_stop_dispatch(metal::true_,
const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
{
return impl::transform_stop_fastest(input, a, win);
@@ -176,7 +176,7 @@
mln_ch_value(I, mln_result(A))
transform_stop_dispatch(const Image<I>& input, const Accumulator<A>& a, const Window<W>& win)
{
- return transform_stop_dispatch(mln_trait_image_speed(I)(),
+ return transform_stop_dispatch(mln_is_fastest_IW(I, W)(),
input, a, win);
}
Index: mln/accu/transform_snake.hh
--- mln/accu/transform_snake.hh (revision 2976)
+++ mln/accu/transform_snake.hh (working copy)
@@ -395,7 +395,7 @@
template <typename A, typename I, typename W>
inline
mln_ch_value(I, mln_result(A))
- transform_snake_dispatch(trait::image::speed::any,
+ transform_snake_dispatch(metal::false_,
const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win)
{
@@ -408,7 +408,7 @@
template <typename A, typename I, typename W>
inline
mln_ch_value(I, mln_result(A))
- transform_snake_dispatch(trait::image::speed::fastest,
+ transform_snake_dispatch(metal::true_,
const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win)
{
@@ -424,7 +424,7 @@
transform_snake_dispatch(const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win)
{
- return transform_snake_dispatch(mln_trait_image_speed(I)(),
+ return transform_snake_dispatch(mln_is_fastest_IW(I, W)(),
a, input, win);
}
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
N components extraction based on value iterator.
* jardonnet/n_cmpt/n_cmpt2.hh: Make use of value iterator.
* jardonnet/n_cmpt/n_cmpt2.cc: Update.
* jardonnet/n_cmpt/Makefile: Add rules.
* jardonnet/n_cmpt/n_cmpt.hh: Minor fix.
Makefile | 5 +++
n_cmpt.hh | 2 -
n_cmpt2.cc | 8 +++---
n_cmpt2.hh | 77 +++++++++++++++++++++++++++++++++++++++++--------------------
4 files changed, 61 insertions(+), 31 deletions(-)
Index: jardonnet/n_cmpt/n_cmpt2.hh
--- jardonnet/n_cmpt/n_cmpt2.hh (revision 2975)
+++ jardonnet/n_cmpt/n_cmpt2.hh (working copy)
@@ -30,6 +30,11 @@
# include <mln/level/fill.hh>
# include <mln/core/site_set/p_vaccess.hh>
+# include <mln/level/sort_psites.hh>
+# include <mln/accu/volume.hh>
+# include <mln/morpho/tree/data.hh>
+# include <mln/morpho/tree/compute_attribute_image.hh>
+# include <mln/value/int_u.hh>
namespace mln
{
@@ -43,54 +48,76 @@
# ifndef MLN_INCLUDE_ONLY
+ template <typename I>
+ inline
+ mln_psite(I)
+ find_root(I& parent,
+ const mln_psite(I)& x)
+ {
+ if (parent(x) == x)
+ return x;
+ else
+ return parent(x) = find_root(parent, parent(x));
+ }
- template <typename I, typename N, typename O>
- void n_cmpt(const Image<I>& input_,
+ template <typename I, typename N>
+ I n_cmpt(const Image<I>& input_,
const Neighborhood<N>& nbh_,
- unsigned limit,
- Image<O>& output_)
+ unsigned limit)
{
const I& input = exact(input_);
const N& nbh = exact(nbh_);
- O& output = exact(output_);
-
+ typedef I O;
+ O output(input.domain());
mln_precondition(output.domain() == input.domain());
- image2d<unsigned> v_ima = level::compute_volume(input);
+ // compute volume image
+ typedef p_array<mln_psite(I)> S;
+ typedef accu::volume<I> A;
+ S sp = level::sort_psites_increasing(input);
+ morpho::tree::data<I,S> t(input, sp, c4());
+ image2d<unsigned> volume = morpho::tree::compute_attribute_image(A(), t);
// Local type
typedef mln_psite(I) P;
- typedef accu::volume<I> A;
- typedef p_vaccess<unsigned, p_array<point2d> > PV;
// Auxiliary data.
mln_ch_value(O, bool) deja_vu;
mln_ch_value(O, P) parent;
- PV arr;
- fill(arr, input);
+ initialize(deja_vu, input);
+ initialize(parent, input);
+ bool last = false;
+ unsigned n_cmpt = input.domain().nsites();
+
+ // Construct iterable value set
+ typedef p_array<P> Arr;
+// typedef p_vaccess<value::int_u<10>, Arr> SV;
+// SV s = convert::to<SV>(volume);
+ for
+ Arr s = convert::to<Arr>(volume);
- mln_fwd_piter(PV) v(arr);
+ mln_piter(Arr) last_v(s.nsites());
+ mln_piter(Arr) v(s.nsites());
for_all(v)
{
std::cout << "lambda=" << v << "-------" << std::endl;
+
// init
mln_ch_value(O, A) data;
initialize(data, input);
mln::level::fill(deja_vu, false);
{
- mln_fwd_piter(S) p(s);
+ mln_fwd_piter(S) p(sp);
for_all(p)
parent(p) = p;
}
// process
- mln_fwd_piter(S) p(s); // s required.
+ mln_fwd_piter(Arr) p(s(v));
mln_niter(N) n(nbh, p);
for_all(p)
{
- // Make set.
- data(p).take_as_init(make::pix(input, p)); // FIXME: algebraic so p!
- //data(p).take_as_init(1);
+ data(p).take_as_init(make::pix(input, p));
for_all(n)
{
if (input.domain().has(n) && deja_vu(n))
@@ -99,15 +126,14 @@
P r = find_root(parent, n);
if (r != p)
{
- //std::cout << data(p).to_result() << std::endl;
- if (input(r) == input(p) || (data(p).to_result() <= lambda))
+ if (input(r) == input(p) || (data(p).to_result() <= (value::int_u<10>(v))))
// Either a flat zone or the component of r is still growing.
{
if(--n_cmpt < limit)
{
std::cout << "find less than " << limit << " cmpts" << std::endl;
std::cout << "Using last lambda" << std::endl;
- v--;
+ v = last_v;
last = true;
goto end;
}
@@ -115,9 +141,7 @@
parent(r) = p;
}
else
- {
- data(p).set_value(lambda);
- }
+ data(p).set_value(value::int_u<10>(v));
}
}
}
@@ -127,17 +151,20 @@
goto step2;
end:
n_cmpt = input.domain().nsites();
+ last_v = v;
}
-
+ step2:
// second pass
{
- mln_bkd_piter(S) p(s);
+ mln_bkd_piter(S) p(sp);
for_all(p)
if (parent(p) == p) // p is root.
output(p) = input(p);
else
output(p) = output(parent(p));
}
+
+ return output;
}
# endif // ! MLN_INCLUDE_ONLY
Index: jardonnet/n_cmpt/n_cmpt2.cc
--- jardonnet/n_cmpt/n_cmpt2.cc (revision 2975)
+++ jardonnet/n_cmpt/n_cmpt2.cc (working copy)
@@ -7,7 +7,6 @@
#include <mln/io/pgm/load.hh>
#include <mln/io/pgm/save.hh>
-
#include "n_cmpt2.hh"
using namespace mln;
@@ -15,7 +14,7 @@
bool usage(int argc, char ** argv)
{
- if (argc != 2)
+ if (argc != 3)
{
std::cout << argv[0] << " ima.pgm n_cmpt" << std::endl;
return false;
@@ -31,7 +30,8 @@
image2d<int_u8> ima;
io::pgm::load(ima, argv[1]);
- unsigned n_cmpt = atoi(argv[2]);
+ unsigned limit = atoi(argv[2]);
- n_cmpt(ima, c4(), n_cmpt, out);
+ io::pgm::save(n_cmpt(ima, c4(), limit),
+ "out.pgm");
}
Index: jardonnet/n_cmpt/Makefile
--- jardonnet/n_cmpt/Makefile (revision 2975)
+++ jardonnet/n_cmpt/Makefile (working copy)
@@ -5,4 +5,7 @@
g++ -I../../.. -Wall -W -Wextra n_cmpt2.cc -DNDEBUG -O1 -o n_cmpt2
debug: n_cmpt.hh n_cmpt.cc
- g++ -I../../.. -Wall -W -Wextra n_cmpt.cc -g -g3 -DNDEBUG -O1 -o n_cmpt
+ g++ -I../../.. -Wall -W -Wextra n_cmpt.cc -g -g3 -DNDEBUG -o n_cmpt
+
+debug2: n_cmpt2.hh n_cmpt2.cc
+ g++ -I../../.. -Wall -W -Wextra n_cmpt2.cc -g -g3 -DNDEBUG -o n_cmpt2
\ No newline at end of file
Index: jardonnet/n_cmpt/n_cmpt.hh
--- jardonnet/n_cmpt/n_cmpt.hh (revision 2975)
+++ jardonnet/n_cmpt/n_cmpt.hh (working copy)
@@ -86,7 +86,7 @@
mln_ch_value(O, bool) deja_vu;
mln_ch_value(O, P) parent;
- int n_cmpt = input.domain().nsites();
+ unsigned n_cmpt = input.domain().nsites();
std::cout << "Number of sites = " << n_cmpt << std::endl;
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Have doc examples tuto_bis work again.
* doc/examples/tuto_bis.cc (domain): New variable.
* mln/morpho/gradient.hh: Upgrade doc style.
Augment doc.
* mln/morpho/general.spe.hh
(general_dispatch_wrt_win): Fix missing argument.
doc/examples/tuto_bis.cc | 8 ++++----
mln/morpho/general.spe.hh | 4 ++--
mln/morpho/gradient.hh | 42 +++++++++++++++++++++++-------------------
3 files changed, 29 insertions(+), 25 deletions(-)
Index: doc/examples/tuto_bis.cc
--- doc/examples/tuto_bis.cc (revision 2974)
+++ doc/examples/tuto_bis.cc (working copy)
@@ -139,9 +139,9 @@
mln_VAR( e2e, make::double_neighb2d(is_row_odd, e2e_h, e2e_v) );
-
- image2d<unsigned> ima_(3, 5);
- mln_VAR(ima, ima_ | ima_.domain());
+ box2d domain(3, 5);
+ image2d<unsigned> ima_(domain);
+ mln_VAR(ima, ima_ | domain);
mln_VAR(cell, ima | is_cell);
level::fill(cell, fun::p2v::iota());
@@ -160,7 +160,7 @@
// 3 3 3
// 1 1
- image2d<unsigned> label(ima.bbox(), 0);
+ image2d<unsigned> label(domain, 0);
level::fill(label, 9);
debug::println(label);
// 9 9 9 9 9
Index: mln/morpho/gradient.hh
--- mln/morpho/gradient.hh (revision 2974)
+++ mln/morpho/gradient.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -28,12 +29,16 @@
#ifndef MLN_MORPHO_GRADIENT_HH
# define MLN_MORPHO_GRADIENT_HH
-/*! \file mln/morpho/gradient.hh
- *
- * \brief Morphological gradient.
- *
- * \todo Save memory.
- */
+/// \file mln/morpho/gradient.hh
+///
+/// Morphological gradient.
+///
+/// It is based on dilation and erosion so that handling side effects
+/// (with extension domains) is easy. It does *not* rely on
+/// morpho::general (what the extension initialization would be in
+/// that case?!)
+///
+/// \todo Save memory.
# include <mln/morpho/includes.hh>
@@ -44,32 +49,31 @@
namespace morpho
{
- /*! Morphological gradient.
- *
- * This operator is d_B - e_B.
- */
+ /// Morphological gradient.
+ ///
+ /// This operator is d_B - e_B.
template <typename I, typename W>
mln_concrete(I) gradient(const Image<I>& input, const Window<W>& win);
- /*! Morphological internal gradient.
- *
- * This operator is Id - e_B.
- */
+ /// Morphological internal gradient.
+ ///
+ /// This operator is Id - e_B.
template <typename I, typename W>
mln_concrete(I) gradient_internal(const Image<I>& input, const Window<W>& win);
- /*! Morphological external gradient.
- *
- * This operator is d_B - Id.
- */
+ /// Morphological external gradient.
+ ///
+ /// This operator is d_B - Id.
template <typename I, typename W>
mln_concrete(I) gradient_external(const Image<I>& input, const Window<W>& win);
+
# ifndef MLN_INCLUDE_ONLY
+
template <typename I, typename W>
inline
mln_concrete(I) gradient(const Image<I>& input, const Window<W>& win)
Index: mln/morpho/general.spe.hh
--- mln/morpho/general.spe.hh (revision 2974)
+++ mln/morpho/general.spe.hh (working copy)
@@ -338,7 +338,7 @@
template <typename Op, typename I, typename W>
mln_concrete(I)
- general_dispatch_wrt_win(const I& input, const W& win)
+ general_dispatch_wrt_win(const Op& op, const I& input, const W& win)
{
// FIXME:
// The test "win.size() >= 10" (size is not too small) has been
@@ -353,7 +353,7 @@
mlc_not_equal(mln_trait_image_value_storage(I),
trait::image::value_storage::disrupted)::value };
return general_dispatch_wrt_arbitrary_win(metal::bool_<test>(),
- input, win);
+ op, input, win);
}
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make morphological dilation use the general code.
* mln/accu/lor.hh: New.
* mln/accu/lor_basic.hh: New.
* mln/accu/land_basic.hh: Fix guard.
* mln/accu/land.hh: Fix guard.
* mln/accu/all.hh: Update.
* mln/morpho/includes.hh (include): Move accumulators to...
* mln/morpho/erosion.hh: ...here and...
* mln/morpho/dilation.hh: ...here.
* mln/morpho/erosion.hh (todo): New.
Copy this file to...
* mln/morpho/dilation.hh: ...this revamped file.
(todo): New.
(dilation_op): New.
(general_on_set_centered, general_on_set_centered_fastest): Up.
(dilation): Use general.
* mln/morpho/general.hh (general): Remove erroneous
postcondition.
* mln/morpho/all.hh: Update.
* tests/morpho/general.cc (tiny): Replace by...
(small): ...this.
Augment with dilation.
* tests/morpho/Makefile.am: Update.
mln/accu/all.hh | 3 ++
mln/accu/land.hh | 5 ++-
mln/accu/land_basic.hh | 5 ++-
mln/accu/lor.hh | 69 +++++++++++++++++++++++-----------------------
mln/accu/lor_basic.hh | 57 +++++++++++++++++++-------------------
mln/morpho/all.hh | 1
mln/morpho/dilation.hh | 70 +++++++++++++++++++++++++----------------------
mln/morpho/erosion.hh | 8 ++++-
mln/morpho/general.hh | 2 -
mln/morpho/includes.hh | 7 ----
tests/morpho/Makefile.am | 2 +
tests/morpho/general.cc | 54 ++++++++++++++++++++++++++++++++----
12 files changed, 170 insertions(+), 113 deletions(-)
Index: tests/morpho/general.cc
--- tests/morpho/general.cc (revision 2973)
+++ tests/morpho/general.cc (working copy)
@@ -37,6 +37,7 @@
#include <mln/win/all.hh>
#include <mln/morpho/erosion.hh>
+#include <mln/morpho/dilation.hh>
#include "tests/data.hh"
@@ -56,13 +57,14 @@
win::octagon2d oct(2 * 3 + 1);
morpho::erosion_op ero;
+ morpho::dilation_op dil;
{
image2d<int_u8> lena, out, ref;
- io::pgm::load(lena, MLN_IMG_DIR "/tiny.pgm");
+ io::pgm::load(lena, MLN_IMG_DIR "/small.pgm");
- // Rectangle.
+ // Rectangle (erosion).
ref = morpho::impl::generic::general_on_function(ero, lena, rec);
@@ -78,6 +80,23 @@
out = morpho::impl::general_directional(ero, lena, rec, 1);
mln_assertion(out == ref);
+
+ // Rectangle (dilation).
+
+ ref = morpho::impl::generic::general_on_function(dil, lena, rec);
+
+ out = morpho::impl::general_rectangle2d(dil, lena, rec);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_arbitrary_2d(dil, lena, rec);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_directional(dil, lena, rec, 0);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_directional(dil, lena, rec, 1);
+ mln_assertion(out == ref);
+
/*
// Hline.
@@ -106,9 +125,11 @@
trace::quiet = false;
image2d<bool> pic;
- io::pbm::load(pic, MLN_IMG_DIR "/tiny.pbm");
+ io::pbm::load(pic, MLN_IMG_DIR "/small.pbm");
+ // morpho::impl::general_on_set_centered_fastest(ero, pic, win::rectangle2d(3,3));
morpho::general(ero, pic, win::rectangle2d(3,3));
+ morpho::general(dil, pic, win::rectangle2d(3,3));
trace::quiet = true;
}
@@ -118,9 +139,9 @@
{
image2d<bool> pic, out, ref;
- io::pbm::load(pic, MLN_IMG_DIR "/tiny.pbm");
+ io::pbm::load(pic, MLN_IMG_DIR "/small.pbm");
- // Rectangle.
+ // Rectangle (erosion).
ref = morpho::impl::generic::general_on_set(ero, pic, rec);
@@ -141,6 +162,29 @@
out = morpho::impl::general_directional(ero, pic, rec, 1);
mln_assertion(out == ref);
+
+
+ // Rectangle (dilation).
+
+ ref = morpho::impl::generic::general_on_set(dil, pic, rec);
+
+ out = morpho::impl::general_on_set_centered(dil, pic, rec);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_on_set_centered_fastest(dil, pic, rec);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_rectangle2d(dil, pic, rec);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_arbitrary_2d(dil, pic, rec);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_directional(dil, pic, rec, 0);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_directional(dil, pic, rec, 1);
+ mln_assertion(out == ref);
}
}
Index: tests/morpho/Makefile.am
--- tests/morpho/Makefile.am (revision 2973)
+++ tests/morpho/Makefile.am (working copy)
@@ -20,6 +20,7 @@
## dilation_max_h \
erosion \
## erosion_min_h \
+ general \
gradient \
## graph_image_morpho \
## graph_image_wst \
@@ -56,6 +57,7 @@
opening_volume_SOURCES = opening_volume.cc
contrast_SOURCES = contrast.cc
+general_SOURCES = general.cc
gradient_SOURCES = gradient.cc
hit_or_miss_SOURCES = hit_or_miss.cc
laplacian_SOURCES = laplacian.cc
Index: mln/accu/lor.hh
--- mln/accu/lor.hh (revision 2972)
+++ mln/accu/lor.hh (working copy)
@@ -26,14 +26,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_ACCU_LAND_HH
-# define MLN_ACCU_LAND_HH
+#ifndef MLN_ACCU_LOR_HH
+# define MLN_ACCU_LOR_HH
-/// \file mln/accu/land.hh
+/// \file mln/accu/lor.hh
///
-/// Define a 'logical-and' accumulator.
+/// Define a 'logical-or' accumulator.
///
-/// \todo Have land_basic be parameterized.
+/// \todo Have lor be parameterized.
# include <mln/accu/internal/base.hh>
@@ -44,12 +44,12 @@
namespace accu
{
- /// "Logical-and" accumulator class.
- struct land : public mln::accu::internal::base< bool, land >
+ /// "Logical-or" accumulator class.
+ struct lor : public mln::accu::internal::base< bool, lor >
{
typedef bool argument;
- land();
+ lor();
/// Manipulators.
/// \{
@@ -57,10 +57,10 @@
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const land& other);
+ void take(const lor& other);
void untake(const argument& t);
- void untake(const land& other);
+ void untake(const lor& other);
/// \}
/// Get the value of the accumulator.
@@ -71,21 +71,21 @@
bool is_valid() const;
protected:
- unsigned nfalse_;
+ unsigned ntrue_;
};
namespace meta
{
- /// Meta accumulator for land.
+ /// Meta accumulator for lor.
- struct land : public Meta_Accumulator< land >
+ struct lor : public Meta_Accumulator< lor >
{
template <typename T>
struct with
{
- typedef accu::land ret;
+ typedef accu::lor ret;
};
};
@@ -96,63 +96,63 @@
# ifndef MLN_INCLUDE_ONLY
inline
- land::land()
+ lor::lor()
{
init();
}
inline
void
- land::init()
+ lor::init()
{
- nfalse_ = 0;
+ ntrue_ = 0;
}
inline
- void land::take_as_init(const argument& t)
+ void lor::take_as_init(const argument& t)
{
- nfalse_ = t ? 0 : 1;
+ ntrue_ = t ? 1 : 0;
}
inline
- void land::take(const argument& t)
+ void lor::take(const argument& t)
{
- if (t == false)
- ++nfalse_;
+ if (t == true)
+ ++ntrue_;
}
inline
void
- land::take(const land& other)
+ lor::take(const lor& other)
{
- nfalse_ += other.nfalse_;
+ ntrue_ += other.ntrue_;
}
inline
- void land::untake(const argument& t)
+ void lor::untake(const argument& t)
{
- if (t == false)
- --nfalse_;
+ if (t == true)
+ --ntrue_;
}
inline
void
- land::untake(const land& other)
+ lor::untake(const lor& other)
{
- mln_precondition(other.nfalse_ <= nfalse_);
- nfalse_ -= other.nfalse_;
+ mln_precondition(other.ntrue_ <= ntrue_);
+ ntrue_ -= other.ntrue_;
}
inline
bool
- land::to_result() const
+ lor::to_result() const
{
- return nfalse_ == 0;
+ return ntrue_ != 0;
}
inline
bool
- land::is_valid() const
+ lor::is_valid() const
{
return true;
}
@@ -163,4 +163,5 @@
} // end of namespace mln
-#endif // ! MLN_ACCU_AND_HH
+
+#endif // ! MLN_ACCU_LOR_HH
Index: mln/accu/all.hh
--- mln/accu/all.hh (revision 2973)
+++ mln/accu/all.hh (working copy)
@@ -63,7 +63,10 @@
# include <mln/accu/height.hh>
# include <mln/accu/histo.hh>
# include <mln/accu/land.hh>
+# include <mln/accu/land_basic.hh>
# include <mln/accu/line.hh>
+# include <mln/accu/lor.hh>
+# include <mln/accu/lor_basic.hh>
# include <mln/accu/max.hh>
# include <mln/accu/max_h.hh>
# include <mln/accu/mean.hh>
Index: mln/accu/land_basic.hh
--- mln/accu/land_basic.hh (revision 2973)
+++ mln/accu/land_basic.hh (working copy)
@@ -44,7 +44,7 @@
namespace accu
{
- /// "Logical-and" accumulator class. Conversely to accu::lands,
+ /// "Logical-and" accumulator class. Conversely to accu::land,
/// this version does not have the 'untake' method but features
/// the 'can_stop' method.
struct land_basic : public mln::accu::internal::base< bool, land_basic >
@@ -159,4 +159,5 @@
} // end of namespace mln
-#endif // ! MLN_ACCU_AND_HH
+
+#endif // ! MLN_ACCU_LAND_BASIC_HH
Index: mln/accu/lor_basic.hh
--- mln/accu/lor_basic.hh (revision 2972)
+++ mln/accu/lor_basic.hh (working copy)
@@ -26,14 +26,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_ACCU_LAND_BASIC_HH
-# define MLN_ACCU_LAND_BASIC_HH
+#ifndef MLN_ACCU_LOR_BASIC_HH
+# define MLN_ACCU_LOR_BASIC_HH
-/// \file mln/accu/land_basic.hh
+/// \file mln/accu/lor_basic.hh
///
-/// Define a basic 'logical-and' accumulator.
+/// Define a basic 'logical-or' accumulator.
///
-/// \todo Have land_basic be parameterized.
+/// \todo Have lor_basic be parameterized.
# include <mln/accu/internal/base.hh>
@@ -44,14 +44,14 @@
namespace accu
{
- /// "Logical-and" accumulator class. Conversely to accu::lands,
+ /// "Logical-or" accumulator class. Conversely to accu::lor,
/// this version does not have the 'untake' method but features
/// the 'can_stop' method.
- struct land_basic : public mln::accu::internal::base< bool, land_basic >
+ struct lor_basic : public mln::accu::internal::base< bool, lor_basic >
{
typedef bool argument;
- land_basic();
+ lor_basic();
/// Manipulators.
/// \{
@@ -59,7 +59,7 @@
void take_as_init(const argument& t);
void take(const argument& t);
- void take(const land_basic& other);
+ void take(const lor_basic& other);
/// \}
/// Get the value of the accumulator.
@@ -70,8 +70,8 @@
bool is_valid() const;
/// Test if it is worth for this accumulator to take extra data.
- /// If the result is already 'false' (because this accumulator
- /// has already taken a 'false' value), can_stop returns true.
+ /// If the result is already 'true' (because this accumulator
+ /// has already taken a 'true' value), can_stop returns true.
bool can_stop() const;
protected:
@@ -82,14 +82,14 @@
namespace meta
{
- /// Meta accumulator for land_basic.
+ /// Meta accumulator for lor_basic.
- struct land_basic : public Meta_Accumulator< land_basic >
+ struct lor_basic : public Meta_Accumulator< lor_basic >
{
template <typename T>
struct with
{
- typedef accu::land_basic ret;
+ typedef accu::lor_basic ret;
};
};
@@ -100,57 +100,57 @@
# ifndef MLN_INCLUDE_ONLY
inline
- land_basic::land_basic()
+ lor_basic::lor_basic()
{
init();
}
inline
void
- land_basic::init()
+ lor_basic::init()
{
- res_ = true;
+ res_ = false;
}
inline
- void land_basic::take_as_init(const argument& t)
+ void lor_basic::take_as_init(const argument& t)
{
res_ = t;
}
inline
- void land_basic::take(const argument& t)
+ void lor_basic::take(const argument& t)
{
- if (res_ == true && t == false)
- res_ = false;
+ if (res_ == false && t == true)
+ res_ = true;
}
inline
void
- land_basic::take(const land_basic& other)
+ lor_basic::take(const lor_basic& other)
{
- res_ = res_ && other.res_;
+ res_ = res_ || other.res_;
}
inline
bool
- land_basic::to_result() const
+ lor_basic::to_result() const
{
return res_;
}
inline
bool
- land_basic::is_valid() const
+ lor_basic::is_valid() const
{
return true;
}
inline
bool
- land_basic::can_stop() const
+ lor_basic::can_stop() const
{
- return res_ == false;
+ return res_ == true;
}
# endif // ! MLN_INCLUDE_ONLY
@@ -159,4 +159,5 @@
} // end of namespace mln
-#endif // ! MLN_ACCU_AND_HH
+
+#endif // ! MLN_ACCU_LOR_BASIC_HH
Index: mln/accu/land.hh
--- mln/accu/land.hh (revision 2973)
+++ mln/accu/land.hh (working copy)
@@ -33,7 +33,7 @@
///
/// Define a 'logical-and' accumulator.
///
-/// \todo Have land_basic be parameterized.
+/// \todo Have land be parameterized.
# include <mln/accu/internal/base.hh>
@@ -163,4 +163,5 @@
} // end of namespace mln
-#endif // ! MLN_ACCU_AND_HH
+
+#endif // ! MLN_ACCU_LAND_HH
Index: mln/morpho/all.hh
--- mln/morpho/all.hh (revision 2973)
+++ mln/morpho/all.hh (working copy)
@@ -63,6 +63,7 @@
# include <mln/morpho/dilation.hh>
# include <mln/morpho/erosion_fast.hh>
# include <mln/morpho/erosion.hh>
+# include <mln/morpho/general.hh>
# include <mln/morpho/gradient.hh>
# include <mln/morpho/hit_or_miss.hh>
# include <mln/morpho/includes.hh>
Index: mln/morpho/erosion.hh
--- mln/morpho/erosion.hh (revision 2973)
+++ mln/morpho/erosion.hh (working copy)
@@ -32,9 +32,15 @@
/// \file mln/morpho/erosion.hh
///
/// Morphological erosion.
+///
+/// \todo The overloads are hidden and I don't know why!
# include <mln/morpho/includes.hh>
# include <mln/morpho/general.hh>
+# include <mln/accu/land.hh>
+# include <mln/accu/land_basic.hh>
+# include <mln/accu/min.hh>
+# include <mln/accu/min_h.hh>
namespace mln
@@ -51,7 +57,6 @@
# ifndef MLN_INCLUDE_ONLY
-
struct erosion_op
{
@@ -153,6 +158,7 @@
} // end of namespace morpho::impl
+
template <typename I, typename W>
inline
mln_concrete(I)
Index: mln/morpho/dilation.hh
--- mln/morpho/dilation.hh (revision 2972)
+++ mln/morpho/dilation.hh (working copy)
@@ -26,15 +26,21 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_MORPHO_EROSION_HH
-# define MLN_MORPHO_EROSION_HH
+#ifndef MLN_MORPHO_DILATION_HH
+# define MLN_MORPHO_DILATION_HH
-/// \file mln/morpho/erosion.hh
+/// \file mln/morpho/dilation.hh
///
-/// Morphological erosion.
+/// Morphological dilation.
+///
+/// \todo The overloads are hidden and I don't know why!
# include <mln/morpho/includes.hh>
# include <mln/morpho/general.hh>
+# include <mln/accu/lor.hh>
+# include <mln/accu/lor_basic.hh>
+# include <mln/accu/max.hh>
+# include <mln/accu/max_h.hh>
namespace mln
@@ -43,38 +49,38 @@
namespace morpho
{
- /// Morphological erosion.
+ /// Morphological dilation.
template <typename I, typename W>
mln_concrete(I)
- erosion(const Image<I>& input, const Window<W>& win);
+ dilation(const Image<I>& input, const Window<W>& win);
# ifndef MLN_INCLUDE_ONLY
- struct erosion_op
+ struct dilation_op
{
template <typename I>
- mln_morpho_select_accu(I, land_basic, min)
+ mln_morpho_select_accu(I, lor_basic, max)
accu(const Image<I>&) const
{
- mln_morpho_select_accu(I, land_basic, min) tmp;
+ mln_morpho_select_accu(I, lor_basic, max) tmp;
return tmp;
}
template <typename I>
- mln_morpho_select_accu(I, land, min_h)
+ mln_morpho_select_accu(I, lor, max_h)
accu_incr(const Image<I>&) const
{
- mln_morpho_select_accu(I, land, min_h) tmp;
+ mln_morpho_select_accu(I, lor, max_h) tmp;
return tmp;
}
template <typename I>
mln_value(I) neutral(const Image<I>&) const
{
- return internal::neutral<I>::supremum();
+ return internal::neutral<I>::infimum();
}
};
@@ -88,16 +94,16 @@
template <typename I, typename W>
mln_concrete(I)
- general_on_set_centered(const erosion_op&,
+ general_on_set_centered(const dilation_op&,
const Image<I>& input_, const Window<W>& win_)
{
- trace::entering("morpho::impl::general_on_set_centered__erosion");
+ trace::entering("morpho::impl::general_on_set_centered__dilation");
typedef mln_concrete(I) O;
const I& input = exact(input_);
const W& win = exact(win_);
- extension::adjust_fill(input, win, true);
+ extension::adjust_fill(input, win, false);
O output;
output = clone(input);
@@ -105,31 +111,31 @@
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
- if (input(p) == true)
+ if (input(p) == false)
for_all(q) if (input.has(q))
- if (input(q) == false)
+ if (input(q) == true)
{
- output(p) = false;
+ output(p) = true;
break;
}
- trace::exiting("morpho::impl::general_on_set_centered__erosion");
+ trace::exiting("morpho::impl::general_on_set_centered__dilation");
return output;
}
template <typename I, typename W>
mln_concrete(I)
- general_on_set_centered_fastest(const erosion_op&,
+ general_on_set_centered_fastest(const dilation_op&,
const Image<I>& input_, const Window<W>& win_)
{
- trace::entering("morpho::impl::general_on_set_centered_fastest__erosion");
+ trace::entering("morpho::impl::general_on_set_centered_fastest__dilation");
typedef mln_concrete(I) O;
const I& input = exact(input_);
const W& win = exact(win_);
- extension::adjust_fill(input, win, true);
+ extension::adjust_fill(input, win, false);
O output;
output = clone(input);
@@ -138,15 +144,15 @@
mln_qixter(const I, W) q(p, win);
mln_pixter(O) p_out(output);
for_all_2(p, p_out)
- if (p.val() == true)
+ if (p.val() == false)
for_all(q)
- if (q.val() == false)
+ if (q.val() == true)
{
- p_out.val() = false;
+ p_out.val() = true;
break;
}
- trace::exiting("morpho::impl::general_on_set_centered_fastest__erosion");
+ trace::exiting("morpho::impl::general_on_set_centered_fastest__dilation");
return output;
}
@@ -156,18 +162,18 @@
template <typename I, typename W>
inline
mln_concrete(I)
- erosion(const Image<I>& input, const Window<W>& win)
+ dilation(const Image<I>& input, const Window<W>& win)
{
- trace::entering("morpho::erosion");
+ trace::entering("morpho::dilation");
mln_precondition(exact(input).has_data());
mln_precondition(! exact(win).is_empty());
- mln_concrete(I) output = general(erosion_op(), input, win);
+ mln_concrete(I) output = general(dilation_op(), input, win);
if (exact(win).is_centered())
- mln_postcondition(output <= input);
+ mln_postcondition(output >= input);
- trace::exiting("morpho::erosion");
+ trace::exiting("morpho::dilation");
return output;
}
@@ -178,4 +184,4 @@
} // end of namespace mln
-#endif // ! MLN_MORPHO_EROSION_HH
+#endif // ! MLN_MORPHO_DILATION_HH
Index: mln/morpho/includes.hh
--- mln/morpho/includes.hh (revision 2973)
+++ mln/morpho/includes.hh (working copy)
@@ -42,13 +42,6 @@
# include <mln/value/ops.hh>
-# include <mln/accu/land.hh>
-# include <mln/accu/land_basic.hh>
-// # include <mln/accu/lor.hh>
-# include <mln/accu/min.hh>
-# include <mln/accu/max.hh>
-# include <mln/accu/min_h.hh>
-# include <mln/accu/max_h.hh>
# include <mln/accu/rank.hh>
# include <mln/accu/transform.hh>
Index: mln/morpho/general.hh
--- mln/morpho/general.hh (revision 2973)
+++ mln/morpho/general.hh (working copy)
@@ -173,8 +173,6 @@
internal::general_tests(op, input, win);
mln_concrete(I) output = internal::general_dispatch(op, input, win);
- if (exact(win).is_centered())
- mln_postcondition(output <= input);
trace::exiting("morpho::general");
return output;
}
1
0