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
image_state
image_state_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
image state base
23
24
Author: Ansgar Philippsen
25
*/
26
27
#ifndef IMAGE_STATE_BASE_H
28
#define IMAGE_STATE_BASE_H
29
30
#include "
image_state_base_fw.hh
"
31
32
#include <
ost/base.hh
>
33
#include <
ost/img/function.hh
>
34
35
#include "
image_state_visitor_fw.hh
"
36
#include "
type_fw.hh
"
37
38
namespace
ost {
namespace
img {
39
40
class
PixelSampling;
41
42
namespace
image_state {
43
44
/*
45
Abstract base class for the image state. A polymorphic pointer
46
to this is managed by instantiations of the Image class.
47
48
At this level, the SpatialOrigin and SpatialSampling are
49
stored, but the interpretation is left to the 'user' of
50
the image state, either the Image class or any ImageStateVisitor
51
*/
52
class
DLLEXPORT_OST_IMG_BASE
ImageStateBase
{
53
public
:
54
55
virtual
~ImageStateBase
() {}
56
57
// provide deep copy
58
virtual
ImageStateBasePtr
Clone(
bool
cc=
true
)
const
= 0;
59
60
virtual
long
MemSize()
const
= 0;
61
63
// abstract virtual methods
64
// to be implemented in ImageState
65
66
// Reset extent, only re-allocating memory
67
/*
68
still needed ? its probably better to offer this
69
on the lower level of ImageStateImpl
70
*/
71
//virtual void ResetExtent(const Extent& e) = 0;
72
74
virtual
DataType
GetType()
const
= 0;
75
77
virtual
DataDomain
GetDomain()
const
= 0;
78
80
virtual
void
SetSpatialOrigin(
const
Point
& o) = 0;
81
83
virtual
Point
GetSpatialOrigin()
const
= 0;
84
85
87
92
virtual
Extent
GetExtent()
const
= 0;
93
95
99
virtual
Extent
GetLogicalExtent()
const
= 0;
100
102
105
virtual
Real
GetReal(
const
Point
&p)
const
= 0;
106
108
111
virtual
void
SetReal(
const
Point
&p,
const
Real
& r) = 0;
112
113
// retrive value at Point as Complex
114
/*
115
This call is potentially slow, but boundary checked
116
*/
117
virtual
Complex
GetComplex(
const
Point
&p)
const
= 0;
118
120
123
virtual
void
SetComplex(
const
Point
&p,
const
Complex
& c) = 0;
124
125
virtual
Real
GetIntpolReal(
const
Vec3 &v)
const
= 0;
126
virtual
Real
GetIntpolReal(
const
Vec2 &v)
const
= 0;
127
virtual
Real
GetIntpolReal(
const
Real
&d)
const
= 0;
128
129
virtual
Complex
GetIntpolComplex(
const
Vec3 &v)
const
= 0;
130
virtual
Complex
GetIntpolComplex(
const
Vec2 &v)
const
= 0;
131
virtual
Complex
GetIntpolComplex(
const
Real
&d)
const
= 0;
132
133
virtual
PixelSampling
& GetSampling() = 0;
134
135
virtual
const
PixelSampling
& GetSampling()
const
= 0;
136
137
virtual
void
SetSampling(
const
PixelSampling
& s) = 0;
138
139
virtual
Vec3 GetAbsoluteOrigin()
const
= 0;
140
141
virtual
void
SetAbsoluteOrigin(
const
Vec3& c) = 0;
142
143
// Index to coordinate conversion
144
/*
145
Returns the physical dimensions of a given Point based on
146
the sampling of the current domain and the absolute coordinates
147
of the origin of the image
148
*/
149
virtual
Vec3 IndexToCoord(
const
Point
&p)
const
= 0;
150
151
// Convert coordinates back to (fractional) indices
152
/*
153
Returns the location within the Data that corresponds to
154
the given physical coordinate, bases on the sampling of
155
the current domain and the absolute coordinates
156
of the origin of the image
157
*/
158
virtual
Vec3 CoordToIndex(
const
Vec3& c)
const
= 0;
159
160
/*
161
Returns the physical dimensions of a given Vec which contains
162
fractional Point coordinated. The returned value is based on
163
the sampling of the current domain and the absolute coordinates
164
of the origin of the image
165
*/
166
virtual
Vec3 FractionalIndexToCoord(
const
Vec3 &p)
const
=0;
167
168
// visitor interface
169
170
// apply const visitor, ie to extract info
171
virtual
void
ApplyIP(
ImageStateNonModVisitorBase
& v)
const
= 0;
172
// apply const visitor (same as ApplyIP(ImageStateNonModVisitorBase&)
173
virtual
void
Apply(
ImageStateNonModVisitorBase
& v)
const
= 0;
174
175
// apply in-place visitor, usually modifies this
176
virtual
void
ApplyIP(
ImageStateModIPVisitorBase
& v) = 0;
177
// apply in-place visitor to clone of this, return result
178
virtual
ImageStateBasePtr
Apply(
ImageStateModIPVisitorBase
& v)
const
= 0;
179
180
// apply in-place const visitor, usually modifies this
181
virtual
void
ApplyIP(
const
ImageStateConstModIPVisitorBase
& v) = 0;
182
// apply in-place const visitor to clone of this, return result
183
virtual
ImageStateBasePtr
Apply(
const
ImageStateConstModIPVisitorBase
& v)
const
= 0;
184
185
// apply out-of-place visitor and return result
186
// NOTE: it is not possible to apply an out-of-place visitor in-place!
187
// that is handled by the calling API (ie ImageHandle)
188
virtual
ImageStateBasePtr
Apply(
ImageStateModOPVisitorBase
& v)
const
= 0;
189
190
// apply out-of-place const visitor and return result
191
virtual
ImageStateBasePtr
Apply(
const
ImageStateConstModOPVisitorBase
& v)
const
= 0;
192
193
// apply morph visitor, with the expectation that returning state has modified this
194
virtual
ImageStateBasePtr
Apply(
ImageStateMorphVisitorBase
& v) = 0;
195
196
// operators
197
virtual
ImageStateBase
& operator+=(
Real
v) = 0;
198
virtual
ImageStateBase
& operator+=(
const
Complex
& v) = 0;
199
virtual
ImageStateBase
& operator-=(
Real
v) = 0;
200
virtual
ImageStateBase
& operator-=(
const
Complex
& v) = 0;
201
virtual
ImageStateBase
& operator*=(
Real
v) = 0;
202
virtual
ImageStateBase
& operator*=(
const
Complex
& v) = 0;
203
virtual
ImageStateBase
& operator/=(
Real
v) = 0;
204
virtual
ImageStateBase
& operator/=(
const
Complex
& v) = 0;
205
206
ImageStateBase
& operator+=(
const
ImageStateBase
& b);
207
ImageStateBase
& operator-=(
const
ImageStateBase
& b);
208
ImageStateBase
& operator*=(
const
ImageStateBase
& b);
209
ImageStateBase
& operator/=(
const
ImageStateBase
& b);
210
211
virtual
void
operator+=(
const
Function
& b) = 0;
212
virtual
void
operator-=(
const
Function
& b) = 0;
213
virtual
void
operator*=(
const
Function
& b) = 0;
214
virtual
void
operator/=(
const
Function
& b) = 0;
215
216
protected
:
217
ImageStateBase
() {}
218
ImageStateBase
(
const
ImageStateBase
& s) {}
219
220
private
:
221
// assignement is forbidden
222
ImageStateBase
& operator=(
const
ImageStateBase
& s);
223
};
224
225
}}}
// namespaces
226
227
#endif
Generated on Mon Nov 11 2013 09:56:12 for OpenStructure by
1.8.1.1