OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
stage
include
ost
img
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-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
abstract base class for generic data
23
24
Author: Ansgar Philippsen
25
*/
26
27
#ifndef IMG_DATA_H
28
#define IMG_DATA_H
29
30
#include <cmath>
31
32
#include <boost/shared_ptr.hpp>
33
34
#include <
ost/img/module_config.hh
>
35
#include <
ost/base.hh
>
36
#include "
point.hh
"
37
#include "
extent.hh
"
38
#include "
data_types.hh
"
39
#include "
extent_iterator.hh
"
40
#include "
vecmat.hh
"
41
42
43
namespace
ost {
namespace
img {
44
45
46
//using namespace info;
47
48
// forward declaration
49
class
NonModAlgorithm;
50
class
ModIPAlgorithm;
51
class
DataObserver;
52
class
PixelSampling;
53
class
ImageHandle;
54
56
70
class
DLLEXPORT_OST_IMG_BASE
ConstData
{
71
public
:
75
ConstData
();
76
virtual
~
ConstData
();
78
82
83
virtual
DataType
GetType()
const
= 0;
84
86
virtual
DataDomain
GetDomain()
const
= 0;
87
89
92
bool
IsSpatial
()
const
{
return
GetDomain()==
SPATIAL
;}
93
95
98
bool
IsFrequency
()
const
{
99
return
GetDomain()==
FREQUENCY
|| GetDomain()==
HALF_FREQUENCY
;
100
}
101
103
106
bool
IsReal
()
const
{
return
GetType()==
REAL
;}
107
109
112
bool
IsComplex
()
const
{
return
GetType()==
COMPLEX
;}
113
115
virtual
Extent
GetExtent()
const
= 0;
116
118
virtual
Point
GetSpatialOrigin()
const
= 0;
119
121
124
Size
GetSize
()
const
{
return
GetExtent().GetSize();}
125
127
133
134
virtual
Real
GetReal(
const
Point
&p)
const
= 0;
135
137
virtual
Complex
GetComplex(
const
Point
&p)
const
= 0;
138
140
virtual
Real
GetIntpolReal(
const
Vec3 &v)
const
= 0;
141
virtual
Real
GetIntpolReal(
const
Vec2 &v)
const
= 0;
142
virtual
Real
GetIntpolReal(
const
Real
&d)
const
= 0;
143
145
virtual
Complex
GetIntpolComplex(
const
Vec3 &v)
const
= 0;
146
virtual
Complex
GetIntpolComplex(
const
Vec2 &v)
const
= 0;
147
virtual
Complex
GetIntpolComplex(
const
Real
&d)
const
= 0;
148
149
154
155
/*
156
Only a NonModAlgorithm can be applied to a Data instance,
157
the Mod IP/OP variants are part of the ImageHandle interface
158
*/
159
virtual
void
Apply(
NonModAlgorithm
& a)
const
= 0;
160
virtual
void
ApplyIP(
NonModAlgorithm
& a)
const
=0;
162
163
167
168
virtual
void
Attach(
DataObserver
*o)
const
= 0;
169
171
virtual
void
Detach(
DataObserver
*o)
const
= 0;
172
174
virtual
void
Notify()
const
= 0;
176
181
virtual
Real
OverallDifference(
const
ConstData
& d)
const
;
182
virtual
Real
NormDifference(
const
ConstData
& d)
const
;
184
185
195
197
Vec3 GetPixelSampling()
const
;
198
200
Vec3 GetSpatialSampling()
const
;
201
203
Vec3 GetFrequencySampling()
const
;
204
205
// Index to coordinate conversion
206
/*
207
Returns the physical dimensions of a given Point based on
208
the sampling of the current domain.
209
*/
210
//Vec3 IndexToCoord(const Point &p) const;
211
212
// Convert coordinates back to (fractional) indices
213
/*
214
Returns the location within the Data that corresponds to
215
the given physical coordinate.
216
*/
217
//Vec3 CoordToIndex(const Vec3& c) const;
219
220
221
222
protected
:
223
ConstData
(
const
ConstData
& d);
224
ConstData
& operator=(
const
ConstData
& d);
225
231
virtual
PixelSampling
& Sampling() = 0;
232
virtual
const
PixelSampling
& Sampling()
const
= 0;
234
236
void
CalcIntpolWeights(Vec3 v,
Real
w[8],
Point
p[8])
const
;
237
238
private
:
239
240
};
241
242
244
253
class
DLLEXPORT_OST_IMG_BASE
Data
:
public
ConstData
{
254
public
:
258
Data
();
259
virtual
~
Data
();
261
262
266
267
virtual
void
SetSpatialOrigin(
const
Point
& o) = 0;
269
273
274
void
SetPixelSampling(
const
Vec3&);
276
void
SetPixelSampling
(
Real
d) {
SetPixelSampling
(Vec3(d,d,d));}
278
void
SetSpatialSampling(
const
Vec3&);
280
void
SetSpatialSampling
(
Real
d) {
SetSpatialSampling
(Vec3(d,d,d));}
281
282
virtual
void
Apply(
NonModAlgorithm
& a)
const
=0;
283
virtual
void
ApplyIP(
NonModAlgorithm
& a)
const
=0;
284
285
protected
:
286
Data
(
const
Data
& d);
287
Data
& operator=(
const
Data
& d);
288
};
289
290
291
292
}}
// namespace img
293
294
#endif
Generated on Mon Nov 11 2013 09:56:12 for OpenStructure by
1.8.1.1