$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
component_tree.hh
1 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2 //
3 // This file is part of Olena.
4 //
5 // Olena is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation, version 2 of the License.
8 //
9 // Olena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // As a special exception, you may use this file as part of a free
18 // software project without restriction. Specifically, if other files
19 // instantiate templates or use macros or inline functions from this
20 // file, or you compile this file and link it with other files to produce
21 // an executable, this file does not by itself cause the resulting
22 // executable to be covered by the GNU General Public License. This
23 // exception does not however invalidate any other reasons why the
24 // executable file might be covered by the GNU General Public License.
25 
26 
30 
31 
32 #ifndef MLN_MORPHO_TREE_COMPONENT_TREE_HH
33 # define MLN_MORPHO_TREE_COMPONENT_TREE_HH
34 
35 # include <mln/data/sort_psites.hh>
36 # include <mln/morpho/tree/data.hh>
37 
38 namespace mln
39 {
40 
41  namespace morpho
42  {
43 
44  namespace tree
45  {
46 
54  template <typename I, typename N>
55  inline
57  min_tree(const Image<I>& f, const Neighborhood<N>& nbh);
58 
66  template <typename I, typename N>
67  inline
69  max_tree(const Image<I>& f, const Neighborhood<N>& nbh);
70 
71 
72 # ifndef MLN_INCLUDE_ONLY
73 
74  template <typename I, typename N>
75  inline
77  min_tree(const Image<I>& f_, const Neighborhood<N>& nbh_)
78  {
79  mln_trace("morpho::tree::min_tree");
80 
81  const I& f = exact(f_);
82  const N& nbh = exact(nbh_);
83 
84  mln_precondition(f.is_valid());
85  mln_precondition(nbh.is_valid());
86 
87  typedef p_array<mln_psite(I)> S;
88  typedef data<I,S> tree_t;
89 
91  tree_t tree(f, s, nbh);
92 
93  return tree;
94  }
95 
96  template <typename I, typename N>
97  inline
99  max_tree(const Image<I>& f_, const Neighborhood<N>& nbh_)
100  {
101  mln_trace("morpho::tree::max_tree");
102 
103  const I& f = exact(f_);
104  const N& nbh = exact(nbh_);
105 
106  mln_precondition(f.is_valid());
107  mln_precondition(nbh.is_valid());
108 
109  typedef p_array<mln_psite(I)> S;
110  typedef data<I,S> tree_t;
111 
113  tree_t tree(f, s, nbh);
114 
115  return tree;
116  }
117 
118 # endif // ! MLN_INCLUDE_ONLY
119 
120  } // end of namespace mln::morpho::tree
121 
122  } // end of namespace mln::morpho
123 
124 } // end of namespace mln
125 
126 #endif // !MLN_MORPHO_TREE_COMPONENT_TREE_HH