00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef IMG_DATA_H
00028 #define IMG_DATA_H
00029
00030 #include <cmath>
00031
00032 #include <boost/shared_ptr.hpp>
00033
00034 #include <ost/img/module_config.hh>
00035 #include <ost/base.hh>
00036 #include "point.hh"
00037 #include "extent.hh"
00038 #include "data_types.hh"
00039 #include "extent_iterator.hh"
00040 #include "vecmat.hh"
00041
00042
00043 namespace ost { namespace img {
00044
00045
00046
00047
00048
00049 class NonModAlgorithm;
00050 class ModIPAlgorithm;
00051 class DataObserver;
00052 class PixelSampling;
00053 class ImageHandle;
00054
00056
00070 class DLLEXPORT_OST_IMG_BASE ConstData {
00071 public:
00075 ConstData();
00076 virtual ~ConstData();
00078
00082
00083 virtual DataType GetType() const = 0;
00084
00086 virtual DataDomain GetDomain() const = 0;
00087
00089
00092 bool IsSpatial() const {return GetDomain()==SPATIAL;}
00093
00095
00098 bool IsFrequency() const {
00099 return GetDomain()==FREQUENCY || GetDomain()==HALF_FREQUENCY;
00100 }
00101
00103
00106 bool IsReal() const {return GetType()==REAL;}
00107
00109
00112 bool IsComplex() const {return GetType()==COMPLEX;}
00113
00115 virtual Extent GetExtent() const = 0;
00116
00118 virtual Point GetSpatialOrigin() const = 0;
00119
00121
00124 Size GetSize() const {return GetExtent().GetSize();}
00125
00127
00133
00134 virtual Real GetReal(const Point &p) const = 0;
00135
00137 virtual Complex GetComplex(const Point &p) const = 0;
00138
00140 virtual Real GetIntpolReal(const Vec3 &v) const = 0;
00141 virtual Real GetIntpolReal(const Vec2 &v) const = 0;
00142 virtual Real GetIntpolReal(const Real &d) const = 0;
00143
00145 virtual Complex GetIntpolComplex(const Vec3 &v) const = 0;
00146 virtual Complex GetIntpolComplex(const Vec2 &v) const = 0;
00147 virtual Complex GetIntpolComplex(const Real &d) const = 0;
00148
00149
00154
00155
00156
00157
00158
00159 virtual void Apply(NonModAlgorithm& a) const = 0;
00160 virtual void ApplyIP(NonModAlgorithm& a) const=0;
00162
00163
00167
00168 virtual void Attach(DataObserver *o) const = 0;
00169
00171 virtual void Detach(DataObserver *o) const = 0;
00172
00174 virtual void Notify() const = 0;
00176
00181 virtual Real OverallDifference(const ConstData& d) const;
00182 virtual Real NormDifference(const ConstData& d) const;
00184
00185
00195
00197 Vec3 GetPixelSampling() const;
00198
00200 Vec3 GetSpatialSampling() const;
00201
00203 Vec3 GetFrequencySampling() const;
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00219
00220
00221
00222 protected:
00223 ConstData(const ConstData& d);
00224 ConstData& operator=(const ConstData& d);
00225
00231 virtual PixelSampling& Sampling() = 0;
00232 virtual const PixelSampling& Sampling() const = 0;
00234
00236 void CalcIntpolWeights(Vec3 v, Real w[8], Point p[8]) const;
00237
00238 private:
00239
00240 };
00241
00242
00244
00253 class DLLEXPORT_OST_IMG_BASE Data: public ConstData {
00254 public:
00258 Data();
00259 virtual ~Data();
00261
00262
00266
00267 virtual void SetSpatialOrigin(const Point& o) = 0;
00269
00273
00274 void SetPixelSampling(const Vec3&);
00276 void SetPixelSampling(Real d) {SetPixelSampling(Vec3(d,d,d));}
00278 void SetSpatialSampling(const Vec3&);
00280 void SetSpatialSampling(Real d) {SetSpatialSampling(Vec3(d,d,d));}
00281
00282 virtual void Apply(NonModAlgorithm& a) const=0;
00283 virtual void ApplyIP(NonModAlgorithm& a) const=0;
00284
00285 protected:
00286 Data(const Data& d);
00287 Data& operator=(const Data& d);
00288 };
00289
00290
00291
00292 }}
00293
00294 #endif