OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
function_base.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  function base
23 
24  Author: Ansgar Philippsen
25 */
26 
27 #ifndef IMG_FUNCTION_BASE_H
28 #define IMG_FUNCTION_BASE_H
29 
30 #include "module_config.hh"
31 #include "data.hh"
32 #include "data_observer.hh"
33 #include "observable.hh"
34 #include "pixel_sampling.hh"
35 
36 namespace ost { namespace img {
37 
38 // forward declaration
39 class NonModAlgorithm;
40 class ImageHandle;
41 
43 
54 /*
55  Observer implementation will result in empty observer list
56  upon copy construction or assignement.
57 */
58 
61 
62  public:
67  virtual ~Function();
69 
73 
75  virtual DataType GetType() const = 0;
76 
78  virtual DataDomain GetDomain() const;
79 
81 
85  virtual Extent GetExtent() const;
87  void SetExtent(const Extent& e);
88 
90  virtual void SetSpatialOrigin(const Point& o);
92  virtual Point GetSpatialOrigin() const;
93 
95 
102 
104  virtual Real GetReal(const Point& p) const;
105 
107  virtual Complex GetComplex(const Point& p) const;
108 
110  virtual Real GetIntpolReal(const Vec3 &v) const=0;
111  virtual Real GetIntpolReal(const Vec2 &v) const;
112  virtual Real GetIntpolReal(const Real &d) const;
113 
115  virtual Complex GetIntpolComplex(const Vec3 &v) const=0;
116  virtual Complex GetIntpolComplex(const Vec2 &v) const;
117  virtual Complex GetIntpolComplex(const Real &d) const;
118 
120 
121 
126  // use doc from Data
127  virtual void Apply(NonModAlgorithm& a) const;
128  virtual void ApplyIP(NonModAlgorithm& a) const;
130 
133  // use doc from Data
135  virtual void Attach(DataObserver *o) const;
136  virtual void Detach(DataObserver *o) const;
137  virtual void Notify() const;
139 
140 
141  protected:
143  Function(DataDomain d, const Extent& e=Extent());
144 
145  Function(const Function& f);
146 
147  Function& operator=(const Function& f);
148 
152  virtual PixelSampling& Sampling();
153  virtual const PixelSampling& Sampling() const;
155 
156 private:
157  Extent extent_;
158  DataDomain domain_;
159 
160  /*
161  implement logical constness for Attach and Detach
162  */
163  mutable DataObservable obs_;
164 
165  PixelSampling sampling_;
166 };
167 
168 }} // namespace
169 
170 #endif