OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
null_data.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-2020 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  convenience null data class
23 
24  Author: Ansgar Philippsen
25 */
26 
27 #ifndef IMG_NULL_DATA_H
28 #define IMG_NULL_DATA_H
29 
30 #include "data.hh"
31 #include "pixel_sampling.hh"
32 #include "image_factory.hh"
33 #include "image_handle.hh"
34 
35 namespace ost { namespace img {
36 
38 
45 {
46 public:
47  virtual DataType GetType() const {return REAL;}
48 
49  virtual DataDomain GetDomain() const {return SPATIAL;}
50 
51  virtual Extent GetExtent() const {return Extent();}
52 
53  virtual Real GetReal(const Point &p) const {return 0.0;}
54 
55  virtual Complex GetComplex(const Point &p) const {return 0.0;}
56 
57  virtual Real GetIntpolReal(const Vec3 &v) const {return 0.0;}
58  virtual Real GetIntpolReal(const Vec2 &v) const {return 0.0;}
59  virtual Real GetIntpolReal(const Real &d) const {return 0.0;}
60 
61  virtual Complex GetIntpolComplex(const Vec3 &v) const {return 0.0;}
62  virtual Complex GetIntpolComplex(const Vec2 &v) const {return 0.0;}
63  virtual Complex GetIntpolComplex(const Real &d) const {return 0.0;}
64 
65  virtual void Apply(NonModAlgorithm& a) const {}
66  virtual void ApplyIP(NonModAlgorithm& a) const {}
67 
68  virtual void SetSpatialOrigin(const Point& o) {}
69 
70  virtual Point GetSpatialOrigin() const {return Point();}
71 
72  virtual void Attach(DataObserver *o) const {}
73 
74  virtual void Detach(DataObserver *o) const {}
75 
76  virtual void Notify() const {}
77 
78  virtual ImageHandle Crop(const Extent& e) const {
79  return CreateImage();
80  }
81 
82  static Data& Instance() {
83  static NullData instance;
84  return instance;
85  }
86 
87 protected:
88  virtual PixelSampling& Sampling() {
89  return sampling_;
90  }
91  virtual const PixelSampling& Sampling() const {
92  return sampling_;
93  }
94 
95 private:
96  PixelSampling sampling_;
97 };
98 
99 }} // namespace
100 
101 #endif
virtual Complex GetIntpolComplex(const Vec2 &v) const
Definition: null_data.hh:62
virtual Complex GetIntpolComplex(const Real &d) const
Definition: null_data.hh:63
static Data & Instance()
Definition: null_data.hh:82
Non-modifying Algorithm, abstract base class.
ImageHandle DLLEXPORT_OST_IMG_BASE CreateImage(const Extent &ext=Extent(), DataType type=REAL, DataDomain dom=SPATIAL)
Create image from scratch.
virtual Real GetIntpolReal(const Real &d) const
Definition: null_data.hh:59
DataDomain
underlying data type
Definition: data_types.hh:42
float Real
Definition: base.hh:44
std::complex< Real > Complex
Definition: base.hh:51
virtual Real GetIntpolReal(const Vec2 &v) const
Definition: null_data.hh:58
virtual Point GetSpatialOrigin() const
Retrieve spatial origin.
Definition: null_data.hh:70
virtual void SetSpatialOrigin(const Point &o)
Set the spatial origin.
Definition: null_data.hh:68
virtual void Apply(NonModAlgorithm &a) const
Algorithm interface: NonModAlgorithm.
Definition: null_data.hh:65
virtual Real GetIntpolReal(const Vec3 &v) const
Get interpolated real value from 3D,2D or 1D vec.
Definition: null_data.hh:57
virtual Complex GetComplex(const Point &p) const
Get explicit complex value.
Definition: null_data.hh:55
virtual Complex GetIntpolComplex(const Vec3 &v) const
Get interpolated complex value from 3D,2D or 1D vec.
Definition: null_data.hh:61
Abstract base class for data.
Definition: data.hh:253
virtual DataType GetType() const
Return type of data: REAL or COMPLEX.
Definition: null_data.hh:47
virtual void ApplyIP(NonModAlgorithm &a) const
Definition: null_data.hh:66
virtual void Detach(DataObserver *o) const
DataObserver interface: detach observer.
Definition: null_data.hh:74
Helper class to handle pixel sampling.
virtual ImageHandle Crop(const Extent &e) const
Definition: null_data.hh:78
virtual PixelSampling & Sampling()
Definition: null_data.hh:88
Defines lower and upper valid indices.
Definition: extent.hh:60
virtual const PixelSampling & Sampling() const
Definition: null_data.hh:91
virtual DataDomain GetDomain() const
Return domain: SPATIAL, FREQUENCY or HALF_FREQUENCY.
Definition: null_data.hh:49
Abstract base class of data observer.
virtual void Notify() const
Notify each observer that state has changed.
Definition: null_data.hh:76
virtual Extent GetExtent() const
Return (logical) extent of data.
Definition: null_data.hh:51
virtual void Attach(DataObserver *o) const
DataObserver interface: attach observer.
Definition: null_data.hh:72
Manage shared instances of images.
null data singleton
Definition: null_data.hh:44
virtual Real GetReal(const Point &p) const
Get explicit real value.
Definition: null_data.hh:53
class encapsulating 1D to 3D point
Definition: point.hh:43
#define DLLEXPORT_OST_IMG_BASE