Namespaces | Classes | Functions

mln::morpho::tree Namespace Reference

Namespace of morphological tree-related routines. More...

Namespaces

namespace  filter
 

Namespace for attribute filtering.


namespace  impl
namespace  internal

Classes

struct  asc_propagation
class  data
class  depth1st_piter
struct  desc_propagation
struct  dn_leaf_piter
struct  dn_node_piter
struct  dn_site_piter
struct  up_leaf_piter
struct  up_node_piter
struct  up_site_piter
struct  way_of_propagation

Functions

template<typename A , typename T >
mln::trait::ch_value< typename
T::function, typename
A::result >::ret 
compute_attribute_image (const Accumulator< A > &a, const T &t, mln::trait::ch_value< typename T::function, A >::ret *accu_image=0)
 Compute an attribute image using tree with a parent relationship between sites.
template<typename A , typename T , typename V >
mln::trait::ch_value< typename
T::function, typename
A::result >::ret 
compute_attribute_image_from (const Accumulator< A > &a, const T &t, const Image< V > &values, mln::trait::ch_value< typename T::function, A >::ret *accu_image=0)
 The same as compute_attribute_image but uses the values stored by values image instead.
template<typename I , typename N , typename S >
mln::trait::ch_value< I,
typename I::psite >::ret 
compute_parent (const Image< I > &f, const Neighborhood< N > &nbh, const Site_Set< S > &s)
 Compute a tree with a parent relationship between sites.
template<typename T , typename I >
bool is_a_node (const Image< T > &parent, const typename T::psite &p, const Image< I > &f)
template<typename T , typename I >
bool is_root (const Image< T > &parent, const typename T::psite &p, const Image< I > &f)
template<typename I , typename N >
mln::trait::ch_value< I,
typename I::psite >::ret 
max (const Image< I > &f, const Neighborhood< N > &nbh)
template<typename T , typename I , typename S >
p_array< typename T::psite > nodes (const Image< T > &parent, const Image< I > &f, const Site_Set< S > &s)
template<typename T , typename A , typename P , typename W >
void propagate_if (const T &tree, Image< A > &a_, const way_of_propagation< W > &prop_, const Function_v2b< P > &pred_, const typename A::value &v)
template<typename T , typename A , typename P >
void propagate_if (const T &tree, Image< A > &a_, const desc_propagation &prop_, const Function_v2b< P > &pred_)
template<typename T , typename A , typename W >
void propagate_if_value (const T &tree, Image< A > &a_, const way_of_propagation< W > &prop_, const typename A::value &v, const typename A::value &v_prop)
template<typename T , typename A , typename W >
void propagate_if_value (const T &tree, Image< A > &a_, const way_of_propagation< W > &prop, const typename A::value &v)
template<typename T , typename A >
void propagate_node_to_ancestors (typename A::psite n, const T &t, Image< A > &a_, const typename A::value &v)
template<typename T , typename A >
void propagate_node_to_ancestors (typename A::psite n, const T &t, Image< A > &a_)
template<typename T , typename A >
void propagate_node_to_descendants (typename A::psite n, const T &t, Image< A > &a_, const typename A::value &v, unsigned *nb_leaves=0)
template<typename T , typename A >
void propagate_node_to_descendants (typename A::psite n, const T &t, Image< A > &a_, unsigned *nb_leaves=0)
template<typename T , typename A >
void propagate_node_to_descendants (typename A::psite &n, const T &t, Image< A > &a_, unsigned *nb_leaves=0)
template<typename T , typename F >
void propagate_representative (const T &t, Image< F > &f_)
 Propagate the representative node's value to non-representative points of the component.

Detailed Description

Namespace of morphological tree-related routines.


Function Documentation

template<typename A , typename T >
mln::trait::ch_value< typename T::function, typename A::result >::ret mln::morpho::tree::compute_attribute_image ( const Accumulator< A > &  a,
const T &  t,
mln::trait::ch_value< typename T::function, A >::ret *  accu_image = 0 
) [inline]

Compute an attribute image using tree with a parent relationship between sites.

In the attribute image, the resulting value at a node is the 'sum' of its sub-components value + the attribute value at this node.

Warning: s translates the ordering related to the "natural" childhood relationship. The parenthood is thus inverted w.r.t. to s.

