oln::topo::tarjan::obsolete::flat_zone< I > Struct Template Reference

#include <flat-zone.hh>

Collaboration diagram for oln::topo::tarjan::obsolete::flat_zone< I >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef mlc::exact< I >::ret::point_type point_type
typedef mlc::exact< I >::ret::value_type data_type
typedef oln::mute< I >::ret image_type
typedef tarjan::tarjan_set<
image_type, tarjan::empty_class > 
tarjan_cc

Public Member Functions

 flat_zone (const image_type &input_)
void doit ()
 Compute the image of label.

const unsigned get_label (const point_type &p) const
 Get the label of a point p.

const point_type & get_root (unsigned l) const
 Get the root point of a label l.

const unsigned nlabels () const
 Number of label.

void merge (const int l1, const int l2)

Public Attributes

const image_type & input
tarjan_cc cc
image2d< unsigned > label
 output image.

std::vector< point_type > look_up_table
image2d< std::vector< oln::point2d > > ima_region
unsigned nlabels_

Detailed Description

template<class I>
struct oln::topo::tarjan::obsolete::flat_zone< I >

Create an image of label of the flat zones.

Todo:
FIXME: many assertions are missing.
#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::obsolete::flat_zone<img_type> z(in); save(oln::convert::stretch_balance<ntg::int_u8>(z.label, 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 219 of file flat-zone.hh.


Constructor & Destructor Documentation

template<class I>
oln::topo::tarjan::obsolete::flat_zone< I >::flat_zone const image_type &  input_  )  [inline]
 

Initialize the flat-zone with an image.

doit is called.

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

References oln::topo::tarjan::obsolete::flat_zone< I >::doit(), and oln::topo::tarjan::obsolete::flat_zone< I >::label.

00241                                               : input(input_), cc(input_),
00242                                                 label(input_.size()),
00243                                                 ima_region(input_.size()),
00244                                                 nlabels_(0)
00245           {
00246             doit();
00247           }


Member Function Documentation

template<class I>
void oln::topo::tarjan::obsolete::flat_zone< I >::merge const int  l1,
const int  l2
[inline]
 

Merge two flat zone.

Note:
FIMXE: should be protected, shouldn't it?

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

References oln::topo::tarjan::tarjan_set< I, aux_data_type >::is_root(), oln::topo::tarjan::obsolete::flat_zone< I >::label, and oln::topo::tarjan::tarjan_set< I, aux_data_type >::uni().

00362           {
00363             point_type root_l1 = look_up_table[l1];
00364             point_type root_l2 = look_up_table[l2];
00365             assertion(cc.is_root(root_l1));
00366             assertion(cc.is_root(root_l2));
00367             // merge
00368             cc.uni(root_l2, root_l1);
00369             // update our tables
00370             look_up_table[l2] = root_l1;
00371             for (typename std::vector<point_type>::iterator
00372                    i = ima_region[root_l2].begin();
00373                  i != ima_region[root_l2].end(); ++i)
00374               label[*i] = l1;
00375             ima_region[root_l1].insert(ima_region[root_l1].end(),
00376                                        ima_region[root_l1].begin(),
00377                                        ima_region[root_l1].end());
00378             ima_region[root_l2].clear();
00379 
00380             --nlabels_;
00381           }


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