Milena (Olena)  User documentation 2.0a Id
 All Classes Namespaces Functions Variables Typedefs Enumerator 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  trace::entering("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  trace::exiting("morpho::tree::min_tree");
94  return tree;
95  }
96 
97  template <typename I, typename N>
98  inline
100  max_tree(const Image<I>& f_, const Neighborhood<N>& nbh_)
101  {
102  trace::entering("morpho::tree::max_tree");
103 
104  const I& f = exact(f_);
105  const N& nbh = exact(nbh_);
106 
107  mln_precondition(f.is_valid());
108  mln_precondition(nbh.is_valid());
109 
110  typedef p_array<mln_psite(I)> S;
111  typedef data<I,S> tree_t;
112 
114  tree_t tree(f, s, nbh);
115 
116  trace::exiting("morpho::tree::max_tree");
117  return tree;
118  }
119 
120 # endif // ! MLN_INCLUDE_ONLY
121 
122  } // end of namespace mln::morpho::tree
123 
124  } // end of namespace mln::morpho
125 
126 } // end of namespace mln
127 
128 #endif // !MLN_MORPHO_TREE_COMPONENT_TREE_HH