EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
EMAN::FourierIterReconstructor Class Reference

Fourier space 3D reconstruction The Fourier reconstructor is designed to work in an iterative fashion, where similarity ("quality") metrics are used to determine if a slice should be inserted into the 3D in each subsequent iteration. More...

#include <reconstructor.h>

Inheritance diagram for EMAN::FourierIterReconstructor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::FourierIterReconstructor:
Collaboration graph
[legend]

Public Member Functions

 FourierIterReconstructor ()
 Default constructor. More...
 
virtual ~FourierIterReconstructor ()
 Deconstructor calls free_memory() More...
 
virtual void setup ()
 Setup the Fourier reconstructor. More...
 
virtual void setup_seed (EMData *seed, float seed_weight)
 Initialize the reconstructor with a seed volume. More...
 
virtual void setup_seedandweights (EMData *seed, EMData *weight)
 Initialize the reconstructor with a seed volume, as above. More...
 
virtual EMDatapreprocess_slice (const EMData *const slice, const Transform &t=Transform())
 Preprocess the slice prior to insertion into the 3D volume this Fourier tranforms the slice and make sure all the pixels are in the right position it always returns a copy of the provided slice, so it should be deleted by someone eventually. More...
 
virtual int insert_slice (const EMData *const slice, const Transform &euler, const float weight)
 Insert a slice into a 3D volume, in a given orientation. More...
 
virtual int determine_slice_agreement (EMData *slice, const Transform &euler, const float weight=1.0, bool sub=true)
 Compares a slice to the current reconstruction volume and computes a normalization factor and quality. More...
 
virtual EMDatafinish (bool doift=true)
 Get the reconstructed volume Normally will return the volume in real-space with the requested size. More...
 
virtual void clear ()
 clear the volume and tmp_data for use in Monte Carlo reconstructions More...
 
virtual string get_name () const
 Get the unique name of the reconstructor. More...
 
virtual string get_desc () const
 Get the one line description of the reconstructor. More...
 
virtual TypeDict get_param_types () const
 Get the parameter types of this object. More...
 
- Public Member Functions inherited from EMAN::Reconstructor
 Reconstructor ()
 
virtual ~Reconstructor ()
 
int insert_slice (const EMData *const slice, const Transform &euler)
 
virtual EMDataprojection (const Transform &euler, int ret_fourier=1)
 This will create a projection from the current reconstruction. More...
 
void print_params () const
 Print the current parameters to std::out. More...
 
EMObjectoperator[] (const string &key)
 
- Public Member Functions inherited from EMAN::FactoryBase
 FactoryBase ()
 
virtual ~FactoryBase ()
 
Dict get_params () const
 get a copy of the parameters of this class More...
 
void set_params (const Dict &new_params)
 Set new parameters. More...
 
void set_param (const string key, const EMObject val)
 
void insert_params (const Dict &new_params)
 Insert parameters. More...
 
Dict copy_relevant_params (const FactoryBase *const that) const
 
- Public Member Functions inherited from EMAN::ReconstructorVolumeData
 ReconstructorVolumeData ()
 Only constructor All member variables are zeroed. More...
 
virtual ~ReconstructorVolumeData ()
 Destructor safely frees memory. More...
 
const EMDataget_emdata ()
 Get the main image pointer, probably redundant (not used) More...
 

Static Public Member Functions

static ReconstructorNEW ()
 Factory incorporation uses the pointer of this function. More...
 

Static Public Attributes

static const string NAME = "fourier_iter"
 

Protected Member Functions

virtual void free_memory ()
 Frees the memory owned by this object (but not parent objects) Deletes the FourierPixelInserter3D pointer. More...
 
- Protected Member Functions inherited from EMAN::ReconstructorVolumeData
void free_memory ()
 Free allocated memorys The inherited class may have allocated image of tmp_data In either case you can safely call this function to delete either of those pointers, even if they bdb:refine_03::threed_00are NULL. More...
 
virtual void normalize_threed (const bool sqrt_damp=false, const bool wiener=false)
 Normalize on the assumption that image is a Fourier volume and that tmp_data is a volume of weights corresponding in size to this Fourier volume. More...
 
virtual void zero_memory ()
 Sends the pixels in tmp_data and image to zero Convenience only. More...
 