It is very convenient since all processing upon the parent tree are performed following s (in the default "forward" way).

FIXME: Put it more clearly...

The parent result image verifies:

  • p is root iff parent(p) == p
  • p is a node iff either p is root or f(parent(p)) != f(p).
Parameters:
[in] a Attribute.
[in] t Component tree.
[out] accu_image Optional argument used to store image of attribute accumulator.
Returns:
The attribute image.

References mln::morpho::tree::internal::compute_attribute_image(), mln::trace::entering(), mln::exact(), and mln::trace::exiting().

template<typename A , typename T , typename V >
mln::trait::ch_value< typename T::function, typename A::result >::ret mln::morpho::tree::compute_attribute_image_from ( const Accumulator< A > &  a,
const T &  t,
const Image< V > &  values,
mln::trait::ch_value< typename T::function, A >::ret *  accu_image = 0 
) [inline]

The same as compute_attribute_image but uses the values stored by values image instead.

Parameters:
[in] a Attribute.
[in] t Component tree.
[in] values Value image.
[out] accu_image Optional argument used to store image.
Returns:

References mln::morpho::tree::internal::compute_attribute_image(), mln::trace::entering(), mln::exact(), and mln::trace::exiting().

template<typename I , typename N , typename S >
mln::trait::ch_value< I, typename I::psite >::ret mln::morpho::tree::compute_parent ( const Image< I > &  f,
const Neighborhood< N > &  nbh,
const Site_Set< S > &  s 
) [inline]

Compute a tree with a parent relationship between sites.

Warning: s translates the ordering related to the "natural" childhood relationship. The parenthood is thus inverted w.r.t. to s.

It is very convenient since most processing routines upon the parent tree are performed following s (in the default "forward" way). Indeed that is the way to propagate information from parents to children.

The parent result image verifies:

  • p is root iff parent(p) == p
  • p is a node iff either p is root or f(parent(p)) != f(p).

The choice "s means childhood" is consistent with labeling in binary images. In that particular case, while browsing the image in forward scan (video), we expect to find first a tree root (a first point, representative of a component) and then the other component points. Please note that it leads to increasing values of labels in the "natural" video scan.

Since mathematical morphology on functions is related to morphology on sets, we clearly want to keep the equivalence between "component labeling" and "component filtering" using trees.

FIXME: Put it more clearly... Insert pictures!

A binary image:

  • | | - -
  • | | - |
  • - - - -
  • - | | -

where '|' means true and '-' means false.

Its labeling:

0 1 1 0 0
0 1 1 0 2
0 0 0 0 0
0 0 3 3 0

The corresponding forest:

x o . x x
x . . x o
x x x x x
x x o . x

where 'x' means "no data", 'o' is a tree root (representative point for a component), and '.' is a tree regular (non-root) point (in a component by not its representative point).

The forest, with the parent relationship looks like:

o < .
^ r
. . o


o < .

References mln::morpho::tree::internal::compute_parent_dispatch(), mln::morpho::tree::internal::compute_parent_tests(), mln::trace::entering(), and mln::trace::exiting().

Referenced by mln::morpho::tree::internal::compute_parent_dispatch(), mln::morpho::tree::data< I, S >::data(), and max().

template<typename T , typename I >
bool mln::morpho::tree::is_a_node ( const Image< T > &  parent,
const typename T::psite &  p,
const Image< I > &  f 
) [inline]

References mln::exact().

Referenced by nodes().

template<typename T , typename I >
bool mln::morpho::tree::is_root ( const Image< T > &  parent,
const typename T::psite &  p,
const Image< I > &  f 
) [inline]

References mln::exact().

template<typename I , typename N >
mln::trait::ch_value< I, typename I::psite >::ret mln::morpho::tree::max ( const Image< I > &  f,
const Neighborhood< N > &  nbh 
) [inline]
template<typename T , typename I , typename S >
p_array< typename T::psite > mln::morpho::tree::nodes ( const Image< T > &  parent,
const Image< I > &  f,
const Site_Set< S > &  s 
) [inline]

References mln::exact(), and is_a_node().

template<typename T , typename A , typename P , typename W >
void mln::morpho::tree::propagate_if ( const T &  tree,
Image< A > &  a_,
const way_of_propagation< W > &  prop_,
const Function_v2b< P > &  pred_,
const typename A::value &  v 
) [inline]

