OpenStructure
Loading...
Searching...
No Matches
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
35namespace ost { namespace img {
36
38
45{
46public:
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
87protected:
89 return sampling_;
90 }
91 virtual const PixelSampling& Sampling() const {
92 return sampling_;
93 }
94
95private:
96 PixelSampling sampling_;
97};
98
99}} // namespace
100
101#endif
Abstract base class for data.
Definition data.hh:253
Abstract base class of data observer.
Defines lower and upper valid indices.
Definition extent.hh:60
Manage shared instances of images.
Non-modifying Algorithm, abstract base class.
null data singleton
Definition null_data.hh:45
virtual const PixelSampling & Sampling() const
Definition null_data.hh:91
virtual void Notify() const
Notify each observer that state has changed.
Definition null_data.hh:76
virtual void Detach(DataObserver *o) const
DataObserver interface: detach observer.
Definition null_data.hh:74
virtual Complex GetComplex(const Point &p) const
Get explicit complex value.
Definition null_data.hh:55
virtual Complex GetIntpolComplex(const Real &d) const
Definition null_data.hh:63
virtual void ApplyIP(NonModAlgorithm &a) const
Definition null_data.hh:66
virtual void SetSpatialOrigin(const Point &o)
Set the spatial origin.
Definition null_data.hh:68
virtual DataType GetType() const
Return type of data: REAL or COMPLEX.
Definition null_data.hh:47
virtual Point GetSpatialOrigin() const
Retrieve spatial origin.
Definition null_data.hh:70
virtual Real GetReal(const Point &p) const
Get explicit real value.
Definition null_data.hh:53
virtual Complex GetIntpolComplex(const Vec2 &v) const
Definition null_data.hh:62
virtual Extent GetExtent() const
Return (logical) extent of data.
Definition null_data.hh:51
static Data & Instance()
Definition null_data.hh:82
virtual void Apply(NonModAlgorithm &a) const
Algorithm interface: NonModAlgorithm.
Definition null_data.hh:65
virtual DataDomain GetDomain() const
Return domain: SPATIAL, FREQUENCY or HALF_FREQUENCY.
Definition null_data.hh:49
virtual Complex GetIntpolComplex(const Vec3 &v) const
Get interpolated complex value from 3D,2D or 1D vec.
Definition null_data.hh:61
virtual ImageHandle Crop(const Extent &e) const
Definition null_data.hh:78
virtual void Attach(DataObserver *o) const
DataObserver interface: attach observer.
Definition null_data.hh:72
virtual Real GetIntpolReal(const Real &d) const
Definition null_data.hh:59
virtual Real GetIntpolReal(const Vec3 &v) const
Get interpolated real value from 3D,2D or 1D vec.
Definition null_data.hh:57
virtual PixelSampling & Sampling()
Definition null_data.hh:88
virtual Real GetIntpolReal(const Vec2 &v) const
Definition null_data.hh:58
Helper class to handle pixel sampling.
class encapsulating 1D to 3D point
Definition point.hh:47
#define DLLEXPORT_OST_IMG_BASE
float Real
Definition base.hh:44
std::complex< Real > Complex
Definition base.hh:51
DataDomain
underlying data type
Definition data_types.hh:42
ImageHandle DLLEXPORT_OST_IMG_BASE CreateImage(const Extent &ext=Extent(), DataType type=REAL, DataDomain dom=SPATIAL)
Create image from scratch.
Definition base.dox:1