Protected Attributes

EMDataref_vol
 
- Protected Attributes inherited from EMAN::FactoryBase
Dict params
 This is the dictionary the stores the parameters of the object. More...
 
- Protected Attributes inherited from EMAN::ReconstructorVolumeData
EMDataimage
 Inheriting class allocates this, probably in setup(). More...
 
EMDatatmp_data
 Inheriting class may allocate this, probably in setup() More...
 
int nx
 
int nx2
 
int ny
 
int ny2
 
int nz
 
int nz2
 
int subnx
 
int subny
 
int subnz
 
int subx0
 
int suby0
 
int subz0
 

Private Member Functions

 FourierIterReconstructor (const FourierIterReconstructor &that)
 Disallow copy construction. More...
 
FourierIterReconstructoroperator= (const FourierIterReconstructor &)
 Disallow assignment. More...
 

Detailed Description

Fourier space 3D reconstruction The Fourier reconstructor is designed to work in an iterative fashion, where similarity ("quality") metrics are used to determine if a slice should be inserted into the 3D in each subsequent iteration.

The client creates a Fourier reconstructor to insert real images into a 3D volume. The return image is a real space image

This reconstructor works in Fourier space using a hardcoded 5x5x5 interpolation kernel based on the local environment from a previous iteration. That is, it uses interpolation, not gridding, but rather than using a fixed interpolation kernel, it bases the kernel on a previous estimate of the Fourier volume. It is designed to be used iteratively, being passed the results of the previous round as a starting volume in each pass. The starting volume does not get directly incorporated into the result, but is only used to define the local interpolation kernel.

Definition at line 698 of file reconstructor.h.

Constructor & Destructor Documentation

◆ FourierIterReconstructor() [1/2]

EMAN::FourierIterReconstructor::FourierIterReconstructor ( )
inline

Default constructor.

Definition at line 703 of file reconstructor.h.

Referenced by NEW().

◆ ~FourierIterReconstructor()

virtual EMAN::FourierIterReconstructor::~FourierIterReconstructor ( )
inlinevirtual

Deconstructor calls free_memory()

Definition at line 708 of file reconstructor.h.

708{ free_memory(); }
virtual void free_memory()
Frees the memory owned by this object (but not parent objects) Deletes the FourierPixelInserter3D poi...

References free_memory().

◆ FourierIterReconstructor() [2/2]

EMAN::FourierIterReconstructor::FourierIterReconstructor ( const FourierIterReconstructor that)
private

Disallow copy construction.

Member Function Documentation

◆ clear()

void FourierIterReconstructor::clear ( )
virtual

clear the volume and tmp_data for use in Monte Carlo reconstructions

Reimplemented from EMAN::Reconstructor.

Definition at line 501 of file reconstructor.cpp.

501 {
502 setup();
503}
virtual void setup()
Setup the Fourier reconstructor.

References setup().

◆ determine_slice_agreement()

int FourierIterReconstructor::determine_slice_agreement ( EMData slice,
const Transform euler,
const float  weight = 1.0,
bool  sub = true 
)
virtual

Compares a slice to the current reconstruction volume and computes a normalization factor and quality.

Normalization and quality are returned via attributes set in the passed slice. You may freely mix calls to determine_slice_agreement with calls to insert_slice, but note that determine_slice_agreement can only use information from slices that have already been inserted. Attributes set in the slice are: reconstruct_norm the relative normalization factor which should be applied before inserting the slice reconstruct_qual a scaled quality factor (larger better) for this slice as compared to the existing reconstruction reconstruct_absqual the absolute (not scaled based on weight) quality factor comparing this slice to the existing reconstruction reconstruct_weight the summed weights from all voxels intersecting with the inserted slice, larger -> more overlap with other slices

Parameters
input_sliceThe EMData slice to be compared
eulerThe orientation of the slice as a Transform object
weightA weighting factor for this slice, generally the number of particles in a class-average. May be ignored by some reconstructors
subFlag indicating whether to subtract the slice from the volume before comparing. May be ignored by some reconstructors
Returns
0 if OK. 1 if error.
Exceptions
NullPointerExceptionif the input EMData pointer is null
ImageFormatExceptionif the image is complex as opposed to real

