#include <attribute_union_find.hh>
Collaboration diagram for oln::morpho::fast::tarjan::tarjan_set< T, ATTRIBUTE, Env >:
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.
| |
point_type | find_root (const point_type &x) |
find the root of a component.
| |
bool | criterion (const point_type &x, const point_type &y) |
Check if two components should be merged.
| |
void | uni (const point_type &n, const point_type &p) |
Do union of two components.
| |
bool | is_proc (const point_type &p) const |
Tells if a point has been proceded. | |
Static Protected Member Functions | |
const point_type & | ACTIVE () |
Return the value of an active point. | |
const point_type & | INACTIVE () |
Return the value of an inactive point. | |
Protected Attributes | |
const image_type & | input_ |
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_type * | lambda_ |
Threshold. | |
const env_type | env_ |
Environment. |
T | Exact type of images to process. |
ATTRIBUTE | Exact type of attribute to use. |
Env | Type of environment to use. |
Definition at line 56 of file attribute_union_find.hh.
|
tarjan_set constructor.
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_.
|
|
Main method to perform an attribute opening/closing.
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_ = λ 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 } |