Propagate nodes checking the predicate pred in the way defined by way_of_propagation.

Parameters:
tree Component tree used for propagation.
a_ Attributed image where values are propagated.
prop_ Propagate node in acsendant or descendant way.
pred_ Predicate that node must check to be propagated.
v Value to be propagated. (By default v is the value at the node being propagated).

References mln::exact(), and mln::morpho::tree::internal::propagate_if().

Referenced by mln::morpho::tree::filter::subtractive().

template<typename T , typename A , typename P >
void mln::morpho::tree::propagate_if ( const T &  tree,
Image< A > &  a_,
const desc_propagation &  prop_,
const Function_v2b< P > &  pred_ 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References mln::exact(), and mln::morpho::tree::internal::propagate_if().

template<typename T , typename A , typename W >
void mln::morpho::tree::propagate_if_value ( const T &  tree,
Image< A > &  a_,
const way_of_propagation< W > &  prop_,
const typename A::value &  v,
const typename A::value &  v_prop 
) [inline]

Propagate nodes having the value v in the way defined by way_of_propagation.

Parameters:
tree Component tree used for propagation.
a_ Attributed image where values are propagated.
prop_ Propagate node in acsendant or descendant way.
v Value that node must have to be propagated.
v_prop Value to propagate (By default it is the value at the node being propagated).

References mln::pw::cst(), mln::exact(), mln::morpho::tree::internal::propagate_if(), and mln::pw::value().

template<typename T , typename A , typename W >
void mln::morpho::tree::propagate_if_value ( const T &  tree,
Image< A > &  a_,
const way_of_propagation< W > &  prop,
const typename A::value &  v 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References mln::pw::cst(), mln::exact(), mln::morpho::tree::internal::propagate_if(), and mln::pw::value().

template<typename T , typename A >
void mln::morpho::tree::propagate_node_to_ancestors ( typename A::psite  n,
const T &  t,
Image< A > &  a_,
const typename A::value &  v 
)

Propagate a value v from a node n to its ancestors.

Parameters:
[in] n Node to propagate.
[in] t Component tree used for propagation.
[in] a_ Attribute image where values are propagated.
[in] v Value to propagate.

References mln::exact().

Referenced by propagate_node_to_ancestors().

template<typename T , typename A >
void mln::morpho::tree::propagate_node_to_ancestors ( typename A::psite  n,
const T &  t,
Image< A > &  a_ 
) [inline]

Propagate the node's value to its ancestors.

Parameters:
[in] n Node to propagate.
[in] t Component tree used for propagation.
[in,out] a_ Attribute image where values are propagated.

References mln::exact(), and propagate_node_to_ancestors().

template<typename T , typename A >
void mln::morpho::tree::propagate_node_to_descendants ( typename A::psite  n,
const T &  t,
Image< A > &  a_,
const typename A::value &  v,
unsigned *  nb_leaves = 0 
) [inline]

Propagate a value v from a node n to its descendants.

Parameters:
[in] n Node to propagate.
[in] t Component tree used for propagation.
[in] a_ Attribute image where values are propagated.
[in] v Value to propagate.
[out] nb_leaves Optional. Store the number of leaves in the component.

References mln::exact().

Referenced by propagate_node_to_descendants().

template<typename T , typename A >
void mln::morpho::tree::propagate_node_to_descendants ( typename A::psite  n,
const T &  t,
Image< A > &  a_,
unsigned *  nb_leaves = 0 
) [inline]
template<typename T , typename A >
void mln::morpho::tree::propagate_node_to_descendants ( typename A::psite &  n,
const T &  t,
Image< A > &  a_,
unsigned *  nb_leaves = 0 
) [inline]

Propagate the node's value to its descendants.

Parameters:
[in] n Node to propagate.
[in] t Component tree used for propagation.
[in] a_ Attribute image where values are propagated.
[out] nb_leaves Optional. Store the number of leaves in the component.
template<typename T , typename F >
void mln::morpho::tree::propagate_representative ( const T &  t,
Image< F > &  f_ 
) [inline]

Propagate the representative node's value to non-representative points of the component.

Parameters:
t Component tree.
f_ Value image.

References mln::exact().