$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
influence_zone_graph.hh
1 // Copyright (C) 2009, 2013 EPITA Research and Development Laboratory
2 // (LRDE)
3 //
4 // This file is part of Olena.
5 //
6 // Olena is free software: you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation, version 2 of the License.
9 //
10 // Olena is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // As a special exception, you may use this file as part of a free
19 // software project without restriction. Specifically, if other files
20 // instantiate templates or use macros or inline functions from this
21 // file, or you compile this file and link it with other files to produce
22 // an executable, this file does not by itself cause the resulting
23 // executable to be covered by the GNU General Public License. This
24 // exception does not however invalidate any other reasons why the
25 // executable file might be covered by the GNU General Public License.
26 
27 #ifndef SCRIBO_MAKE_INFLUENCE_ZONE_GRAPH_HH
28 # define SCRIBO_MAKE_INFLUENCE_ZONE_GRAPH_HH
29 
34 
35 
36 # include <mln/core/concept/image.hh>
37 # include <mln/core/concept/neighborhood.hh>
38 
39 # include <mln/labeling/blobs.hh>
40 
41 # include <mln/transform/influence_zone_geodesic.hh>
42 
43 # include <mln/util/graph.hh>
44 
45 # include <mln/make/influence_zone_adjacency_graph.hh>
46 
47 # include <mln/pw/all.hh>
48 
49 namespace scribo
50 {
51 
52  namespace make
53  {
54  using namespace mln;
55 
56 
67  template <typename I, typename N, typename V>
69  influence_zone_graph(const Image<I>& input_,
70  const Neighborhood<N>& nbh_,
71  const V& label_type,
72  unsigned iz_dmax);
73 
74 
75 # ifndef MLN_INCLUDE_ONLY
76 
77  template <typename I, typename N, typename V>
79  influence_zone_graph(const Image<I>& input_,
80  const Neighborhood<N>& nbh_,
81  const V& label_type,
82  unsigned iz_dmax)
83  {
84  mln_trace("scribo::make::influence_zone_graph");
85 
86  (void) label_type;
87  I& input = exact(input_);
88  const N& nbh = exact(nbh_);
89 
90  mlc_equal(mln_value(I), bool)::check();
91  mln_assertion(input.is_valid());
92  mln_assertion(nbh.is_valid());
93 
94  V nlabels;
95  typedef mln_ch_value(I,V) lbl_t;
96  lbl_t lbl = labeling::blobs(input, nbh, nlabels);
97 
98  lbl_t iz = transform::influence_zone_geodesic(lbl, nbh, iz_dmax);
99 
100  mln::util::graph g
101  = mln::make::influence_zone_adjacency_graph(
102  iz | (pw::value(iz) != pw::cst(literal::zero)),
103  nbh, nlabels);
104 
105  return g;
106  }
107 
108 # endif // ! MLN_INCLUDE_ONLY
109 
110  } // end of namespace scribo::make
111 
112 } // end of namespace scribo
113 
114 
115 
116 #endif // ! SCRIBO_MAKE_INFLUENCE_ZONE_GRAPH_HH