#96: Update Olena's Web site for Olena 1.0
-----------------------+----------------------------------------------------
Reporter: levill_r | Owner: Olena Team
Type: task | Status: new
Priority: critical | Milestone: Olena 1.0
Component: Web | Version: 1.0
Resolution: | Keywords: organization
-----------------------+----------------------------------------------------
Changes (by levill_r):
* keywords: => organization
Old description:
> Update http://olena.lrde.epita.fr (TWiki site).
> * Create/update the release page.
> * Update the main page.
>
> * Don't forget to announce the release
> * on LRDE's Web site;
> * to the `annonce` mailing list.
>
> * Reformat to follow this new outline (from the May 26, 2009 meeting):
> {{{
> *** Home
> **** Overview
> Description rapide
> Objectifs
> Composants
> etc.
> **** News
>
> *** Demos
> **** Morphers
> **** Morpho Math
> Support du papier ISMM'09.
>
> *** Download
> **** Sources
> **** Installing
>
> *** Documentation
> **** Tutorial
> **** Publications
> **** Related Links
> **** Quick Tour
> **** Presentation
> **** White Paper
> **** Contents / What's in it? / What's inside?
> **** Features
> **** Platform Architecture
> **** Reference documentation
>
> *** FAQ
>
> *** Platform Components
> À base de liens et d'inclusions de pages.
> **** Swilena
> **** SCRIBO
> **** ICDAR
>
> *** Development
> Ou encore:
> Contributing
> For Developers
> Developers' Corners
>
> *** Contact
>
> *** About
> **** Contributors
> **** History
> **** License
>
> *** Plan du site
> }}}
New description:
Update http://olena.lrde.epita.fr (TWiki site).
* Create/update the release page.
* Update the main page.
* Don't forget to announce the release
* on LRDE's Web site;
* to the `annonce` mailing list.
* Reformat to follow this new outline (from the May 26, 2009 meeting):
1. Home
* Overview
* Short Description
* Goals
* Components
* News
1. Demos
* Morphers Examples
* Mathematical Morphology Examples
* Supporting example for the ISMM'09 paper.
1. Download
* Binary Distributions?
* Source Distributions
* Source Repository Access (see also Development)
* Installing
1. Documentation
* Tutorial
* Publications
* Related Links
* Quick Tour
* Presentation
* White Paper
* Contents / What's In It? / What's Inside?
* Features
* Platform Architecture
* Reference Documentation
1. FAQ
1. Platform Components (using links and inclusions)
* Milena
* Swilena
* SCRIBO
* ICDAR
1. Development (or ''Contributing'' or ''For Developers'' or
''Developers' Corners''
1. Contact
1. About
* Contributors
* History
* License
1. Site Map
--
Comment:
Turn the outline into lists.
Translate French parts of the outline into English.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/96#comment:3>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
#96: Update Olena's Web site for Olena 1.0
-----------------------+----------------------------------------------------
Reporter: levill_r | Owner: Olena Team
Type: task | Status: new
Priority: critical | Milestone: Olena 1.0
Component: Web | Version: 1.0
Resolution: | Keywords:
-----------------------+----------------------------------------------------
Changes (by levill_r):
* priority: major => critical
* component: Olena => Web
Old description:
> Update http://olena.lrde.epita.fr (TWiki site).
> * Create/update the release page.
> * Update the main page.
>
> * Don't forget to announce the release
> * on LRDE's Web site;
> * to the `annonce` mailing list.
New description:
Update http://olena.lrde.epita.fr (TWiki site).
* Create/update the release page.
* Update the main page.
* Don't forget to announce the release
* on LRDE's Web site;
* to the `annonce` mailing list.
* Reformat to follow this new outline (from the May 26, 2009 meeting):
{{{
*** Home
**** Overview
Description rapide
Objectifs
Composants
etc.
**** News
*** Demos
**** Morphers
**** Morpho Math
Support du papier ISMM'09.
*** Download
**** Sources
**** Installing
*** Documentation
**** Tutorial
**** Publications
**** Related Links
**** Quick Tour
**** Presentation
**** White Paper
**** Contents / What's in it? / What's inside?
**** Features
**** Platform Architecture
**** Reference documentation
*** FAQ
*** Platform Components
À base de liens et d'inclusions de pages.
**** Swilena
**** SCRIBO
**** ICDAR
*** Development
Ou encore:
Contributing
For Developers
Developers' Corners
*** Contact
*** About
**** Contributors
**** History
**** License
*** Plan du site
}}}
--
Comment:
Add a new outline.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/96#comment:2>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-05-25 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add mln::morpho::closing::sum().
* mln/morpho/closing/all.hh: Add entry for mln::morpho::closing::sum
* mln/morpho/closing/sum.hh: New closing based on morpho sum.
---
all.hh | 1
sum.hh | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+)
Index: trunk/milena/mln/morpho/closing/sum.hh
===================================================================
--- trunk/milena/mln/morpho/closing/sum.hh (revision 0)
+++ trunk/milena/mln/morpho/closing/sum.hh (revision 3872)
@@ -0,0 +1,84 @@
+// Copyright (C) 2007, 2008, 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_CLOSING_SUM_HH
+# define MLN_MORPHO_CLOSING_SUM_HH
+
+/// \file mln/morpho/closing/sum.hh
+///
+/// Morphological sum closing.
+
+# include <mln/morpho/closing/leveling.hh>
+# include <mln/morpho/attribute/sum.hh>
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ namespace closing
+ {
+
+ /// Morphological sum closing.
+ template <typename I, typename N>
+ mln_concrete(I)
+ sum(const Image<I>& input, const Neighborhood<N>& nbh,
+ unsigned lambda);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename N>
+ inline
+ mln_concrete(I)
+ sum(const Image<I>& input, const Neighborhood<N>& nbh,
+ unsigned lambda)
+ {
+ trace::entering("morpho::closing::sum");
+
+ mln_precondition(exact(input).is_valid());
+
+ mln_concrete(I) output;
+ output = closing::leveling(input, nbh, attribute::sum<I, float>(), lambda);
+
+ trace::exiting("morpho::closing::sum");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::morpho::closing
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MORPHO_CLOSING_SUM_HH
Index: trunk/milena/mln/morpho/closing/all.hh
===================================================================
--- trunk/milena/mln/morpho/closing/all.hh (revision 3871)
+++ trunk/milena/mln/morpho/closing/all.hh (revision 3872)
@@ -39,6 +39,7 @@
#include <mln/morpho/closing/height.hh>
#include <mln/morpho/closing/leveling.hh>
#include <mln/morpho/closing/structural.hh>
+#include <mln/morpho/closing/sum.hh>
#include <mln/morpho/closing/volume.hh>
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Import functions value<->index from sandbox.
* sandbox/theo/experimental/histo_image.cc: Copy as...
* mln/fun/i2v/value_at_index.hh: ...this new file.
(value_at_index): Keep only this, layout, and cleanup.
* mln/fun/i2v/all.hh: Update.
* tests/fun/i2v/array.cc: New.
* tests/fun/i2v/value_at_index.cc: New.
* tests/fun/i2v/all_to.cc: New.
* tests/fun/i2v/Makefile.am: Update.
* mln/fun/v2i: New directory.
* sandbox/theo/experimental/histo_image.cc: Copy as...
* mln/fun/v2i/index_of_value.hh: ...this new file.
(index_of_value): Keep only this, layout, and cleanup.
* mln/fun/v2i/all.hh: New.
* mln/fun/all.hh: Update.
* tests/fun/v2i: New directory.
* tests/fun/v2i/Makefile.am: New.
* tests/fun/v2i/index_of_value.cc: New.
mln/fun/all.hh | 5
mln/fun/i2v/all.hh | 6
mln/fun/i2v/value_at_index.hh | 435 ++++------------------------------------
mln/fun/v2i/all.hh | 57 +++++
mln/fun/v2i/index_of_value.hh | 430 +++++----------------------------------
tests/fun/i2v/Makefile.am | 11 +
tests/fun/i2v/all_to.cc | 44 ++++
tests/fun/i2v/array.cc | 48 ++++
tests/fun/i2v/value_at_index.cc | 57 +++++
tests/fun/v2i/Makefile.am | 10
tests/fun/v2i/index_of_value.cc | 56 +++++
11 files changed, 396 insertions(+), 763 deletions(-)
Index: mln/fun/i2v/value_at_index.hh
--- mln/fun/i2v/value_at_index.hh (revision 3867)
+++ mln/fun/i2v/value_at_index.hh (working copy)
@@ -1,421 +1,90 @@
-#include <mln/value/int_u8.hh>
-#include <mln/value/int_s.hh>
-#include <mln/value/rgb8.hh>
-#include <mln/trait/value/comp.hh>
-
-#include <mln/core/alias/box1d.hh>
-#include <mln/core/image/image1d.hh>
-#include <mln/core/image/image3d.hh>
+// 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_FUN_I2V_VALUE_AT_INDEX_HH
+# define MLN_FUN_I2V_VALUE_AT_INDEX_HH
+
+/// \file mln/fun/i2v/value_at_index.hh
+///
+/// \brief File that define a function that gives an index per value.
#include <mln/core/concept/function.hh>
-#include <mln/metal/ands.hh>
-
+#include <mln/trait/value_.hh>
namespace mln
{
-
- // -------------------------------------------------- fun
-
-
namespace fun
{
- // . . . . . . . . . . . . . . . v2v:: value <-> index
-
- // This is a revamp of mln/value/internal/convert.hh. It remains
- // to be updated with Fred's new function writting. Then we'll be
- // able to make it better, i.e., to handle the different cases
- // properly. Precisely a case for scalars with low quantization
- // (with a special encoding like quantized float, or not), a case
- // for vectors with low quant, etc.
-
- namespace v2v
- {
-
- // value -> index
-
- template <typename T>
- struct index_of_value : Function_v2v< index_of_value<T> >,
- private metal::bool_<(mln_dim(T) == 1)>::check_t
- {
- typedef unsigned result;
- unsigned operator()(const T& v) const
- {
- return unsigned( int(v) - int(mln_min(T)) );
- }
- };
-
- template <>
- struct index_of_value<bool> : Function_v2v< index_of_value<bool> >
- {
- typedef unsigned result;
- unsigned operator()(bool b) const
- {
- return b ? 1u : 0u;
- }
- };
-
- template <typename T>
- unsigned
- meta_index_of_value(const T& v)
+ namespace i2v
{
- index_of_value<T> f;
- return f(v);
- }
-
- // index -> value
template <typename T>
struct value_at_index : Function_v2v< value_at_index<T> >,
private metal::bool_<(mln_dim(T) == 1)>::check_t
{
typedef T result;
- T operator()(unsigned i) const
- {
- return T( int(mln_min(T)) + int(i) );
- }
+ T operator()(unsigned i) const;
};
template <>
struct value_at_index<bool> : Function_v2v< value_at_index<bool> >
{
typedef bool result;
- bool operator()(unsigned i) const
- {
- mln_precondition(i < 2);
- return i == 1u ? true : false;
- }
+ bool operator()(unsigned i) const;
};
- // . . . . . . . . . . . . . . . value -> point n-D
-
-
- namespace internal
- {
-
- // FIXME: It can be straightforwardly written using
- // fun::ith_component. Yet there is no test file for this
- // function.
-
- template <unsigned dim, typename T>
- struct point_from_value;
-
- template <typename T>
- struct point_from_value< 1, T >
- {
- static point1d run(const T& v)
- {
- return point1d(meta_index_of_value(v));
- }
- };
+# ifndef MLN_INCLUDE_ONLY
template <typename T>
- struct point_from_value< 2, T >
- {
- static point2d run(const T& v)
+ inline
+ T
+ value_at_index<T>::operator()(unsigned i) const
{
- return point2d(meta_index_of_value(v[0]),
- meta_index_of_value(v[1]));
- }
- };
-
- template <typename T>
- struct point_from_value< 3, T >
- {
- static point3d run(const T& v)
- {
- return point3d(meta_index_of_value(v[0]),
- meta_index_of_value(v[1]),
- meta_index_of_value(v[2]));
- }
- };
-
- } // mln::fun::v2v::internal
-
-
- template <typename T>
- struct point_from_value : Function_v2v< point_from_value<T> >
- {
- enum { d = mln_dim(T) };
- typedef mln_regular_grid_from_dim(d) G;
- typedef mln::point<G, def::coord> result;
-
- result operator()(const T& v) const
- {
- return internal::point_from_value<d,T>::run(v);
- }
-
- index_of_value<T> f_;
- };
-
- template <typename T>
- mln_result(point_from_value<T>)
- meta_point_from_value(const T& v)
- {
- point_from_value<T> f;
- return f(v);
- }
-
- } // mln::fun::v2v
-
-
-
-
- // . . . . . . . . . . . . . . . p2p::fold*
-
- namespace p2p
- {
-
- struct fold1d : Function_p2p< fold1d >
- {
- typedef point1d result;
- result operator()(const point1d& p) const
- {
- point1d tmp(p[0] % b.len(0));
- return tmp;
- }
- box1d b;
- };
-
- template <bool along_0, bool along_1>
- struct fold2d : Function_p2p< fold2d<along_0,along_1> >
- {
- typedef point2d result;
- result operator()(const point2d& p) const
- {
- point2d tmp(along_0 ? p[0] % b.len(0) : p[0],
- along_1 ? p[1] % b.len(1) : p[1]);
- return tmp;
- }
- box2d b;
- };
-
- template <bool along_0, bool along_1, bool along_2>
- struct fold3d : Function_p2p< fold3d<along_0,along_1,along_2> >
- {
- typedef point3d result;
- result operator()(const point3d& p) const
- {
- point3d tmp(along_0 ? p[0] % b.len(0) : p[0],
- along_1 ? p[1] % b.len(1) : p[1],
- along_2 ? p[2] % b.len(2) : p[2]);
- return tmp;
- }
- box3d b;
- };
-
- } // mln::fun::p2p
-
-
- } // mln::fun
-
-
- // -------------------------------------------------- value
-
-
- namespace value
- {
-
- template <unsigned n, int inf, int sup>
- struct circular
- {
- };
-
-
- namespace internal
- {
- template <typename T>
- struct is_circular_helper : metal::false_
- {};
-
- template <unsigned n, int inf, int sup>
- struct is_circular_helper< circular<n,inf,sup> > : metal::true_
- {};
-
- template <typename T>
- struct is_circular : is_circular_helper<T>::eval
- {
- };
-
- } // mln::value::internal
-
- } // mln::value
-
-
- namespace trait
- {
-
- template <unsigned n, int inf, int sup>
- struct value_< mln::value::circular<n, inf, sup> >
- {
- enum {
- dim = 1,
- nbits = n,
- card = mln_value_card_from_(n)
- };
- // ...
- };
-
- } // end of namespace trait
-
-
- // -------------------------------------------------- histo
-
-
- namespace histo
- {
-
- namespace internal
- {
-
- template <int dim, typename T>
- struct image_from_value_helper
- {
- };
-
- // dim = 1
-
- template <typename T, bool is_c>
- struct image_from_value_helper_1;
-
- template <typename T>
- struct image_from_value_helper_1< T, false >
- {
- typedef image1d<unsigned> ret;
-
- static ret get_image()
- {
- ret tmp(mln_card(T));
- return tmp;
- }
- };
-
- template <typename T>
- struct image_from_value_helper_1< T, true >
- {
- typedef void ret;
- };
-
- template <typename T>
- struct image_from_value_helper< 1, T >
- {
- enum { is_c = value::internal::is_circular<T>::value };
- typedef image_from_value_helper_1< T, is_c > helper;
- };
-
- // dim = 3
-
- template <typename C0, bool is_c0,
- typename C1, bool is_c1,
- typename C2, bool is_c2,
- typename T>
- struct image_from_value_helper_3;
-
- template <typename C0, typename C1, typename C2,
- typename T>
- struct image_from_value_helper_3< C0, false,
- C1, false,
- C2, false,
- T >
- {
- typedef image3d<unsigned> ret;
- static ret get_image()
- {
- ret tmp(mln_card(C0), mln_card(C1), mln_card(C2));
- return tmp;
+ return T( int(mln_min(T)) + int(i) );
}
- };
-
- template <typename C0, typename C1, typename C2,
- typename T>
- struct image_from_value_helper_3< C0, true,
- C1, false,
- C2, false,
- T >
- {
- typedef void ret;
- };
- template <typename T>
- struct image_from_value_helper< 3, T >
- {
- typedef mln_trait_value_comp(T, 0) C0;
- typedef mln_trait_value_comp(T, 1) C1;
- typedef mln_trait_value_comp(T, 2) C2;
- typedef image_from_value_helper_3< C0, value::internal::is_circular<C0>::value,
- C1, value::internal::is_circular<C1>::value,
- C2, value::internal::is_circular<C2>::value,
- T > helper;
- };
-
- template <typename T>
- struct image_from_value_ // Entry point.
- {
- typedef typename image_from_value_helper<mln_dim(T), T>::helper helper;
- };
-
-
- } // mln::histo::internal
-
- template <typename T>
- struct image_from_value : internal::image_from_value_<T>::helper
+ inline
+ bool
+ value_at_index<bool>::operator()(unsigned i) const
{
- };
-
-
-
- // First code: the result of this function shall be replaced by
- // an histo::image<T> where T is mln_value(I). As a consequence,
- // we will not have to call meta_point_from_value...
-
- template <typename I>
- typename image_from_value<mln_value(I)>::ret
- compute_image(const Image<I>& input_)
- {
- const I& input = exact(input_);
- typedef image_from_value<mln_value(I)> helper;
- typename helper::ret h = helper::get_image();
-
- mln_piter(I) p(input.domain());
- for_all(p)
- ++h( fun::v2v::meta_point_from_value(input(p)) );
-
- return h;
+ mln_precondition(i < 2);
+ return i == 1u ? true : false;
}
- } // mln::histo
-
-} // mln
+# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace mln::fun::i2v
-int main()
-{
- using namespace mln;
+ } // end of namespace mln::fun
- {
- typedef bool T;
- std::cout << histo::image_from_value<T>::get_image().domain() << std::endl;
- }
+} // end of namespace mln
- {
- typedef unsigned char T;
- std::cout << histo::image_from_value<T>::get_image().domain() << std::endl;
- }
-
- {
- typedef value::int_s<3> T;
- std::cout << histo::image_from_value<T>::get_image().domain() << std::endl;
- }
-
- {
- typedef value::rgb8 T;
- std::cout << histo::image_from_value<T>::get_image().domain() << std::endl;
- }
-
- {
- // typedef value::circular<8,0,9> T;
- }
-}
+#endif // ! MLN_FUN_I2V_VALUE_AT_INDEX_HH
Property changes on: mln/fun/i2v/value_at_index.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: mln/fun/i2v/all.hh
--- mln/fun/i2v/all.hh (revision 3869)
+++ mln/fun/i2v/all.hh (working copy)
@@ -31,7 +31,7 @@
/// \file mln/fun/i2v/all.hh
///
-/// File that includes all functions from index to value.
+/// \brief File that includes all integer-to-value functions.
namespace mln
@@ -40,19 +40,19 @@
namespace fun
{
- /// \brief Functions from index to value.
+ /// \brief Namespace of integer-to-value functions.
///
/// \ingroup modfun
//
namespace i2v {}
}
-
}
# include <mln/fun/i2v/all_to.hh>
# include <mln/fun/i2v/array.hh>
+# include <mln/fun/i2v/value_at_index.hh>
Index: mln/fun/v2i/index_of_value.hh
--- mln/fun/v2i/index_of_value.hh (revision 0)
+++ mln/fun/v2i/index_of_value.hh (working copy)
@@ -1,421 +1,101 @@
-#include <mln/value/int_u8.hh>
-#include <mln/value/int_s.hh>
-#include <mln/value/rgb8.hh>
-#include <mln/trait/value/comp.hh>
-
-#include <mln/core/alias/box1d.hh>
-#include <mln/core/image/image1d.hh>
-#include <mln/core/image/image3d.hh>
+// 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_FUN_V2I_INDEX_OF_VALUE_HH
+# define MLN_FUN_V2I_INDEX_OF_VALUE_HH
+
+/// \file mln/fun/v2i/index_of_value.hh
+///
+/// \brief File that define a function that gives an index per value.
#include <mln/core/concept/function.hh>
-#include <mln/metal/ands.hh>
-
+#include <mln/trait/value_.hh>
namespace mln
{
-
- // -------------------------------------------------- fun
-
-
namespace fun
{
- // . . . . . . . . . . . . . . . v2v:: value <-> index
-
- // This is a revamp of mln/value/internal/convert.hh. It remains
- // to be updated with Fred's new function writting. Then we'll be
- // able to make it better, i.e., to handle the different cases
- // properly. Precisely a case for scalars with low quantization
- // (with a special encoding like quantized float, or not), a case
- // for vectors with low quant, etc.
-
- namespace v2v
+ namespace v2i
{
- // value -> index
-
template <typename T>
struct index_of_value : Function_v2v< index_of_value<T> >,
private metal::bool_<(mln_dim(T) == 1)>::check_t
{
typedef unsigned result;
- unsigned operator()(const T& v) const
- {
- return unsigned( int(v) - int(mln_min(T)) );
- }
+ unsigned operator()(const T& v) const;
};
template <>
struct index_of_value<bool> : Function_v2v< index_of_value<bool> >
{
typedef unsigned result;
- unsigned operator()(bool b) const
- {
- return b ? 1u : 0u;
- }
+ unsigned operator()(bool b) const;
};
template <typename T>
unsigned
- meta_index_of_value(const T& v)
- {
- index_of_value<T> f;
- return f(v);
- }
+ meta_index_of_value(const T& v);
- // index -> value
- template <typename T>
- struct value_at_index : Function_v2v< value_at_index<T> >,
- private metal::bool_<(mln_dim(T) == 1)>::check_t
- {
- typedef T result;
- T operator()(unsigned i) const
- {
- return T( int(mln_min(T)) + int(i) );
- }
- };
-
- template <>
- struct value_at_index<bool> : Function_v2v< value_at_index<bool> >
- {
- typedef bool result;
- bool operator()(unsigned i) const
- {
- mln_precondition(i < 2);
- return i == 1u ? true : false;
- }
- };
-
-
- // . . . . . . . . . . . . . . . value -> point n-D
-
-
- namespace internal
- {
-
- // FIXME: It can be straightforwardly written using
- // fun::ith_component. Yet there is no test file for this
- // function.
-
- template <unsigned dim, typename T>
- struct point_from_value;
-
- template <typename T>
- struct point_from_value< 1, T >
- {
- static point1d run(const T& v)
- {
- return point1d(meta_index_of_value(v));
- }
- };
-
- template <typename T>
- struct point_from_value< 2, T >
- {
- static point2d run(const T& v)
- {
- return point2d(meta_index_of_value(v[0]),
- meta_index_of_value(v[1]));
- }
- };
+# ifndef MLN_INCLUDE_ONLY
template <typename T>
- struct point_from_value< 3, T >
- {
- static point3d run(const T& v)
+ inline
+ unsigned
+ index_of_value<T>::operator()(const T& v) const
{
- return point3d(meta_index_of_value(v[0]),
- meta_index_of_value(v[1]),
- meta_index_of_value(v[2]));
+ return unsigned( int(v) - int(mln_min(T)) );
}
- };
- } // mln::fun::v2v::internal
-
-
- template <typename T>
- struct point_from_value : Function_v2v< point_from_value<T> >
+ inline
+ unsigned index_of_value<bool>::operator()(bool b) const
{
- enum { d = mln_dim(T) };
- typedef mln_regular_grid_from_dim(d) G;
- typedef mln::point<G, def::coord> result;
-
- result operator()(const T& v) const
- {
- return internal::point_from_value<d,T>::run(v);
+ return b ? 1u : 0u;
}
- index_of_value<T> f_;
- };
-
template <typename T>
- mln_result(point_from_value<T>)
- meta_point_from_value(const T& v)
+ inline
+ unsigned
+ meta_index_of_value(const T& v)
{
- point_from_value<T> f;
+ index_of_value<T> f;
return f(v);
}
- } // mln::fun::v2v
-
-
-
-
- // . . . . . . . . . . . . . . . p2p::fold*
-
- namespace p2p
- {
-
- struct fold1d : Function_p2p< fold1d >
- {
- typedef point1d result;
- result operator()(const point1d& p) const
- {
- point1d tmp(p[0] % b.len(0));
- return tmp;
- }
- box1d b;
- };
-
- template <bool along_0, bool along_1>
- struct fold2d : Function_p2p< fold2d<along_0,along_1> >
- {
- typedef point2d result;
- result operator()(const point2d& p) const
- {
- point2d tmp(along_0 ? p[0] % b.len(0) : p[0],
- along_1 ? p[1] % b.len(1) : p[1]);
- return tmp;
- }
- box2d b;
- };
-
- template <bool along_0, bool along_1, bool along_2>
- struct fold3d : Function_p2p< fold3d<along_0,along_1,along_2> >
- {
- typedef point3d result;
- result operator()(const point3d& p) const
- {
- point3d tmp(along_0 ? p[0] % b.len(0) : p[0],
- along_1 ? p[1] % b.len(1) : p[1],
- along_2 ? p[2] % b.len(2) : p[2]);
- return tmp;
- }
- box3d b;
- };
-
- } // mln::fun::p2p
-
-
- } // mln::fun
-
-
- // -------------------------------------------------- value
-
-
- namespace value
- {
-
- template <unsigned n, int inf, int sup>
- struct circular
- {
- };
-
-
- namespace internal
- {
- template <typename T>
- struct is_circular_helper : metal::false_
- {};
-
- template <unsigned n, int inf, int sup>
- struct is_circular_helper< circular<n,inf,sup> > : metal::true_
- {};
-
- template <typename T>
- struct is_circular : is_circular_helper<T>::eval
- {
- };
-
- } // mln::value::internal
-
- } // mln::value
-
-
- namespace trait
- {
-
- template <unsigned n, int inf, int sup>
- struct value_< mln::value::circular<n, inf, sup> >
- {
- enum {
- dim = 1,
- nbits = n,
- card = mln_value_card_from_(n)
- };
- // ...
- };
-
- } // end of namespace trait
-
-
- // -------------------------------------------------- histo
-
-
- namespace histo
- {
-
- namespace internal
- {
-
- template <int dim, typename T>
- struct image_from_value_helper
- {
- };
-
- // dim = 1
-
- template <typename T, bool is_c>
- struct image_from_value_helper_1;
-
- template <typename T>
- struct image_from_value_helper_1< T, false >
- {
- typedef image1d<unsigned> ret;
-
- static ret get_image()
- {
- ret tmp(mln_card(T));
- return tmp;
- }
- };
-
- template <typename T>
- struct image_from_value_helper_1< T, true >
- {
- typedef void ret;
- };
-
- template <typename T>
- struct image_from_value_helper< 1, T >
- {
- enum { is_c = value::internal::is_circular<T>::value };
- typedef image_from_value_helper_1< T, is_c > helper;
- };
-
- // dim = 3
-
- template <typename C0, bool is_c0,
- typename C1, bool is_c1,
- typename C2, bool is_c2,
- typename T>
- struct image_from_value_helper_3;
-
- template <typename C0, typename C1, typename C2,
- typename T>
- struct image_from_value_helper_3< C0, false,
- C1, false,
- C2, false,
- T >
- {
- typedef image3d<unsigned> ret;
- static ret get_image()
- {
- ret tmp(mln_card(C0), mln_card(C1), mln_card(C2));
- return tmp;
- }
- };
-
- template <typename C0, typename C1, typename C2,
- typename T>
- struct image_from_value_helper_3< C0, true,
- C1, false,
- C2, false,
- T >
- {
- typedef void ret;
- };
-
- template <typename T>
- struct image_from_value_helper< 3, T >
- {
- typedef mln_trait_value_comp(T, 0) C0;
- typedef mln_trait_value_comp(T, 1) C1;
- typedef mln_trait_value_comp(T, 2) C2;
- typedef image_from_value_helper_3< C0, value::internal::is_circular<C0>::value,
- C1, value::internal::is_circular<C1>::value,
- C2, value::internal::is_circular<C2>::value,
- T > helper;
- };
-
- template <typename T>
- struct image_from_value_ // Entry point.
- {
- typedef typename image_from_value_helper<mln_dim(T), T>::helper helper;
- };
-
-
- } // mln::histo::internal
+# endif // ! MLN_INCLUDE_ONLY
- template <typename T>
- struct image_from_value : internal::image_from_value_<T>::helper
- {
- };
+ } // end of namespace mln::fun::v2i
+ } // end of namespace mln::fun
+} // end of namespace mln
- // First code: the result of this function shall be replaced by
- // an histo::image<T> where T is mln_value(I). As a consequence,
- // we will not have to call meta_point_from_value...
-
- template <typename I>
- typename image_from_value<mln_value(I)>::ret
- compute_image(const Image<I>& input_)
- {
- const I& input = exact(input_);
- typedef image_from_value<mln_value(I)> helper;
- typename helper::ret h = helper::get_image();
-
- mln_piter(I) p(input.domain());
- for_all(p)
- ++h( fun::v2v::meta_point_from_value(input(p)) );
-
- return h;
- }
-
- } // mln::histo
-
-} // mln
-
-
-int main()
-{
- using namespace mln;
-
- {
- typedef bool T;
- std::cout << histo::image_from_value<T>::get_image().domain() << std::endl;
- }
-
- {
- typedef unsigned char T;
- std::cout << histo::image_from_value<T>::get_image().domain() << std::endl;
- }
-
- {
- typedef value::int_s<3> T;
- std::cout << histo::image_from_value<T>::get_image().domain() << std::endl;
- }
-
- {
- typedef value::rgb8 T;
- std::cout << histo::image_from_value<T>::get_image().domain() << std::endl;
- }
-
- {
- // typedef value::circular<8,0,9> T;
- }
-}
+#endif // ! MLN_FUN_V2I_INDEX_OF_VALUE_HH
Property changes on: mln/fun/v2i/index_of_value.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: mln/fun/v2i/all.hh
--- mln/fun/v2i/all.hh (revision 0)
+++ mln/fun/v2i/all.hh (revision 0)
@@ -0,0 +1,57 @@
+// 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_FUN_V2I_ALL_HH
+# define MLN_FUN_V2I_ALL_HH
+
+/// \file mln/fun/v2i/all.hh
+///
+/// \brief File that includes all value-to-integer functions.
+
+
+namespace mln
+{
+
+ /// Namespace of functions.
+ namespace fun
+ {
+
+ /// \brief Namespace of value-to-integer functions.
+ ///
+ /// \ingroup modfun
+ //
+ namespace v2i
+ {}
+
+ }
+}
+
+
+# include <mln/fun/v2i/index_of_value.hh>
+
+
+#endif // ! MLN_FUN_V2I_ALL_HH
Index: mln/fun/all.hh
--- mln/fun/all.hh (revision 3869)
+++ mln/fun/all.hh (working copy)
@@ -31,13 +31,13 @@
/// \file mln/fun/all.hh
///
-/// File that includes all fun-related routines.
+/// File that includes all functions.
namespace mln
{
- /// Namespace of image processing routines related to functions.
+ /// Namespace of functions.
namespace fun
{
@@ -57,6 +57,7 @@
# include <mln/fun/p2v/all.hh>
# include <mln/fun/stat/all.hh>
# include <mln/fun/v2b/all.hh>
+# include <mln/fun/v2i/all.hh>
# include <mln/fun/v2v/all.hh>
# include <mln/fun/vv2v/all.hh>
# include <mln/fun/x2p/all.hh>
Index: tests/fun/i2v/array.cc
--- tests/fun/i2v/array.cc (revision 0)
+++ tests/fun/i2v/array.cc (revision 0)
@@ -0,0 +1,48 @@
+// 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/fun/i2v/array.cc
+///
+/// Test on mln::fun::i2v::array.
+
+#include <mln/fun/i2v/array.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ fun::i2v::array<int> f;
+ mln_assertion(f.size() == 0u);
+
+ f.append(0);
+ mln_assertion(f(0) == 0);
+
+ f.append(1);
+ mln_assertion(f(1) == 1);
+ mln_assertion(f.size() == 2u);
+}
Index: tests/fun/i2v/Makefile.am
--- tests/fun/i2v/Makefile.am (revision 3869)
+++ tests/fun/i2v/Makefile.am (working copy)
@@ -1,3 +1,14 @@
## Process this file through Automake to create Makefile.in.
include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ all_to \
+ array \
+ value_at_index
+
+all_to_SOURCES = all_to.cc
+array_SOURCES = array.cc
+value_at_index_SOURCES = value_at_index.cc
+
+TESTS = $(check_PROGRAMS)
Index: tests/fun/i2v/value_at_index.cc
--- tests/fun/i2v/value_at_index.cc (revision 0)
+++ tests/fun/i2v/value_at_index.cc (revision 0)
@@ -0,0 +1,57 @@
+// 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/fun/i2v/value_at_index.cc
+///
+/// Test on mln::fun::i2v::value_at_index.
+
+#include <mln/fun/i2v/value_at_index.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_s8.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ fun::i2v::value_at_index<bool> f;
+ mln_assertion(f(0) == false);
+ mln_assertion(f(1) == true);
+ }
+ {
+ fun::i2v::value_at_index< value::int_u8 > f;
+ mln_assertion(f( 0) == 0);
+ mln_assertion(f(255) == 255);
+ }
+ {
+ fun::i2v::value_at_index< value::int_s8 > f;
+ mln_assertion(f( 0) == -127);
+ mln_assertion(f(254) == +127);
+ }
+
+}
Index: tests/fun/i2v/all_to.cc
--- tests/fun/i2v/all_to.cc (revision 0)
+++ tests/fun/i2v/all_to.cc (revision 0)
@@ -0,0 +1,44 @@
+// 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/fun/i2v/all_to.cc
+///
+/// Test on mln::fun::i2v::all_to.
+
+#include <mln/fun/i2v/all_to.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ fun::i2v::all_to<int> f(51);
+
+ mln_assertion(f( 0) == 51);
+ mln_assertion(f( 1) == 51);
+ mln_assertion(f(51) == 51);
+}
Index: tests/fun/v2i/Makefile.am
--- tests/fun/v2i/Makefile.am (revision 0)
+++ tests/fun/v2i/Makefile.am (revision 0)
@@ -0,0 +1,10 @@
+## Process this file through Automake to create Makefile.in.
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ index_of_value
+
+index_of_value_SOURCES = index_of_value.cc
+
+TESTS = $(check_PROGRAMS)
Index: tests/fun/v2i/index_of_value.cc
--- tests/fun/v2i/index_of_value.cc (revision 0)
+++ tests/fun/v2i/index_of_value.cc (revision 0)
@@ -0,0 +1,56 @@
+// 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/fun/v2i/index_of_value.cc
+///
+/// Test on mln::fun::v2i::index_of_value.
+
+#include <mln/fun/v2i/index_of_value.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_s8.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ fun::v2i::index_of_value<bool> f;
+ mln_assertion(f(false) == 0);
+ mln_assertion(f(true) == 1);
+ }
+ {
+ fun::v2i::index_of_value< value::int_u8 > f;
+ mln_assertion(f( 0) == 0);
+ mln_assertion(f(255) == 255);
+ }
+ {
+ fun::v2i::index_of_value< value::int_s8 > f;
+ mln_assertion(f(-127) == 0);
+ mln_assertion(f(+127) == 254);
+ }
+}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-05-25 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Reconstruction by erosion.
* mln/morpho/reconstruction/by_erosion/all.hh,
* mln/morpho/reconstruction/by_erosion/union_find.hh,
* mln/morpho/reconstruction/by_erosion:
Reconstruction by erosion.
* tests/morpho/reconstruction/Makefile.am,
* tests/morpho/reconstruction/by_erosion/union_find.cc,
* tests/morpho/reconstruction/by_erosion,
* tests/unit_test/unit-tests.mk:
Reconstruction by erosion test files.
---
mln/morpho/reconstruction/by_erosion/all.hh | 59 ++++
mln/morpho/reconstruction/by_erosion/union_find.hh | 280 +++++++++++++++++++
tests/morpho/reconstruction/Makefile.am | 3
tests/morpho/reconstruction/by_erosion/Makefile.am | 15 +
tests/morpho/reconstruction/by_erosion/union_find.cc | 64 ++++
tests/unit_test/unit-tests.mk | 20 +
6 files changed, 438 insertions(+), 3 deletions(-)
Index: trunk/milena/tests/morpho/reconstruction/by_erosion/Makefile.am
===================================================================
--- trunk/milena/tests/morpho/reconstruction/by_erosion/Makefile.am (revision 0)
+++ trunk/milena/tests/morpho/reconstruction/by_erosion/Makefile.am (revision 3869)
@@ -0,0 +1,15 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+
+check_PROGRAMS = \
+ union_find
+
+
+union_find_SOURCES = union_find.cc
+
+
+TESTS = $(check_PROGRAMS)
+
+
Index: trunk/milena/tests/morpho/reconstruction/by_erosion/union_find.cc
===================================================================
--- trunk/milena/tests/morpho/reconstruction/by_erosion/union_find.cc (revision 0)
+++ trunk/milena/tests/morpho/reconstruction/by_erosion/union_find.cc (revision 3869)
@@ -0,0 +1,64 @@
+// 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/reconstruction/by_erosion/union_find.cc
+///
+/// Test on mln::morpho::reconstruction::by_erosion::union_find
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/pw/all.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/level/compare.hh>
+
+#include <mln/morpho/reconstruction/by_erosion/union_find.hh>
+
+#include "tests/data.hh"
+
+
+
+int main()
+{
+ using namespace mln;
+ using namespace morpho::reconstruction::by_erosion;
+
+ image2d<value::int_u8> lena, lena_2, out;
+ io::pgm::load(lena, MLN_IMG_DIR "/tiny.pgm");
+
+ {
+ out = union_find(lena, lena, c4());
+ mln_assertion(out == lena);
+ }
+
+ {
+ initialize(lena_2, lena);
+ data::fill(lena_2, lena);
+ out = union_find(lena_2, lena, c4());
+ }
+}
Property changes on: trunk/milena/tests/morpho/reconstruction/by_erosion
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/tests/morpho/reconstruction/Makefile.am
===================================================================
--- trunk/milena/tests/morpho/reconstruction/Makefile.am (revision 3868)
+++ trunk/milena/tests/morpho/reconstruction/Makefile.am (revision 3869)
@@ -3,7 +3,8 @@
include $(top_srcdir)/milena/tests/tests.mk
SUBDIRS = \
- by_dilation
+ by_dilation \
+ by_erosion
TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/unit_test/unit-tests.mk
===================================================================
--- trunk/milena/tests/unit_test/unit-tests.mk (revision 3868)
+++ trunk/milena/tests/unit_test/unit-tests.mk (revision 3869)
@@ -239,6 +239,8 @@
mln_core_image_complex_window_piter \
mln_core_image_complex_windows \
mln_core_image_decorated_image \
+mln_core_image_dmorph_all \
+mln_core_image_dmorph_transformed_image \
mln_core_image_edge_image \
mln_core_image_essential \
mln_core_image_extended \
@@ -376,6 +378,8 @@
mln_core_site_set_p_run_piter \
mln_core_site_set_p_set \
mln_core_site_set_p_set_of \
+mln_core_site_set_p_transformed \
+mln_core_site_set_p_transformed_piter \
mln_core_site_set_p_vaccess \
mln_core_site_set_p_vertices \
mln_core_site_set_p_vertices_psite \
@@ -635,6 +639,8 @@
mln_io_pgm_all \
mln_io_pgm_load \
mln_io_pgm_save \
+mln_io_plot_all \
+mln_io_plot_load \
mln_io_plot_save \
mln_io_pnm_all \
mln_io_pnm_load_header \
@@ -648,7 +654,6 @@
mln_io_ppm_save \
mln_io_tiff_all \
mln_io_tiff_load \
-mln_io_tiff_save \
mln_io_txt_all \
mln_io_txt_save \
mln_labeling_all \
@@ -900,6 +905,8 @@
mln_morpho_reconstruction_all \
mln_morpho_reconstruction_by_dilation_all \
mln_morpho_reconstruction_by_dilation_union_find \
+mln_morpho_reconstruction_by_erosion_all \
+mln_morpho_reconstruction_by_erosion_union_find \
mln_morpho_skeleton_constrained \
mln_morpho_thickening \
mln_morpho_thick_miss \
@@ -1211,6 +1218,7 @@
mln_value_stack \
mln_value_super_value \
mln_value_viter \
+mln_version \
mln_win_all \
mln_win_backdiag2d \
mln_win_ball \
@@ -1490,6 +1498,8 @@
mln_core_image_complex_window_piter_SOURCES = mln_core_image_complex_window_piter.cc
mln_core_image_complex_windows_SOURCES = mln_core_image_complex_windows.cc
mln_core_image_decorated_image_SOURCES = mln_core_image_decorated_image.cc
+mln_core_image_dmorph_all_SOURCES = mln_core_image_dmorph_all.cc
+mln_core_image_dmorph_transformed_image_SOURCES = mln_core_image_dmorph_transformed_image.cc
mln_core_image_edge_image_SOURCES = mln_core_image_edge_image.cc
mln_core_image_essential_SOURCES = mln_core_image_essential.cc
mln_core_image_extended_SOURCES = mln_core_image_extended.cc
@@ -1627,6 +1637,8 @@
mln_core_site_set_p_run_piter_SOURCES = mln_core_site_set_p_run_piter.cc
mln_core_site_set_p_set_SOURCES = mln_core_site_set_p_set.cc
mln_core_site_set_p_set_of_SOURCES = mln_core_site_set_p_set_of.cc
+mln_core_site_set_p_transformed_SOURCES = mln_core_site_set_p_transformed.cc
+mln_core_site_set_p_transformed_piter_SOURCES = mln_core_site_set_p_transformed_piter.cc
mln_core_site_set_p_vaccess_SOURCES = mln_core_site_set_p_vaccess.cc
mln_core_site_set_p_vertices_SOURCES = mln_core_site_set_p_vertices.cc
mln_core_site_set_p_vertices_psite_SOURCES = mln_core_site_set_p_vertices_psite.cc
@@ -1886,6 +1898,8 @@
mln_io_pgm_all_SOURCES = mln_io_pgm_all.cc
mln_io_pgm_load_SOURCES = mln_io_pgm_load.cc
mln_io_pgm_save_SOURCES = mln_io_pgm_save.cc
+mln_io_plot_all_SOURCES = mln_io_plot_all.cc
+mln_io_plot_load_SOURCES = mln_io_plot_load.cc
mln_io_plot_save_SOURCES = mln_io_plot_save.cc
mln_io_pnm_all_SOURCES = mln_io_pnm_all.cc
mln_io_pnm_load_header_SOURCES = mln_io_pnm_load_header.cc
@@ -1899,7 +1913,6 @@
mln_io_ppm_save_SOURCES = mln_io_ppm_save.cc
mln_io_tiff_all_SOURCES = mln_io_tiff_all.cc
mln_io_tiff_load_SOURCES = mln_io_tiff_load.cc
-mln_io_tiff_save_SOURCES = mln_io_tiff_save.cc
mln_io_txt_all_SOURCES = mln_io_txt_all.cc
mln_io_txt_save_SOURCES = mln_io_txt_save.cc
mln_labeling_all_SOURCES = mln_labeling_all.cc
@@ -2151,6 +2164,8 @@
mln_morpho_reconstruction_all_SOURCES = mln_morpho_reconstruction_all.cc
mln_morpho_reconstruction_by_dilation_all_SOURCES = mln_morpho_reconstruction_by_dilation_all.cc
mln_morpho_reconstruction_by_dilation_union_find_SOURCES = mln_morpho_reconstruction_by_dilation_union_find.cc
+mln_morpho_reconstruction_by_erosion_all_SOURCES = mln_morpho_reconstruction_by_erosion_all.cc
+mln_morpho_reconstruction_by_erosion_union_find_SOURCES = mln_morpho_reconstruction_by_erosion_union_find.cc
mln_morpho_skeleton_constrained_SOURCES = mln_morpho_skeleton_constrained.cc
mln_morpho_thickening_SOURCES = mln_morpho_thickening.cc
mln_morpho_thick_miss_SOURCES = mln_morpho_thick_miss.cc
@@ -2462,6 +2477,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/reconstruction/by_erosion/all.hh
===================================================================
--- trunk/milena/mln/morpho/reconstruction/by_erosion/all.hh (revision 0)
+++ trunk/milena/mln/morpho/reconstruction/by_erosion/all.hh (revision 3869)
@@ -0,0 +1,59 @@
+// 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_RECONSTRUCTION_BY_EROSION_ALL_HH
+# define MLN_MORPHO_RECONSTRUCTION_BY_EROSION_ALL_HH
+
+
+/// \file mln/morpho/reconstruction by erosion/all.hh
+///
+/// File that includes all morphological reconstruction by erosion routines.
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ namespace reconstruction
+ {
+
+ /// Namespace of morphological reconstruction by erosion routines.
+ namespace by_erosion
+ {}
+
+ }
+ }
+}
+
+
+# include <mln/morpho/reconstruction/by_erosion/union_find.hh>
+// ...
+
+
+#endif // ! MLN_MORPHO_RECONSTRUCTION_BY_EROSION_ALL_HH
Property changes on: trunk/milena/mln/morpho/reconstruction/by_erosion/all.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/mln/morpho/reconstruction/by_erosion/union_find.hh
===================================================================
--- trunk/milena/mln/morpho/reconstruction/by_erosion/union_find.hh (revision 0)
+++ trunk/milena/mln/morpho/reconstruction/by_erosion/union_find.hh (revision 3869)
@@ -0,0 +1,280 @@
+// Copyright (C) 2007, 2008, 2009 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_MORPHO_RECONSTRUCTION_BY_EROSION_UNION_FIND_HH
+# define MLN_MORPHO_RECONSTRUCTION_BY_EROSION_UNION_FIND_HH
+
+# include <vector>
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/data/fill.hh>
+# include <mln/level/compare.hh>
+# include <mln/level/sort_psites.hh>
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ namespace reconstruction
+ {
+
+ namespace by_erosion
+ {
+
+
+ template <typename I, typename J, typename N>
+ mln_concrete(I)
+ union_find(const Image<I>& f, const Image<J>& g,
+ const Neighborhood<N>& nbh);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Tests.
+
+ namespace internal
+ {
+
+ template <typename I, typename J, typename N>
+ inline
+ void
+ union_find_tests(const Image<I>& f_, const Image<J>& g_,
+ const Neighborhood<N>& nbh_)
+ {
+ const I& f = exact(f_);
+ const J& g = exact(g_);
+ const N& nbh = exact(nbh_);
+
+ mln_precondition(f.is_valid());
+ mln_precondition(g.is_valid());
+ mln_precondition(nbh.is_valid());
+
+ mln_precondition(f.domain() == g.domain()); // FIXME: Relax?
+ mln_precondition(f >= g);
+
+ // mlc_equal(mln_value(I), mln_value(J))::check(); // FIXME: Too strong!
+ // FIXME: Also check that we have a total ordering for values.
+
+ (void) f;
+ (void) g;
+ (void) nbh;
+ }
+
+
+
+ template <typename Par>
+ inline
+ mln_site(Par) find_root(Par& parent, mln_site(Par) x)
+ {
+ if (parent(x) == x)
+ return x;
+ else
+ return parent(x) = find_root(parent, parent(x));
+ }
+
+
+ } // end of namespace mln::morpho::reconstruction::by_erosion::internal
+
+
+ // Implementations.
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+
+ template <typename I, typename J, typename N>
+ inline
+ mln_concrete(I)
+ union_find(const Image<I>& f_, const Image<J>& g_,
+ const Neighborhood<N>& nbh_)
+ {
+ trace::entering("morpho::reconstruction::by_erosion::impl::generic::union_find");
+
+ const I& f = exact(f_);
+ const J& g = exact(g_);
+ const N& nbh = exact(nbh_);
+
+ internal::union_find_tests(f, g, nbh);
+
+ typedef mln_site(I) P;
+ typedef mln_value(I) V;
+
+ // Auxiliary data.
+ p_array<P> s;
+ mln_ch_value(I, bool) deja_vu;
+ mln_ch_value(I, P) parent;
+ mln_concrete(I) output;
+
+ // Initialization.
+ {
+ initialize(output, f);
+ data::fill(output, f);
+ initialize(parent, f);
+ initialize(deja_vu, f);
+ data::fill(deja_vu, false);
+
+ s = level::sort_psites_increasing(g);
+ }
+
+ // First pass.
+ {
+ for (unsigned i = 0; i < s.nsites(); ++i)
+ {
+ P p = s[i];
+ parent(p) = p; // Make-Set.
+ mln_niter(N) n(nbh, p);
+ for_all(n)
+ {
+// if (f.domain().has(n))
+// mln_invariant(deja_vu(n)
+// ==
+// (g(n) > g(p) || (g(n) == g(p)
+// && util::ord_strict(n, p))));
+ if (f.domain().has(n) && deja_vu(n))
+ {
+ // Do-Union.
+ P r = internal::find_root(parent, n);
+ if (r != p)
+ {
+ if (g(r) == g(p) || g(p) <= output(r)) // Equivalence test.
+ {
+ parent(r) = p;
+ if (output(r) < output(p))
+ output(p) = output(r); // Increasing criterion.
+ }
+ else
+ output(p) = mln_min(V);
+ }
+ }
+ }
+ deja_vu(p) = true;
+ }
+ }
+
+ // Second pass.
+ {
+ for (int i = s.nsites() - 1; i >= 0; --i)
+ {
+ P p = s[i];
+ if (parent(p) == p)
+ {
+ if (output(p) == mln_min(V))
+ output(p) = g(p);
+ }
+ else
+ output(p) = output(parent(p));
+ }
+ }
+
+ mln_postcondition(output >= f);
+ mln_postcondition(output >= g);
+
+ trace::exiting("morpho::reconstruction::by_erosion::impl::generic::union_find");
+ return output;
+ }
+
+ } // end of namespace mln::morpho::reconstruction::by_erosion::impl::generic
+
+ } // end of namespace mln::morpho::reconstruction::by_erosion::impl
+
+
+ // Dispatch.
+
+ namespace internal
+ {
+
+ template <typename I, typename J, typename N>
+ inline
+ mln_concrete(I)
+ union_find_dispatch(trait::image::kind::logic,
+ const Image<I>& f, const Image<J>& g,
+ const Neighborhood<N>& nbh)
+ {
+ // FIXME: Not yet implemented.
+ }
+
+ template <typename I, typename J, typename N>
+ inline
+ mln_concrete(I)
+ union_find_dispatch(trait::image::kind::any,
+ const Image<I>& f, const Image<J>& g,
+ const Neighborhood<N>& nbh)
+ {
+ return impl::generic::union_find(f, g, nbh);
+ }
+
+ template <typename I, typename J, typename N>
+ inline
+ mln_concrete(I)
+ union_find_dispatch(const Image<I>& f, const Image<J>& g,
+ const Neighborhood<N>& nbh)
+ {
+ return union_find_dispatch(mln_trait_image_kind(I)(),
+ f, g, nbh);
+ }
+
+ } // end of namespace mln::morpho::reconstruction::by_erosion::internal
+
+
+ // Facade.
+
+ template <typename I, typename J, typename N>
+ inline
+ mln_concrete(I)
+ union_find(const Image<I>& f, const Image<J>& g,
+ const Neighborhood<N>& nbh)
+ {
+ trace::entering("morpho::reconstruction::by_erosion::union_find");
+
+ internal::union_find_tests(f, g, nbh);
+
+ mln_concrete(I) output;
+ output = internal::union_find_dispatch(f, g, nbh);
+
+ trace::exiting("morpho::reconstruction::by_erosion::union_find");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::morpho::reconstruction::by_erosion
+
+ } // end of namespace mln::morpho::reconstruction
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MORPHO_RECONSTRUCTION_BY_EROSION_UNION_FIND_HH
Property changes on: trunk/milena/mln/morpho/reconstruction/by_erosion/union_find.hh
___________________________________________________________________
Added: svn:mergeinfo