* mln/core/image/dmorph/sub_image.hh: add missing 'const'.
* mln/core/image/imorph/tr_image.hh: add missing members.
* mln/core/site_set/p_vertices.hh: add a more generic constructor.
* mln/labeling/blobs.hh: revamp warning output.
* mln/labeling/n_max.hh: add an overload.
* mln/make/edge_image.hh: fix namespace ambiguities.
---
milena/ChangeLog | 16 ++++++++++++++++
milena/mln/core/image/dmorph/sub_image.hh | 12 ++++++------
milena/mln/core/image/imorph/tr_image.hh | 24 ++++++++++++++++++++++++
milena/mln/core/site_set/p_vertices.hh | 16 ++++++++++++++++
milena/mln/labeling/blobs.hh | 6 +++---
milena/mln/labeling/n_max.hh | 24 ++++++++++++++++++++++++
milena/mln/make/edge_image.hh | 14 +++++++-------
7 files changed, 96 insertions(+), 16 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7bc9e0a..51bcd4e 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,21 @@
2009-06-30 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+ Small fixes.
+
+ * mln/core/image/dmorph/sub_image.hh: add missing 'const'.
+
+ * mln/core/image/imorph/tr_image.hh: add missing members.
+
+ * mln/core/site_set/p_vertices.hh: add a more generic constructor.
+
+ * mln/labeling/blobs.hh: revamp warning output.
+
+ * mln/labeling/n_max.hh: add an overload.
+
+ * mln/make/edge_image.hh: fix namespace ambiguities.
+
+2009-06-30 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
* mln/topo/skeleton/crest.hh: Fix a warning.
2009-06-30 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
diff --git a/milena/mln/core/image/dmorph/sub_image.hh
b/milena/mln/core/image/dmorph/sub_image.hh
index c54b612..9155b09 100644
--- a/milena/mln/core/image/dmorph/sub_image.hh
+++ b/milena/mln/core/image/dmorph/sub_image.hh
@@ -53,7 +53,7 @@ namespace mln
template <typename I, typename S>
struct data< sub_image<I,S> >
{
- data(I& ima, const S& pset);
+ data(const I& ima, const S& pset);
I ima_;
S domain_;
@@ -109,10 +109,10 @@ namespace mln
sub_image();
/// Constructor.
- sub_image(I& ima, const S& pset);
+ sub_image(const I& ima, const S& pset);
/// Initialization.
- void init_(I& ima, const S& pset);
+ void init_(const I& ima, const S& pset);
/// Give the definition domain.
const S& domain() const;
@@ -164,7 +164,7 @@ namespace mln
template <typename I, typename S>
inline
- data< sub_image<I,S> >::data(I& ima, const S& pset)
+ data< sub_image<I,S> >::data(const I& ima, const S& pset)
: ima_(ima),
domain_(pset)
{
@@ -183,7 +183,7 @@ namespace mln
template <typename I, typename S>
inline
- sub_image<I,S>::sub_image(I& ima, const S& pset)
+ sub_image<I,S>::sub_image(const I& ima, const S& pset)
{
init_(ima, pset);
}
@@ -191,7 +191,7 @@ namespace mln
template <typename I, typename S>
inline
void
- sub_image<I,S>::init_(I& ima, const S& pset)
+ sub_image<I,S>::init_(const I& ima, const S& pset)
{
mln_precondition(! this->is_valid());
this->data_ = new internal::data< sub_image<I,S> >(ima, pset);
diff --git a/milena/mln/core/image/imorph/tr_image.hh
b/milena/mln/core/image/imorph/tr_image.hh
index 530f8ab..cfe5b08 100644
--- a/milena/mln/core/image/imorph/tr_image.hh
+++ b/milena/mln/core/image/imorph/tr_image.hh
@@ -136,7 +136,14 @@ namespace mln
mln_value(I) operator()(const psite& p) const;
mln_value(I) operator()(const psite& p);
+ /// Set the transformation.
void set_tr(T& tr);
+
+ /// Return the underlying transformation.
+ const T& tr() const;
+
+ /// Return the domain morpher.
+ const S& domain() const;
};
@@ -225,6 +232,23 @@ namespace mln
template <typename S, typename I, typename T>
inline
+ const T&
+ tr_image<S,I,T>::tr() const
+ {
+ return this->data_->tr_;
+ }
+
+ template <typename S, typename I, typename T>
+ inline
+ const S&
+ tr_image<S,I,T>::domain() const
+ {
+ return this->data_->s_;
+ }
+
+
+ template <typename S, typename I, typename T>
+ inline
tr_image<S,I,T>
transposed_image(const Site_Set<S>& s, const Image<I>& ima,
const Function_v2v<T>& t)
diff --git a/milena/mln/core/site_set/p_vertices.hh
b/milena/mln/core/site_set/p_vertices.hh
index 367f3f4..f8a73d7 100644
--- a/milena/mln/core/site_set/p_vertices.hh
+++ b/milena/mln/core/site_set/p_vertices.hh
@@ -1,3 +1,4 @@
+
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
@@ -111,6 +112,9 @@ namespace mln
p_vertices(const Graph<G>& gr, const Function<F2>& f);
/// \}
+ /// Copy constructor.
+ template <typename F2>
+ p_vertices(const p_vertices<G,F2>& other);
/// Associated types.
/// \{
@@ -252,6 +256,18 @@ namespace mln
}
template <typename G, typename F>
+ template <typename F2>
+ inline
+ p_vertices<G,F>::p_vertices(const p_vertices<G,F2>& other)
+ {
+ mln_precondition(other.is_valid());
+ mlc_converts_to(F2,F)::check();
+
+ g_ = other.graph();
+ convert::from_to(other.function(), f_);
+ }
+
+ template <typename G, typename F>
inline
unsigned
p_vertices<G,F>::nsites() const
diff --git a/milena/mln/labeling/blobs.hh b/milena/mln/labeling/blobs.hh
index ccbcde4..bfb7b4c 100644
--- a/milena/mln/labeling/blobs.hh
+++ b/milena/mln/labeling/blobs.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -102,8 +103,7 @@ namespace mln
if (nlabels == mln_max(L))
{
trace::warning("labeling aborted! Too many labels \
- for this label type: nlabels > \
- max(label_type).");
+for this label type: nlabels > max(label_type).");
return output;
}
diff --git a/milena/mln/labeling/n_max.hh b/milena/mln/labeling/n_max.hh
index 4be453c..f17f619 100644
--- a/milena/mln/labeling/n_max.hh
+++ b/milena/mln/labeling/n_max.hh
@@ -27,6 +27,8 @@
# define MLN_LABELING_N_MAX_HH
# include <mln/core/concept/image.hh>
+# include <mln/accu/math/count.hh>
+# include <mln/labeling/compute.hh>
# include <mln/util/array.hh>
/// \file
@@ -48,6 +50,11 @@ namespace mln
n_max(const util::array<V>& in_arr, unsigned n);
+ template <typename L>
+ util::array<mln_value(L)>
+ n_max(const Image<L>& lbl, const mln_value(L)& nlabels, unsigned n);
+
+
# ifndef MLN_INCLUDE_ONLY
template <typename L, typename V>
@@ -79,6 +86,23 @@ namespace mln
return output;
}
+
+ template <typename L>
+ util::array<mln_value(L)>
+ n_max(const Image<L>& lbl, const mln_value(L)& nlabels, unsigned n)
+ {
+ mln_precondition(exact(lbl).is_valid());
+
+ typedef accu::math::count<mln_site(L)> accu_t;
+ accu_t accu;
+
+ util::array<mln_result(accu_t)>
+ counts = labeling::compute(accu, lbl, nlabels);
+
+ return n_max<mln_value(L)>(counts, n);
+ }
+
+
# endif // !MLN_INCLUDE_ONLY
} // end of namespace mln::labeling
diff --git a/milena/mln/make/edge_image.hh b/milena/mln/make/edge_image.hh
index c19a2dd..7732e7b 100644
--- a/milena/mln/make/edge_image.hh
+++ b/milena/mln/make/edge_image.hh
@@ -83,7 +83,7 @@ namespace mln
//
template <typename P, typename V, typename G, typename FP, typename FV>
mln::edge_image<mln_result(FP),mln_result(FV),G>
- edge_image(const vertex_image<P,V,G>& v_ima_,
+ edge_image(const mln::vertex_image<P,V,G>& v_ima_,
const p_edges<G,FP> pe,
const Function_vv2v<FV>& fv_);
@@ -100,7 +100,7 @@ namespace mln
//
template <typename P, typename V, typename G, typename FV>
mln::edge_image<void,mln_result(FV),G>
- edge_image(const vertex_image<P,V,G>& v_ima_,
+ edge_image(const mln::vertex_image<P,V,G>& v_ima_,
const Function_vv2v<FV>& fv_);
@@ -145,14 +145,14 @@ namespace mln
template <typename P, typename V, typename G, typename FP, typename FV>
mln::edge_image<mln_result(FP),mln_result(FV),G>
- edge_image(const vertex_image<P,V,G>& v_ima_,
+ edge_image(const mln::vertex_image<P,V,G>& v_ima_,
const p_edges<G,FP> pe,
const Function_vv2v<FV>& fv_)
{
trace::entering("make::edge_image");
const FV& fv = exact(fv_);
- const vertex_image<P,V,G>& v_ima = exact(v_ima_);
+ const mln::vertex_image<P,V,G>& v_ima = exact(v_ima_);
mln_precondition(v_ima.is_valid());
typedef mln::edge_image<mln_result(FP),mln_result(FV),G> edge_ima_t;
@@ -170,16 +170,16 @@ namespace mln
template <typename P, typename V, typename G, typename FV>
mln::edge_image<void,mln_result(FV),G>
- edge_image(const vertex_image<P,V,G>& v_ima_,
+ edge_image(const mln::vertex_image<P,V,G>& v_ima_,
const Function_vv2v<FV>& fv_)
{
trace::entering("make::edge_image");
const FV& fv = exact(fv_);
- const vertex_image<P,V,G>& v_ima = exact(v_ima_);
+ const mln::vertex_image<P,V,G>& v_ima = exact(v_ima_);
mln_precondition(v_ima.is_valid());
- p_edges<G> pe(v_ima.graph());
+ p_edges<G> pe(v_ima.domain().graph());
typedef mln::edge_image<void,mln_result(FV),G> edge_ima_t;
edge_ima_t ima_e(pe);
--
1.5.6.5