$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
pw/image.hh
1 // Copyright (C) 2007, 2008, 2009, 2012 EPITA Research and Development
2 // Laboratory (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 MLN_PW_IMAGE_HH
28 # define MLN_PW_IMAGE_HH
29 
33 
34 # include <mln/pw/internal/image_base.hh>
35 # include <mln/core/concept/function.hh>
36 # include <mln/value/set.hh>
37 
38 
39 namespace mln
40 {
41 
42  // Forward declaration.
43  namespace pw { template <typename F, typename S> class image; }
44 
45 
46  // Properties
47 
48  namespace trait
49  {
50 
51  template <typename F, typename S>
52  struct image_< pw::image<F,S> >
53  : pw_image_<F,S, pw::image<F,S> >
54  {
55  };
56 
57  } // end of namespace mln::traits.
58 
59 
60  namespace internal
61  {
62 
67  template <typename F, typename S>
68  struct data< mln::pw::image<F,S> >
69  {
70  data(const F& f, const S& ps);
71  F f_;
72  S domain_;
73  };
74 
75  } // end of namespace mln::internal
76 
77 
80  template <typename F, typename S>
81  pw::image<F,S>
82  operator | (const Function_v2v<F>& f, const Site_Set<S>& ps);
83 
84 
85  namespace pw
86  {
87 
94  //
95  template <typename F, typename S>
96  class image :
97  public pw::internal::image_base< F, S, image<F,S> >
98  {
100 
101  public:
103  typedef image< tag::function_<F>, tag::domain_<S> > skeleton;
104 
106  image();
107 
109  image(const Function_v2v<F>& f, const Site_Set<S>& ps);
110 
111  };
112 
113  } // end of namespace mln::pw
114 
115 
117 
118  template <typename F, typename S, typename E, typename J>
119  void init_(tag::image_t, pw::image<F,S>& target, const Image<J>& model);
120 
121 
122 # ifndef MLN_INCLUDE_ONLY
123 
125 
126  template <typename F, typename S, typename E, typename J>
127  void init_(tag::image_t, pw::image<F,S>& target, const Image<J>& model)
128  {
129  F f;
130  init_(tag::function, f, exact(model));
131  S s;
132  init_(tag::domain, s, exact(model));
133  target.init_(f, s);
134  }
135 
136 
137  // Operator.
138 
139  template <typename F, typename S>
140  inline
141  pw::image<F,S>
142  operator | (const Function_v2v<F>& f, const Site_Set<S>& ps)
143  {
144  pw::image<F,S> tmp(f, ps);
145  return tmp;
146  }
147 
148 
149  // data< pw::image >
150 
151  namespace internal
152  {
153 
154  template <typename F, typename S>
155  inline
156  data< mln::pw::image<F,S> >::data(const F& f, const S& ps)
157  : f_(f),
158  domain_(ps)
159  {
160  }
161 
162  } // end of namespace mln::internal
163 
164 
165 
166  // pw::image<F,S>
167 
168  namespace pw
169  {
170 
171  template <typename F, typename S>
172  inline
174  {
175  }
176 
177  template <typename F, typename S>
178  inline
179  image<F,S>::image(const Function_v2v<F>& f, const Site_Set<S>& ps)
180  {
181  this->data_ = new mln::internal::data< image<F,S> >(exact(f), exact(ps));
182  }
183 
184 
185  } // end of namespace mln::pw
186 
187 # endif // ! MLN_INCLUDE_ONLY
188 
189 } // end of namespace mln
190 
191 
192 #endif // ! MLN_PW_IMAGE_HH