oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env > Struct Template Reference

Struct that contains everything to compute an attribute opening or closing. More...

#include <attribute_union_find.hh>

Collaboration diagram for oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef mlc::exact< T >::ret::point_type point_type
 Associated point type.

typedef mlc::exact< T >::ret::value_type data_type
 Associated data_type.

typedef oln::mute< T >::ret image_type
 Image type to open/close.

typedef ATTRIBUTE::lambda_type lambda_type
 Threshold type.

typedef Env env_type
 Environment type.


Public Member Functions

 tarjan_set (const image_type &ima, const env_type &env)
 tarjan_set constructor.

template<bool closing, class N> image_type get_comptute (const lambda_type &lambda, const abstract::neighborhood< N > &Ng)
 Main method to perform an attribute opening/closing.


Protected Member Functions

void make_set (const point_type &x)
 Make a new component from a point.
  • x Root of the component.


point_type find_root (const point_type &x)
 find the root of a component.
  • x A point of the component.


bool criterion (const point_type &x, const point_type &y)
 Check if two components should be merged.
  • x A point of the first component.
  • y A point of the second component.


void uni (const point_type &n, const point_type &p)
 Do union of two components.
  • n A point of the first component.
  • p A point of the second component.


bool is_proc (const point_type &p) const
 Tells if a point has been proceded.


Static Protected Member Functions

const point_typeACTIVE ()
 Return the value of an active point.

const point_typeINACTIVE ()
 Return the value of an inactive point.


Protected Attributes

const image_typeinput_
 Input image.

mute< T, point_type >::ret parent_
 Give a parent of a point.

mute< T, ATTRIBUTE >::ret aux_data_
 Image to store attributes.

const lambda_typelambda_
 Threshold.

const env_type env_
 Environment.


Detailed Description

template<class T, class ATTRIBUTE, class Env = typename oln::morpho::attr::attr_traits< ATTRIBUTE >::env_type>
struct oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >

Struct that contains everything to compute an attribute opening or closing.

Parameters:
T Exact type of images to process.
ATTRIBUTE Exact type of attribute to use.
Env Type of environment to use.

Todo:
FIXME: a similar class is defined in oln/topo/tarjan/union.hh (oln::topo::tarjan::tarjan_set).

Definition at line 56 of file attribute_union_find.hh.


Constructor & Destructor Documentation

template<class T, class ATTRIBUTE, class Env = typename oln::morpho::attr::attr_traits< ATTRIBUTE >::env_type>
oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::tarjan_set const image_type ima,
const env_type env
[inline]
 

tarjan_set constructor.

Parameters:
ima Image to open/close.
env Environment to use to compute attributes.

Definition at line 69 of file attribute_union_find.hh.

References oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::aux_data_, oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::env_, oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::env_type, oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::image_type, oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::INACTIVE(), oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::input_, and oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::parent_.

00069                                                                  : input_(ima),
00070                                                                    parent_(ima.size()),
00071                                                                    aux_data_(ima.size()),
00072                                                                    env_(env)
00073           {
00074             level::fill(parent_, INACTIVE());
00075           }


Member Function Documentation

template<class T, class ATTRIBUTE, class Env = typename oln::morpho::attr::attr_traits< ATTRIBUTE >::env_type>
template<bool closing, class N>
image_type oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::get_comptute const lambda_type lambda,
const abstract::neighborhood< N > &  Ng
[inline]
 

Main method to perform an attribute opening/closing.

Parameters:
closing True -> a closing is performed, an opening otherwise.
lambda Threshold to use for attribute growing.
Ng Neighborhood to use in the algorithm.
Returns:
The resulting image.

Definition at line 87 of file attribute_union_find.hh.

References oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::ACTIVE(), oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::aux_data_, oln::abstract::neighborhood< Exact >::delta(), oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::image_type, oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::INACTIVE(), oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::input_, oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::is_proc(), oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::lambda_, oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::make_set(), oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::parent_, and oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >::uni().

00089           {
00090             lambda_ = &lambda;
00091 
00092             std::vector<point_type>     I(input_.npoints());
00093 
00094             oln::utils::select_distrib_sort<closing>()(input_, I);
00095 
00096             level::fill(aux_data_, ntg_sup_val(lambda_type));
00097             aux_data_.border_adapt_assign(Ng.delta(), ntg_sup_val(lambda_type));
00098 
00099             // We are ready to perform stuff
00100             for (unsigned int p = 0; p < I.size(); ++p)
00101               {
00102                 point_type p_p = I[p];
00103                 make_set(p_p);
00104                 oln_neighb_type(N) Q_prime(Ng, p_p);
00105                 for_all (Q_prime)
00106                   if (is_proc(Q_prime))
00107                     uni(Q_prime.cur(), p_p);
00108               }
00109 
00110             // Resolving phase
00111             image_type output(input_.size());
00112             for (int p = I.size() - 1; p >= 0; --p)
00113               {
00114                 point_type p_p = I[p];
00115                 if ((parent_[p_p] == ACTIVE()) ||  (parent_[p_p] == INACTIVE()))
00116                   output[p_p] = input_[p_p];
00117                 else
00118                   output[p_p] = output[parent_[p_p]];
00119                 // this code is equivalent to
00120                 //      output[I[p].first] = input_[find_root(I[p].first)];
00121 
00122               }
00123             return output;
00124           }


The documentation for this struct was generated from the following file:
Generated on Thu Apr 15 20:16:59 2004 for Olena by doxygen 1.3.6-20040222