Reimplemented from EMAN::Reconstructor.

Definition at line 651 of file reconstructor.cpp.

651{ return 0; }

◆ finish()

EMData * FourierIterReconstructor::finish ( bool  doift = true)
virtual

Get the reconstructed volume Normally will return the volume in real-space with the requested size.

The calling application is responsible for removing any padding.

Parameters
doiftA flag indicating whether the returned object should be guaranteed to be in real-space (true) or should be left in whatever space the reconstructor generated
Returns
The real space reconstructed volume

Reimplemented from EMAN::Reconstructor.

Definition at line 653 of file reconstructor.cpp.

653 {
655
656 if (doift) {
657 image->do_ift_inplace();
658 image->depad();
659 image->process_inplace("xform.phaseorigin.tocenter");
660 }
661
662 image->update();
663
664 if (params.has_key("savenorm") && strlen((const char *)params["savenorm"])>0) {
665 if (tmp_data->get_ysize()%2==0 && tmp_data->get_zsize()%2==0) tmp_data->process_inplace("xform.fourierorigin.tocenter");
666 tmp_data->write_image((const char *)params["savenorm"]);
667 }
668
669 //Since we give up the ownership of the pointer to-be-returned, it's caller's responsibility to delete the returned image.
670 //So we wrap this function with return_value_policy< manage_new_object >() in libpyReconstructor2.cpp to hand over ownership to Python.
671 EMData *ret=image;
672 image=0;
673
674 return ret;
675}
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
Dict params
This is the dictionary the stores the parameters of the object.
Definition: emobject.h:953
EMData * image
Inheriting class allocates this, probably in setup().
EMData * tmp_data
Inheriting class may allocate this, probably in setup()
virtual void normalize_threed(const bool sqrt_damp=false, const bool wiener=false)
Normalize on the assumption that image is a Fourier volume and that tmp_data is a volume of weights c...

References EMAN::Dict::has_key(), EMAN::ReconstructorVolumeData::image, EMAN::ReconstructorVolumeData::normalize_threed(), EMAN::FactoryBase::params, and EMAN::ReconstructorVolumeData::tmp_data.

◆ free_memory()

void FourierIterReconstructor::free_memory ( )
protectedvirtual

Frees the memory owned by this object (but not parent objects) Deletes the FourierPixelInserter3D pointer.

Definition at line 677 of file reconstructor.cpp.

677 {
678 if (image) delete image;
679 if (tmp_data) delete tmp_data;
680 if (ref_vol) delete ref_vol;
682}

References EMAN::ReconstructorVolumeData::image, ref_vol, and EMAN::ReconstructorVolumeData::tmp_data.

Referenced by ~FourierIterReconstructor().

◆ get_desc()

virtual string EMAN::FourierIterReconstructor::get_desc ( ) const
inlinevirtual

Get the one line description of the reconstructor.

Implements EMAN::FactoryBase.

Definition at line 787 of file reconstructor.h.

788 {
789 return "Reconstruction via Fourier interpolation using an iterative strategy to define the interpolation kernel";
790 }

◆ get_name()

virtual string EMAN::FourierIterReconstructor::get_name ( ) const
inlinevirtual

Get the unique name of the reconstructor.

Implements EMAN::FactoryBase.

Definition at line 780 of file reconstructor.h.

781 {
782 return NAME;
783 }

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::FourierIterReconstructor::get_param_types ( ) const
inlinevirtual

Get the parameter types of this object.

Returns
a TypeDict detailing all of the acceptable (and necessary) parameters

Implements EMAN::FactoryBase.

Definition at line 803 of file reconstructor.h.

804 {
805 TypeDict d;
806 d.put("size", EMObject::INTARRAY, "Required. The dimensions of the real-space output volume, including any padding (must be handled by the calling application). Assumed that apix x/y/z identical.");
807 d.put("sym", EMObject::STRING, "Optional. The symmetry of the reconstructed volume, c?, d?, oct, tet, icos, h?. Default is c1, ie - an asymmetric object");
808 d.put("verbose", EMObject::BOOL, "Optional. Toggles writing useful information to standard out. Default is false.");
809 return d;
810 }

References EMAN::EMObject::BOOL, EMAN::EMObject::INTARRAY, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.

