Commit 141ec5bf authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

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.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@4229 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 244819d1
2009-06-30 Guillaume Lazzara <guillaume.lazzara@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@lrde.epita.fr>
 
* mln/topo/skeleton/crest.hh: Fix a warning.
......@@ -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);
......
......@@ -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;
};
......@@ -223,6 +230,23 @@ namespace mln
this->data_->tr_ = tr;
}
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>
......
// 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.
/// \{
......@@ -251,6 +255,18 @@ namespace mln
convert::from_to(f, f_);
}
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
......
// 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;
}
......
......@@ -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
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment