#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.
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.
Definition at line 98 of file flat-zone.hh.
00099 : super_type(ima, env) 00100 { 00101 }
void oln::topo::tarjan::flat_zone< T, DestType, A, Exact >::mark_set_impl | ( | const point_type & | x | ) | [inline, protected] |
Implementation of mark_set().
Definition at line 125 of file flat-zone.hh.
References oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::capacity_chunk, oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::comp_value_, oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::data_, oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::ncomps_, oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::parent_, and oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::to_comp_.
00126 { 00127 if (this->parent_.size() == this->parent_.capacity()) 00128 { 00129 this->capacity = this->parent_.capacity() + this->capacity_chunk; 00130 this->parent_.reserve(this->capacity); 00131 this->comp_value_.reserve(this->capacity); 00132 } 00133 this->to_comp_[x] = this->ncomps_ + 1; 00134 this->data_.push_back(A(this->input_, x, this->env_)); 00135 this->parent_.push_back(this->ncomps_ + 1); 00136 this->comp_value_.push_back(this->ncomps_ + 1); 00137 }
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().
Definition at line 148 of file flat-zone.hh.
References oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::comp_value_, oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::data_, oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::find_root(), oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::ncomps_, oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::parent_, and oln::topo::tarjan::abstract::tarjan_with_attr< Exact >::to_comp_.
00149 { 00150 comp_type r = find_root(this->to_comp_[n]); 00151 precondition(this->to_comp_[n] <= this->ncomps_); 00152 precondition(this->to_comp_[p] <= (this->ncomps_ + 1)); 00153 if (r != this->to_comp_[p]) 00154 if (this->input_[n] == this->input_[p]) 00155 { 00156 if (this->to_comp_[p] == (this->ncomps_ + 1)) // first merge of p component 00157 { 00158 precondition(r < this->comp_value_.capacity()); 00159 this->data_[r] += this->data_[this->to_comp_[p]]; 00160 precondition(r <= this->ncomps_); 00161 this->to_comp_[p] = r; 00162 } 00163 else 00164 { 00165 precondition(r < this->parent_.capacity()); 00166 this->data_[this->parent_[this->to_comp_[p]]] += this->data_[this->parent_[r]]; 00167 this->parent_[r] = this->parent_[this->to_comp_[p]]; 00168 00169 } 00170 } 00171 }