◆ insert_slice()

int FourierIterReconstructor::insert_slice ( const EMData *const  slice,
const Transform euler,
const float  weight 
)
virtual

Insert a slice into a 3D volume, in a given orientation.

Returns
0 if successful, 1 otherwise
Parameters
slicethe image slice to be inserted into the 3D volume
eulerEuler angle of this image slice.
weightA weighting factor for this slice, generally the number of particles in a class-average. May be ignored by some reconstructors
Returns
0 if OK. 1 if error.
Exceptions
NullPointerExceptionif the input EMData pointer is null
ImageFormatExceptionif the image is complex as opposed to real

Reimplemented from EMAN::Reconstructor.

Definition at line 522 of file reconstructor.cpp.

522 {
523 Transform * rotation;
524 rotation = new Transform(arg); // assignment operator
525 // We must use only the rotational component of the transform, scaling, translation and mirroring
526 // are not implemented in Fourier space, but are in preprocess_slice
527 rotation->set_scale(1.0);
528 rotation->set_mirror(false);
529 rotation->set_trans(0,0,0);
530
531// if (slice->get_attr_default("reconstruct_preproc",(int) 0)) throw ImageDimensionException("ERROR: FourierIterReconstructor requires preprocess_slice() to be called in advance");
532
533 vector<Transform> syms = Symmetry3D::get_symmetries((string)params["sym"]);
534
535 float inx=(float)(slice->get_xsize()); // x/y dimensions of the input image
536 float iny=(float)(slice->get_ysize());
537 size_t ny2sq=ny*ny/4;
538
539 for ( vector<Transform>::const_iterator it = syms.begin(); it != syms.end(); ++it ) {
540 Transform t3d = (*rotation)*(*it);
541 for (int y = -iny/2; y < iny/2; y++) {
542 for (int x = 0; x < inx/2; x++) {
543
544 float rx = (float) x/(inx-2.0f); // coords relative to Nyquist=.5
545 float ry = (float) y/iny;
546 int r=Util::hypot_fast_int(x,y);
547 if (r>iny/2+3 && abs(inx-iny)<3) continue; // no filling in Fourier corners...
548
549 Vec3f coord(rx,ry,0);
550 coord = coord*t3d; // transpose multiplication
551 float xx = coord[0]; // transformed coordinates in terms of Nyquist
552 float yy = coord[1];
553 float zz = coord[2];
554
555 // Map back to real pixel coordinates in output volume
556 xx=xx*(nx-2);
557 yy=yy*ny;
558 zz=zz*nz;
559
560
561 int x0 = (int) floor(xx-2.5);
562 int y0 = (int) floor(yy-2.5);
563 int z0 = (int) floor(zz-2.5);
564
565 std::complex<float>dt=slice->get_complex_at(x,y); // The data value we want to insert
566
567 if (x0<-nx2-4 || y0<-ny2-4 || z0<-nz2-4 || x0>nx2+3 || y0>ny2+3 || z0>nz2+3 ) continue;
568
569 // no error checking on add_complex_fast, so we need to be careful here
570 int x1=x0+5;
571 int y1=y0+5;
572 int z1=z0+5;
573 if (x0<-nx2) x0=-nx2;
574 if (x1>nx2) x1=nx2;
575 if (y0<-ny2) y0=-ny2;
576 if (y1>ny2) y1=ny2;
577 if (z0<-nz2) z0=-nz2;
578 if (z1>nz2) z1=nz2;
579
580 if (ref_vol) {
581 // The value in the reference volume at the center insertion location (nearest voxel)
582// std::complex<float>nodt=ref_vol->get_complex_at(Util::round(xx),Util::round(yy),Util::round(zz));
583
584 // Here we trilinear interpolate the point value from the reference volume
585 float xx0=floor(xx);
586 float yy0=floor(yy);
587 float zz0=floor(zz);
588 std::complex<float>nodt=Util::trilinear_interpolate_complex(
589 ref_vol->get_complex_at(xx0,yy0,zz0),
590 ref_vol->get_complex_at(xx0+1,yy0,zz0),
591 ref_vol->get_complex_at(xx0,yy0+1,zz0),
592 ref_vol->get_complex_at(xx0+1,yy0+1,zz0),
593 ref_vol->get_complex_at(xx0,yy0,zz0+1),
594 ref_vol->get_complex_at(xx0+1,yy0,zz0+1),
595 ref_vol->get_complex_at(xx0,yy0+1,zz0+1),
596 ref_vol->get_complex_at(xx0+1,yy0+1,zz0+1),
597 xx-xx0,yy-yy0,zz-zz0);
598
599// float h=1.0f/EMConsts::I5G;
600 float h=1.0f/2.0f; // This value was optimized empirically for a specific test case
601 float gg=1.0; //default no radial weight
602 for (int k = z0 ; k <= z1; k++) {
603 for (int j = y0 ; j <= y1; j++) {
604 for (int i = x0; i <= x1; i ++) {
605 if ((size_t)i*i+j*j+k*k>ny2sq) continue;
606 std::complex<float>ntdt=ref_vol->get_complex_at(i,j,k);
607 //gg=abs(nodt); // we use this as a weight
608 //if (gg==0) continue;
609 //gg=1.0; // turn off local weight
610 //std::complex<float>updt=dt*ntdt/nodt; // This is the unweighted target value for i,j,k
611 std::complex<float>updt=dt+ntdt-nodt;
612
613 float rl = Util::hypot3sq((float) i - xx, j - yy, k - zz);
614 gg = Util::fast_exp(-rl *h);
615
616 size_t off;
617 off=image->add_complex_at_fast(i,j,k,updt*gg*weight);
618 tmp_data->get_data()[off/2]+=gg*weight;
619 }
620 }
621 }
622 } else {
623 float h=1.0f/((Util::hypot3sq(xx,yy,zz)/4000)+.15); // gaussian kernel is used as a weight not a kernel. We increase radius of integration with resolution. Changed away from this on 11/10/17
624 h=h<0.1?0.1:h; // new formula has h from 0.2 to 5
625
626 float rl, gg;
627 for (int k = z0 ; k <= z1; k++) {
628 for (int j = y0 ; j <= y1; j++) {
629 for (int i = x0; i <= x1; i ++) {
630 rl = Util::hypot3sq((float) i - xx, j - yy, k - zz);
631 gg = Util::fast_exp(-rl *h);
632
633 size_t off;
634 off=image->add_complex_at_fast(i,j,k,dt*gg*weight);
635 //if (off==image->get_size())
636 //printf("%d %d %d\t%g %g %g %g\t%ld\n",i,j,k,dt.real(),dt.imag(),gg,weight,off);
637 tmp_data->get_data()[off/2]+=gg*weight; // This is for interpolation rather than gridding
638 }
639 }
640 }
641 }
642 }
643 }
644 }
645
646
647 delete rotation; rotation=0;
648 return 0;
649}
static vector< Transform > get_symmetries(const string &symmetry)
Definition: symmetry.cpp:1240
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
void set_mirror(const bool x_mirror)
Set whether or not x_mirroring is occurring.
Definition: transform.cpp:1238
void set_scale(const float &scale)
Set the scale.
Definition: transform.cpp:1123
void set_trans(const float &x, const float &y, const float &z=0)
Set the post translation component.
Definition: transform.cpp:1036
static int hypot3sq(int x, int y, int z)
Euclidean distance function squared in 3D: f(x,y,z) = (x*x + y*y + z*z);.
Definition: util.h:805
static std::complex< float > trilinear_interpolate_complex(std::complex< float > p1, std::complex< float > p2, std::complex< float > p3, std::complex< float > p4, std::complex< float > p5, std::complex< float > p6, std::complex< float > p7, std::complex< float > p8, float t, float u, float v)
Calculate trilinear interpolation.
Definition: util.h:645
static short hypot_fast_int(int x, int y)
Euclidean distance in 2D for integers computed fast using a cached lookup table.
Definition: util.cpp:764
static float fast_exp(const float &f)
Returns an approximate of exp(x) using a cached table uses actual exp(x) outside the cached range.
Definition: util.cpp:788
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References EMAN::Util::fast_exp(), EMAN::Symmetry3D::get_symmetries(), EMAN::Util::hypot3sq(), EMAN::Util::hypot_fast_int(), EMAN::ReconstructorVolumeData::image, EMAN::ReconstructorVolumeData::nx, EMAN::ReconstructorVolumeData::nx2, EMAN::ReconstructorVolumeData::ny, EMAN::ReconstructorVolumeData::ny2, EMAN::ReconstructorVolumeData::nz, EMAN::ReconstructorVolumeData::nz2, EMAN::FactoryBase::params, ref_vol, EMAN::Transform::set_mirror(), EMAN::Transform::set_scale(), EMAN::Transform::set_trans(), EMAN::ReconstructorVolumeData::tmp_data, EMAN::Util::trilinear_interpolate_complex(), x, and y.

