oln::topo::tarjan::flat_zone< T, DestType, A, Exact > Struct Template Reference

#include <flat-zone.hh>

Inheritance diagram for oln::topo::tarjan::flat_zone< T, DestType, A, Exact >:

Inheritance graph
[legend]
Collaboration diagram for oln::topo::tarjan::flat_zone< T, DestType, A, Exact >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef mlc::exact< T >::ret::point_type point_type
 Type of input image.

typedef mlc::exact< T >::ret::value_type data_type
 Data type of the input image.

typedef oln::mute< T >::ret image_type
 Concrete type of the input image.

typedef DestType comp_type
 Type of components.

typedef flat_zone< T, DestType,
A, Exact > 
self_type
 Self type of the class.

typedef mlc::exact_vt< self_type,
Exact >::ret 
exact_type
 Exact type of the class.

typedef abstract::tarjan_with_attr<
exact_type
super_type
 Type of parent class.


Public Member Functions

 flat_zone (const image_type &ima, const typename oln::morpho::attr::attr_traits< A >::env_type &env=typename oln::morpho::attr::attr_traits< A >::env_type())
 Constructor.

std::vector< point_typeget_processing_order_impl ()

Protected Member Functions

void mark_set_impl (const point_type &x)
 Implementation of mark_set().

void uni_impl (const point_type &n, const point_type &p)
 Implementation of uni().


Friends

class abstract::tarjan< exact_type >

Detailed Description

template<class T, class DestType = unsigned, class A = oln::morpho::attr::card_type<>, class Exact = mlc::final>
struct oln::topo::tarjan::flat_zone< T, DestType, A, Exact >

Create an image of label of the flat zones.

Parameters:
T Type of he input image.
DestType Data type of the output image (label type).
A Attribute you want to compute.
Exact Exact type of the class.
#include <oln/basics2d.hh> #include <oln/topo/tarjan/flat-zone.hh> #include <oln/convert/stretch.hh> int main() { typedef oln::image2d<ntg::int_u8> img_type; img_type in = oln::load(IMG_IN "test-cmap.pgm"); oln::topo::tarjan::flat_zone<img_type> z(in); save(oln::convert::stretch_balance<ntg::int_u8>(z.get_compute(oln::neighb_c4()), 0, 255), IMG_OUT "oln_topo_flat_zone.pgm"); }
test-cmap_pgm.png

input image

=>
oln_topo_flat_zone.png

output image

Definition at line 75 of file flat-zone.hh.


Constructor & Destructor Documentation

template<class T, class DestType = unsigned, class A = oln::morpho::attr::card_type<>, class Exact = mlc::final>
oln::topo::tarjan::flat_zone< T, DestType, A, Exact >::flat_zone const image_type ima,
const typename oln::morpho::attr::attr_traits< A >::env_type env = typename oln::morpho::attr::attr_traits< A >::env_type()
[inline]
 

Constructor.

  • ima Input image.
  • env Environment to use to compute the attributes.

Definition at line 98 of file flat-zone.hh.

00099                                                             : super_type(ima, env)
00100         {
00101         }


Member Function Documentation

template<class T, class DestType = unsigned, class A = oln::morpho::attr::card_type<>, class Exact = mlc::final>
void oln::topo::tarjan::flat_zone< T, DestType, A, Exact >::mark_set_impl const point_type x  )  [inline, protected]
 

Implementation of mark_set().

  • x Root of the new component.
Warning:
Do not call this method, use mark_set() instead.

Definition at line 125 of file flat-zone.hh.

00126         {
00127           if (parent_.size() == parent_.capacity())
00128             {
00129               capacity = parent_.capacity() + capacity_chunk;
00130               parent_.reserve(capacity);
00131               comp_value_.reserve(capacity);
00132             }
00133           to_comp_[x] = ncomps_ + 1;
00134           data_.push_back(A(input_, x, env_));
00135           parent_.push_back(ncomps_ + 1);
00136           comp_value_.push_back(ncomps_ + 1);
00137         }

template<class T, class DestType = unsigned, class A = oln::morpho::attr::card_type<>, class Exact = mlc::final>
void oln::topo::tarjan::flat_zone< T, DestType, A, Exact >::uni_impl const point_type n,
const point_type p
[inline, protected]
 

Implementation of uni().

  • n A point of the first component.
  • p A point of the second component.
Warning:
Do not call this method, use uni() instead.

Definition at line 148 of file flat-zone.hh.

References oln::topo::tarjan::flat_zone< T, DestType, A, Exact >::comp_type, and oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::find_root().

00149         {
00150           comp_type             r = find_root(to_comp_[n]);
00151           precondition(to_comp_[n] <= ncomps_);
00152           precondition(to_comp_[p] <= (ncomps_ + 1));
00153           if (r != to_comp_[p])
00154             if (input_[n] == input_[p])
00155               {
00156                 if (to_comp_[p] == (ncomps_ + 1)) // first merge of p component
00157                   {
00158                     precondition(r < comp_value_.capacity());
00159                     data_[r] += data_[to_comp_[p]];
00160                     precondition(r <= ncomps_);
00161                     to_comp_[p] = r;
00162                   }
00163                 else
00164                   {
00165                     precondition(r < parent_.capacity());
00166                     data_[parent_[to_comp_[p]]] += data_[parent_[r]];
00167                     parent_[r] = parent_[to_comp_[p]];
00168 
00169                   }
00170               }
00171         }


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