EMAN2
reconstructor_tools.h
Go to the documentation of this file.
1/*
2 * Author: David Woolford, 07/25/2007 (woolford@bcm.edu)
3 * Copyright (c) 2000-2007 Baylor College of Medicine
4 *
5 * This software is issued under a joint BSD/GNU license. You may use the
6 * source code in this file under either license. However, note that the
7 * complete EMAN2 and SPARX software packages have some GPL dependencies,
8 * so you are responsible for compliance with the licenses of these packages
9 * if you opt to use BSD licensing. The warranty disclaimer below holds
10 * in either instance.
11 *
12 * This complete copyright notice must be included in any revised version of the
13 * source code. Additional authorship citations may be added, but existing
14 * author citations must be preserved.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 * */
31//#define RECONDEBUG // This is used to add some data objects for debugging reconstructors, it should normally be commented out!
32
33#ifndef eman_reconstructor_toosl_h__
34#define eman_reconstructor_tools_h__ 1
35
36#include "emdata.h"
37#include "interp.h"
38
39#include <string>
40using std::string;
41
42#include <cstdlib>
43
44//debug
45#include <iostream>
46using std::cout;
47using std::endl;
48
49
50namespace EMAN
51{
52
95 {
96 public:
99 FourierPixelInserter3D() : norm(0), data(0), nx(0), ny(0), nz(0), nxyz(0)
100 {}
101
105 {
106 free_memory();
107 }
108
110 {
111 TypeDict d;
112 d.put("data", EMObject::EMDATA);
113 d.put("norm", EMObject::FLOAT_POINTER);
114 return d;
115 }
116
125 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0) = 0;
126
127
128 virtual void init();
129
130#ifdef RECONDEBUG
131 double *ddata;
132 double *dnorm;
133#endif
134
135 protected:
137 float * norm;
140
142 int nx, ny, nz,nxyz;
145
146 private:
147 // Disallow copy and assignment by default
150
152 {
153 }
154 };
155
160 {
161 public:
164
165 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
166
168 {
169 return new FourierInserter3DMode1();
170 }
171
172 virtual string get_name() const
173 {
174 return NAME;
175 }
176
177 virtual string get_desc() const
178 {
179 return "Fourier pixel insertion using nearest neighbor";
180 }
181
182 static const string NAME;
183
184 private:
185 // Disallow copy and assignment by default
188 };
189
194 {
195 public:
198
199 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
200
202 {
203 return new FourierInserter3DMode2();
204 }
205
206 virtual string get_name() const
207 {
208 return NAME;
209 }
210
211 virtual string get_desc() const
212 {
213 return "Fourier pixel insertion using interpolation and the nearest 8 voxels";
214 }
215
216 static const string NAME;
217
218 // Disallow copy and assignment by default
221 };
222
227 {
228 public:
231
232 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
233
235 {
236 return new FourierInserter3DMode2l();
237 }
238
239 virtual string get_name() const
240 {
241 return NAME;
242 }
243
244 virtual string get_desc() const
245 {
246 return "Fourier pixel insertion 2x2x2 with trilinear interpolation";
247 }
248
249 static const string NAME;
250
251 // Disallow copy and assignment by default
254 };
255
256
261 {
262 public:
265
266 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
267
269 {
270 return new FourierInserter3DMode3();
271 }
272
273 virtual string get_name() const
274 {
275 return NAME;
276 }
277
278 virtual string get_desc() const
279 {
280 return "Fourier pixel insertion using a 3x3x3 Gaussian kernel";
281 }
282
283 static const string NAME;
284
285 private:
286 // Disallow copy and assignment by default
289 };
290
295 {
296 public:
298 {
299// gimx = EMAN::Interp::get_gimx();
300 }
301
303 {
304 // Don't delete gimx it causes a seg fault
305// if ( gimx != 0 )
306// {
307// delete gimx;
308// gimx = 0;
309// }
310 }
311
312 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
313
315 {
316 return new FourierInserter3DMode5();
317 }
318
319 virtual string get_name() const
320 {
321 return NAME;
322 }
323
324 virtual string get_desc() const
325 {
326 return "Fourier pixel insertion mode 5";
327 }
328
329 static const string NAME;
330
331 private:
332 // Disallow copy and assignment by default
335
336// float * gimx;
337 };
338
343 {
344 public:
347
348 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
349
351 {
352 return new FourierInserter3DMode6();
353 }
354
355 virtual string get_name() const
356 {
357 return NAME;
358 }
359
360 virtual string get_desc() const
361 {
362 return "More exact version of gauss_5";
363 }
364
365 static const string NAME;
366
367 private:
368 // Disallow copy and assignment by default
371 };
372
377 {
378
379 public:
380 static const float kernel[9][9][9];
381
384
385 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
386
388 {
389 return new FourierInserter3DMode7();
390 }
391
392 virtual string get_name() const
393 {
394 return NAME;
395 }
396
397 virtual string get_desc() const
398 {
399 return "5x5x5 gridding kernel with numerically computed kernel";
400 }
401
402 static const string NAME;
403
404 private:
405 // Disallow copy and assignment by default
408 };
409
410
415 {
416 public:
418 {
419
420 }
422 {
423 if ( W != 0 )
424 delete [] W;
425 }
426
427 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
428
430 {
431 return new FourierInserter3DMode8();
432 }
433
434 virtual string get_name() const
435 {
436 return NAME;
437 }
438
439 virtual string get_desc() const
440 {
441 return "Fourier pixel insertion mode 8";
442 }
443
444 virtual void init();
445
446 static const string NAME;
447
448 private:
450 float mDFreq;
451 // Disallow copy and assignment by default
454
455 float* W;
456 };
457
462 {
463 public:
466
467 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
468
470 {
471 return new FourierInserter3DMode9();
472 }
473
474 virtual string get_name() const
475 {
476 return NAME;
477 }
478
479 virtual string get_desc() const
480 {
481 return "Kaiser-bessel (KB) kernel 4x4x4";
482 }
483
484 static const string NAME;
485
486 private:
487 // Disallow copy and assignment by default
490 };
491
496 {
497 public:
500
501 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
502
504 {
505 return new FourierInserter3DMode10();
506 }
507
508 virtual string get_name() const
509 {
510 return NAME;
511 }
512
513 virtual string get_desc() const
514 {
515 return "(imprecise) Kaiser-bessel derived (KBD) kernel 8x8x8";
516 }
517
518 static const string NAME;
519
520 private:
521 // Disallow copy and assignment by default
524 };
525
526 // Factory for FourierPixelInserter3D
528
533 {
534
535 public:
536 static const float kernel[12][12][12];
537
540
541 virtual bool insert_pixel(const float& xx, const float& yy, const float& zz, const std::complex<float> dt, const float& weight=1.0);
542
544 {
545 return new FourierInserter3DMode11();
546 }
547
548 virtual string get_name() const
549 {
550 return NAME;
551 }
552
553 virtual string get_desc() const
554 {
555 return "7x7x7 gridding kernel with numerically computed kernel";
556 }
557
558 static const string NAME;
559
560 private:
561 // Disallow copy and assignment by default
564 };
565
566} // namespace EMAN
567
568#endif // eman_reconstructor_tools_h__
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
A class one may inherit from to ensure that the responsibilities of being incorporated into an EMAN2:...
Definition: emobject.h:893
Factory is used to store objects to create new instances.
Definition: emobject.h:725
FourierPixelInserter3DMode10 - encapsulates "method 10" for inserting a 2D Fourier slice into a 3D vo...
FourierInserter3DMode10(const FourierInserter3DMode10 &)
static FourierPixelInserter3D * NEW()
FourierInserter3DMode10 & operator=(const FourierInserter3DMode10 &)
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual string get_desc() const
Get a clear, concise description of this class.
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
FourierPixelInserter3DMode7 - encapsulates "method 7" for inserting a 2D Fourier slice into a 3D volu...
static const float kernel[12][12][12]
static FourierPixelInserter3D * NEW()
FourierInserter3DMode11(const FourierInserter3DMode11 &)
FourierInserter3DMode11 & operator=(const FourierInserter3DMode11 &)
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
virtual string get_desc() const
Get a clear, concise description of this class.
FourierPixelInserter3DMode1 - encapsulates "method 1" for inserting a 2D Fourier slice into a 3D volu...
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
FourierInserter3DMode1 & operator=(const FourierInserter3DMode1 &)
FourierInserter3DMode1(const FourierInserter3DMode1 &)
static FourierPixelInserter3D * NEW()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual string get_desc() const
Get a clear, concise description of this class.
FourierPixelInserter3DMode2 - encapsulates "method 2" for inserting a 2D Fourier slice into a 3D volu...
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
static FourierPixelInserter3D * NEW()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual string get_desc() const
Get a clear, concise description of this class.
FourierInserter3DMode2(const FourierInserter3DMode2 &)
FourierInserter3DMode2 & operator=(const FourierInserter3DMode2 &)
FourierPixelInserter3DMode2l - trilinear 2x2x2 inserter See comments in FourierPixelInserter3D for ex...
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
FourierInserter3DMode2l(const FourierInserter3DMode2l &)
static FourierPixelInserter3D * NEW()
FourierInserter3DMode2l & operator=(const FourierInserter3DMode2l &)
virtual string get_desc() const
Get a clear, concise description of this class.
FourierPixelInserter3DMode3 - encapsulates "method 3" for inserting a 2D Fourier slice into a 3D volu...
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
virtual string get_desc() const
Get a clear, concise description of this class.
FourierInserter3DMode3(const FourierInserter3DMode3 &)
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
static FourierPixelInserter3D * NEW()
FourierInserter3DMode3 & operator=(const FourierInserter3DMode3 &)
FourierPixelInserter3DMode5 - encapsulates "method 5" for inserting a 2D Fourier slice into a 3D volu...
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
FourierInserter3DMode5 & operator=(const FourierInserter3DMode5 &)
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
virtual string get_desc() const
Get a clear, concise description of this class.
static FourierPixelInserter3D * NEW()
FourierInserter3DMode5(const FourierInserter3DMode5 &)
FourierPixelInserter3DMode6 - encapsulates "method 6" for inserting a 2D Fourier slice into a 3D volu...
FourierInserter3DMode6 & operator=(const FourierInserter3DMode6 &)
virtual string get_desc() const
Get a clear, concise description of this class.
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
FourierInserter3DMode6(const FourierInserter3DMode6 &)
static FourierPixelInserter3D * NEW()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
FourierPixelInserter3DMode7 - encapsulates "method 7" for inserting a 2D Fourier slice into a 3D volu...
virtual string get_desc() const
Get a clear, concise description of this class.
FourierInserter3DMode7(const FourierInserter3DMode7 &)
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
static const float kernel[9][9][9]
FourierInserter3DMode7 & operator=(const FourierInserter3DMode7 &)
static FourierPixelInserter3D * NEW()
FourierPixelInserter3DMode8 - encapsulates "method 8" for inserting a 2D Fourier slice into a 3D volu...
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
virtual string get_desc() const
Get a clear, concise description of this class.
FourierInserter3DMode8 & operator=(const FourierInserter3DMode8 &)
FourierInserter3DMode8(const FourierInserter3DMode8 &)
static FourierPixelInserter3D * NEW()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
FourierPixelInserter3DMode9 - encapsulates "method 9" for inserting a 2D Fourier slice into a 3D volu...
FourierInserter3DMode9(const FourierInserter3DMode9 &)
static FourierPixelInserter3D * NEW()
virtual string get_desc() const
Get a clear, concise description of this class.
FourierInserter3DMode9 & operator=(const FourierInserter3DMode9 &)
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
FourierPixelInserter3D class defines a way a continuous pixel in 3D is inserted into the discrete 3D ...
FourierPixelInserter3D()
Construct a FourierPixelInserter3D.
EMData * data
A pointer to the constructor argument real_data.
virtual ~FourierPixelInserter3D()
Desctruct a FourierPixelInserter3D.
virtual bool insert_pixel(const float &xx, const float &yy, const float &zz, const std::complex< float > dt, const float &weight=1.0)=0
Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete...
FourierPixelInserter3D(const FourierPixelInserter3D &)
FourierPixelInserter3D & operator=(const FourierPixelInserter3D &)
int nx
Image volume data sizes a convenience variable used here and there.
float * norm
A pointer to the constructor argument normalize_values.
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330
E2Exception class.
Definition: aligner.h:40