◆ NEW()

static Reconstructor * EMAN::FourierIterReconstructor::NEW ( )
inlinestatic

Factory incorporation uses the pointer of this function.

Returns
a Reconstructor pointer to a newly allocated FourierReconstructor

Definition at line 795 of file reconstructor.h.

796 {
797 return new FourierIterReconstructor();
798 }
FourierIterReconstructor()
Default constructor.

References FourierIterReconstructor().

◆ operator=()

FourierIterReconstructor & EMAN::FourierIterReconstructor::operator= ( const FourierIterReconstructor )
private

Disallow assignment.

◆ preprocess_slice()

EMData * FourierIterReconstructor::preprocess_slice ( const EMData *const  slice,
const Transform t = Transform() 
)
virtual

Preprocess the slice prior to insertion into the 3D volume this Fourier tranforms the slice and make sure all the pixels are in the right position it always returns a copy of the provided slice, so it should be deleted by someone eventually.

Returns
the processed slice
Parameters
slicethe slice to be prepocessed
ttransform to be used for insertion
Exceptions
InvalidValueExceptionwhen the specified padding value is less than the size of the images

Reimplemented from EMAN::Reconstructor.

Definition at line 505 of file reconstructor.cpp.

505 {
506 // Shift the image pixels so the real space origin is now located at the phase origin (at the bottom left of the image)
507 EMData* return_slice = 0;
508 Transform tmp(t);
509 tmp.set_rotation(Dict("type","eman")); // resets the rotation to 0 implicitly, this way we only do 2d translation,scaling and mirroring
510
511 if (tmp.is_identity()) return_slice=slice->copy();
512 else return_slice = slice->process("xform",Dict("transform",&tmp));
513
514 return_slice->process_inplace("xform.phaseorigin.tocorner");
515 return_slice->do_fft_inplace();
516 return_slice->mult((float)sqrt(1.0f/(return_slice->get_ysize())*return_slice->get_xsize()));
517
518 return_slice->set_attr("reconstruct_preproc",(int)1);
519 return return_slice;
520}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
EMData * sqrt() const
return square root of current image

