00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef eman_reconstructor_toosl_h__
00037 #define eman_reconstructor_tools_h__ 1
00038
00039 #include "emdata.h"
00040 #include "interp.h"
00041
00042 #include <string>
00043 using std::string;
00044
00045 #include <cstdlib>
00046
00047
00048 #include <iostream>
00049 using std::cout;
00050 using std::endl;
00051
00052
00053 namespace EMAN
00054 {
00055
00097 class FourierPixelInserter3D : public FactoryBase
00098 {
00099 public:
00102 FourierPixelInserter3D() : norm(0), data(0), nx(0), ny(0), nz(0), nxyz(0)
00103 {}
00104
00107 virtual ~FourierPixelInserter3D()
00108 {
00109 free_memory();
00110 }
00111
00112 TypeDict get_param_types() const
00113 {
00114 TypeDict d;
00115 d.put("data", EMObject::EMDATA);
00116 d.put("norm", EMObject::FLOAT_POINTER);
00117 return d;
00118 }
00119
00128 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0) = 0;
00129
00130
00131 virtual void init();
00132
00133
00134 protected:
00136 float * norm;
00138 EMData * data;
00139
00141 int nx, ny, nz,nxyz;
00142 int nx2,ny2,nz2;
00143 int subx0,suby0,subz0,fullnx,fullny,fullnz;
00144
00145 private:
00146
00147 FourierPixelInserter3D( const FourierPixelInserter3D& );
00148 FourierPixelInserter3D& operator=( const FourierPixelInserter3D& );
00149
00150 void free_memory()
00151 {
00152 }
00153 };
00154
00158 class FourierInserter3DMode1 : public FourierPixelInserter3D
00159 {
00160 public:
00161 FourierInserter3DMode1() {}
00162 virtual ~FourierInserter3DMode1() {}
00163
00164 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
00165
00166 static FourierPixelInserter3D *NEW()
00167 {
00168 return new FourierInserter3DMode1();
00169 }
00170
00171 virtual string get_name() const
00172 {
00173 return NAME;
00174 }
00175
00176 virtual string get_desc() const
00177 {
00178 return "Fourier pixel insertion using nearest neighbor";
00179 }
00180
00181 static const string NAME;
00182
00183 private:
00184
00185 FourierInserter3DMode1( const FourierInserter3DMode1& );
00186 FourierInserter3DMode1& operator=( const FourierInserter3DMode1& );
00187 };
00188
00192 class FourierInserter3DMode2 : public FourierPixelInserter3D
00193 {
00194 public:
00195 FourierInserter3DMode2() {}
00196 virtual ~FourierInserter3DMode2() {}
00197
00198 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
00199
00200 static FourierPixelInserter3D *NEW()
00201 {
00202 return new FourierInserter3DMode2();
00203 }
00204
00205 virtual string get_name() const
00206 {
00207 return NAME;
00208 }
00209
00210 virtual string get_desc() const
00211 {
00212 return "Fourier pixel insertion using interpolation and the nearest 8 voxels";
00213 }
00214
00215 static const string NAME;
00216
00217
00218 FourierInserter3DMode2( const FourierInserter3DMode2& );
00219 FourierInserter3DMode2& operator=( const FourierInserter3DMode2& );
00220 };
00221
00225 class FourierInserter3DMode3 : public FourierPixelInserter3D
00226 {
00227 public:
00228 FourierInserter3DMode3() {}
00229 virtual ~FourierInserter3DMode3() {}
00230
00231 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
00232
00233 static FourierPixelInserter3D *NEW()
00234 {
00235 return new FourierInserter3DMode3();
00236 }
00237
00238 virtual string get_name() const
00239 {
00240 return NAME;
00241 }
00242
00243 virtual string get_desc() const
00244 {
00245 return "Fourier pixel insertion using a 3x3x3 Gaussian kernel";
00246 }
00247
00248 static const string NAME;
00249
00250 private:
00251
00252 FourierInserter3DMode3( const FourierInserter3DMode3& );
00253 FourierInserter3DMode3& operator=( const FourierInserter3DMode3& );
00254 };
00255
00259 class FourierInserter3DMode5 : public FourierPixelInserter3D
00260 {
00261 public:
00262 FourierInserter3DMode5()
00263 {
00264
00265 }
00266
00267 virtual ~FourierInserter3DMode5()
00268 {
00269
00270
00271
00272
00273
00274
00275 }
00276
00277 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
00278
00279 static FourierPixelInserter3D *NEW()
00280 {
00281 return new FourierInserter3DMode5();
00282 }
00283
00284 virtual string get_name() const
00285 {
00286 return NAME;
00287 }
00288
00289 virtual string get_desc() const
00290 {
00291 return "Fourier pixel insertion mode 5";
00292 }
00293
00294 static const string NAME;
00295
00296 private:
00297
00298 FourierInserter3DMode5( const FourierInserter3DMode5& );
00299 FourierInserter3DMode5& operator=( const FourierInserter3DMode5& );
00300
00301
00302 };
00303
00307 class FourierInserter3DMode6 : public FourierPixelInserter3D
00308 {
00309 public:
00310 FourierInserter3DMode6() {}
00311 virtual ~FourierInserter3DMode6() {}
00312
00313 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
00314
00315 static FourierPixelInserter3D *NEW()
00316 {
00317 return new FourierInserter3DMode6();
00318 }
00319
00320 virtual string get_name() const
00321 {
00322 return NAME;
00323 }
00324
00325 virtual string get_desc() const
00326 {
00327 return "More exact version of gauss_5";
00328 }
00329
00330 static const string NAME;
00331
00332 private:
00333
00334 FourierInserter3DMode6( const FourierInserter3DMode6& );
00335 FourierInserter3DMode6& operator=( const FourierInserter3DMode6& );
00336 };
00337
00341 class FourierInserter3DMode7 : public FourierPixelInserter3D
00342 {
00343 public:
00344 FourierInserter3DMode7() {}
00345 virtual ~FourierInserter3DMode7() {}
00346
00347 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
00348
00349 static FourierPixelInserter3D *NEW()
00350 {
00351 return new FourierInserter3DMode7();
00352 }
00353
00354 virtual string get_name() const
00355 {
00356 return NAME;
00357 }
00358
00359 virtual string get_desc() const
00360 {
00361 return "Hypergeometric kernel 5x5x5";
00362 }
00363
00364 static const string NAME;
00365
00366 private:
00367
00368 FourierInserter3DMode7( const FourierInserter3DMode7& );
00369 FourierInserter3DMode7& operator=( const FourierInserter3DMode7& );
00370 };
00371
00375 class FourierInserter3DMode8 : public FourierPixelInserter3D
00376 {
00377 public:
00378 FourierInserter3DMode8() : W(0)
00379 {
00380
00381 }
00382 virtual ~FourierInserter3DMode8()
00383 {
00384 if ( W != 0 )
00385 delete [] W;
00386 }
00387
00388 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
00389
00390 static FourierPixelInserter3D *NEW()
00391 {
00392 return new FourierInserter3DMode8();
00393 }
00394
00395 virtual string get_name() const
00396 {
00397 return NAME;
00398 }
00399
00400 virtual string get_desc() const
00401 {
00402 return "Fourier pixel insertion mode 8";
00403 }
00404
00405 virtual void init();
00406
00407 static const string NAME;
00408
00409 private:
00410 int mFreqCutoff;
00411 float mDFreq;
00412
00413 FourierInserter3DMode8( const FourierInserter3DMode8& );
00414 FourierInserter3DMode8& operator=( const FourierInserter3DMode8& );
00415
00416 float* W;
00417 };
00418
00419
00420
00421 template <> Factory < FourierPixelInserter3D >::Factory();
00422
00423 }
00424
00425
00426 #endif // eman_reconstructor_tools_h__