#include <flat-zone.hh>
Inheritance diagram for oln::topo::tarjan::flat_zone< T, DestType, A, Exact >:
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_type > | get_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 > |
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"); }
input image
output image
Definition at line 75 of file flat-zone.hh.
|
Constructor.
Definition at line 98 of file flat-zone.hh.
00099 : super_type(ima, env) 00100 { 00101 } |
|
Implementation of mark_set().
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 }
|
|
Implementation of uni().
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 } |