References EMAN::Transform::is_identity(), EMAN::Transform::set_rotation(), and sqrt().

◆ setup()

void FourierIterReconstructor::setup ( )
virtual

Setup the Fourier reconstructor.

Exceptions
InvalidValueExceptionWhen one of the input parameters is invalid

Implements EMAN::Reconstructor.

Definition at line 430 of file reconstructor.cpp.

430 {
431 // default setting behavior - does not override if the parameter is already set
432 params.set_default("verbose",(int)0);
433
434 vector<int> size=params["size"];
435
436 nx = size[0]+2;
437 ny = size[1];
438 nz = size[2];
439 nx2=nx/2-2;
440 ny2=ny/2;
441 nz2=nz/2;
442
444 subx0=suby0=subz0=0;
445
446 if (nx%2==1) throw ImageDimensionException("ERROR: FourierIterReconstructor only supports even box sizes");
447
448 // The fourier volume where the reconstruction lives
449 if (image) delete image;
450 image = new EMData(nx,ny,nz);
451 image->set_complex(true);
452 image->set_fftodd(false);
453 image->set_ri(true);
454 image->to_zero();
455
456 // This is the normalization volume
457 if (tmp_data) delete tmp_data;
458 tmp_data = new EMData(nx/2,ny,nz);
459 tmp_data->to_zero();
460
461 // this is the reference volume used to define the interpolation kernel
462 // regular "setup" doesn't have one, in which case we default to a local gaussian kernel
463 // This should only happen during the first iteration
464 if (ref_vol) { delete ref_vol; ref_vol=0; }
465// ref_vol = new EMData(nx,ny,nz);
466// ref_vol->set_complex(true);
467// ref_vol->set_fftodd(false);
468// ref_vol->set_ri(true);
469// ref_vol->to_one();
470
471
472
473 if ( (bool) params["verbose"] )
474 {
475 cout << "3D Fourier dimensions are " << nx << " " << ny << " " << nz << endl;
476 cout << "3D Fourier subvolume is " << subnx << " " << subny << " " << subnz << endl;
477 printf ("You will require approximately %1.3g GB of memory to reconstruct this volume\n",((float)subnx*subny*subnz*sizeof(float)*2.5)/1000000000.0);
478 }
479
480}
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
#define ImageDimensionException(desc)
Definition: exception.h:166

References EMAN::ReconstructorVolumeData::image, ImageDimensionException, EMAN::ReconstructorVolumeData::nx, EMAN::ReconstructorVolumeData::nx2, EMAN::ReconstructorVolumeData::ny, EMAN::ReconstructorVolumeData::ny2, EMAN::ReconstructorVolumeData::nz, EMAN::ReconstructorVolumeData::nz2, EMAN::FactoryBase::params, ref_vol, EMAN::Dict::set_default(), EMAN::ReconstructorVolumeData::subnx, EMAN::ReconstructorVolumeData::subny, EMAN::ReconstructorVolumeData::subnz, EMAN::ReconstructorVolumeData::subx0, EMAN::ReconstructorVolumeData::suby0, EMAN::ReconstructorVolumeData::subz0, and EMAN::ReconstructorVolumeData::tmp_data.

Referenced by clear(), setup_seed(), and setup_seedandweights().

◆ setup_seed()

void FourierIterReconstructor::setup_seed ( EMData seed,
float  seed_weight 
)
virtual

Initialize the reconstructor with a seed volume.

This can be used to provide some 'default' value when there is missing data in Fourier space. The passed 'seed' must be of the appropriate padded size, must be in Fourier space, and the same EMData* object will be returned by finish(), meaning the Reconstructor is implicitly taking ownership of the object. However, in Python, this means the seed may be passed in without copying, as the same EMData will be coming back out at the end. The seed_weight determines how 'strong' the seed volume should be as compared to other inserted slices in Fourier space.

Exceptions
InvalidValueExceptionWhen one of the input parameters is invalid

Reimplemented from EMAN::Reconstructor.

Definition at line 481 of file reconstructor.cpp.

481 {
482 setup(); // ok, a little dumb to initialize ref_vol then immediately delete it
483 if (seed->is_complex()) ref_vol=seed->copy(); // we assume tocorner was called properly and dimensions are correct
484 else {
485 ref_vol=seed->do_fft();
486 ref_vol->process_inplace("xform.phaseorigin.tocorner");
487 }
488}

References ref_vol, and setup().

◆ setup_seedandweights()

void FourierIterReconstructor::setup_seedandweights ( EMData seed,
EMData weight 
)
virtual

Initialize the reconstructor with a seed volume, as above.

In this case the initial weight map is also provided explicitly, rather than a single weight value.

Reimplemented from EMAN::Reconstructor.

Definition at line 490 of file reconstructor.cpp.

490 {
491 setup(); // ok, a little dumb to initialize ref_vol then immediately delete it
492 if (seed->is_complex()) ref_vol=seed->copy(); // we assume tocorner was called properly and dimensions are correct
493 else {
494 ref_vol=seed->do_fft();
495 ref_vol->process_inplace("xform.phaseorigin.tocorner");
496 }
497 printf("Warning: FourierIterReconstructor ignores seed weights");
498}

References ref_vol, and setup().

Member Data Documentation

◆ NAME

const string FourierIterReconstructor::NAME = "fourier_iter"
static

Definition at line 812 of file reconstructor.h.

Referenced by get_name().

◆ ref_vol

EMData* EMAN::FourierIterReconstructor::ref_vol
protected

Definition at line 821 of file reconstructor.h.

Referenced by free_memory(), insert_slice(), setup(), setup_seed(), and setup_seedandweights().


The documentation for this class was generated from the following files: