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

FourierPixelInserter3DMode8 - encapsulates "method 8" for inserting a 2D Fourier slice into a 3D volume See comments in FourierPixelInserter3D for explanations. More...

#include <reconstructor_tools.h>

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

Public Member Functions

 FourierInserter3DMode8 ()
 
virtual ~FourierInserter3DMode8 ()
 
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 3D volume. More...
 
virtual string get_name () const
 Get the unique name of this class (especially for factory based instantiation access) More...
 
virtual string get_desc () const
 Get a clear, concise description of this class. More...
 
virtual void init ()
 
- Public Member Functions inherited from EMAN::FourierPixelInserter3D
 FourierPixelInserter3D ()
 Construct a FourierPixelInserter3D. More...
 
virtual ~FourierPixelInserter3D ()
 Desctruct a FourierPixelInserter3D. More...
 
TypeDict get_param_types () const
 
- 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
 

Static Public Member Functions

static FourierPixelInserter3DNEW ()
 

Static Public Attributes

static const string NAME = "experimental"
 

Private Member Functions

 FourierInserter3DMode8 (const FourierInserter3DMode8 &)
 
FourierInserter3DMode8operator= (const FourierInserter3DMode8 &)
 

Private Attributes

int mFreqCutoff
 
float mDFreq
 
float * W
 

Additional Inherited Members

- Protected Attributes inherited from EMAN::FourierPixelInserter3D
float * norm
 A pointer to the constructor argument normalize_values. More...
 
EMDatadata
 A pointer to the constructor argument real_data. More...
 
int nx
 Image volume data sizes a convenience variable used here and there. More...
 
int ny
 
int nz
 
int nxyz
 
int nx2
 
int ny2
 
int nz2
 
int subx0
 
int suby0
 
int subz0
 
int fullnx
 
int fullny
 
int fullnz
 
- Protected Attributes inherited from EMAN::FactoryBase
Dict params
 This is the dictionary the stores the parameters of the object. More...
 

Detailed Description

FourierPixelInserter3DMode8 - encapsulates "method 8" for inserting a 2D Fourier slice into a 3D volume See comments in FourierPixelInserter3D for explanations.

Definition at line 414 of file reconstructor_tools.h.

Constructor & Destructor Documentation

◆ FourierInserter3DMode8() [1/2]

EMAN::FourierInserter3DMode8::FourierInserter3DMode8 ( )
inline

Definition at line 417 of file reconstructor_tools.h.

417 : W(0)
418 {
419
420 }

Referenced by NEW().

◆ ~FourierInserter3DMode8()

virtual EMAN::FourierInserter3DMode8::~FourierInserter3DMode8 ( )
inlinevirtual

Definition at line 421 of file reconstructor_tools.h.

422 {
423 if ( W != 0 )
424 delete [] W;
425 }

References W.

◆ FourierInserter3DMode8() [2/2]

EMAN::FourierInserter3DMode8::FourierInserter3DMode8 ( const FourierInserter3DMode8 )
private

Member Function Documentation

◆ get_desc()

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

Get a clear, concise description of this class.

Returns
a clear, concise description of this class

Implements EMAN::FactoryBase.

Definition at line 439 of file reconstructor_tools.h.

440 {
441 return "Fourier pixel insertion mode 8";
442 }

◆ get_name()

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

Get the unique name of this class (especially for factory based instantiation access)

Returns
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 434 of file reconstructor_tools.h.

435 {
436 return NAME;
437 }

References NAME.

◆ init()

void FourierInserter3DMode8::init ( )
virtual

Reimplemented from EMAN::FourierPixelInserter3D.

Definition at line 582 of file reconstructor_tools.cpp.

583{
585// int P = (int)((1.0+0.25)*nx+1);
586// float r = (float)(nx+1)/(float)P;
587// mFreqCutoff = 2;
588// mDFreq = 0.2f;
589// if (W != 0) delete [] W;
590// W = Util::getBaldwinGridWeights(mFreqCutoff, (float)P, r,mDFreq,0.5f,0.2f);
591
592}

References EMAN::FourierPixelInserter3D::init().

◆ insert_pixel()

bool FourierInserter3DMode8::insert_pixel ( const float &  xx,
const float &  yy,
const float &  zz,
const std::complex< float >  dt,
const float &  weight = 1.0 
)
virtual

Insert a complex pixel [dt[0]+dt[1]i] at (float) coordinate [xx,yy,zz] with weighting into a discrete 3D volume.

Parameters
xxthe floating point x coordinate
yythe floating point y coordinate
zzthe floating point z coordinate
dtthe complex pixel value (dt[0] is real, dt[1] is imaginary)
weightthe weight to given to this complex pixel
Returns
A boolean that indicates the pixel has been inserted (or not)

Implements EMAN::FourierPixelInserter3D.

Definition at line 594 of file reconstructor_tools.cpp.

595{
596 static FILE *out400=NULL,*out862=NULL,*out962,*out872,*out4093=NULL;
597
598 int x0 = (int) floor(xx);
599 int y0 = (int) floor(yy);
600 int z0 = (int) floor(zz);
601
602 if (out400==NULL) {
603 out400=fopen("pxl4_0_0.txt","w");
604 out862=fopen("pxl8_6_2.txt","w");
605 out962=fopen("pxl9_6_2.txt","w");
606 out872=fopen("pxl8_7_2.txt","w");
607 out4093=fopen("pxl40_9_3.txt","w");
608 }
609
610 // note that subnx differs in the inserters. In the reconstructors it subx0 is 0 for the full volume. Here it is -1
611 if (subx0<0) { // normal full reconstruction
612 if (x0<-nx2-1 || y0<-ny2-1 || z0<-nz2-1 || x0>nx2 || y0>ny2 || z0>nz2 ) return false;
613
614 int x1=x0+1;
615 int y1=y0+1;
616 int z1=z0+1;
617// if (x0<-nx2) x0=-nx2;
618// if (x1>nx2) x1=nx2;
619// if (y0<-ny2) y0=-ny2;
620// if (y1>ny2) y1=ny2;
621// if (z0<-nz2) z0=-nz2;
622// if (z1>nz2) z1=nz2;
623
624// float h=2.0/((1.0+pow(Util::hypot3sq(xx,yy,zz),.5))*EMConsts::I2G);
625 float h=1.0f/EMConsts::I2G;
626 //size_t idx;
627 float r, gg;
628// int pc=0;
629 for (int k = z0 ; k <= z1; k++) {
630 for (int j = y0 ; j <= y1; j++) {
631 for (int i = x0; i <= x1; i ++) {
632 r = Util::hypot3sq((float) i - xx, j - yy, k - zz);
633// gg=weight;
634 gg = Util::fast_exp(-r *h)*weight;
635// gg = Util::fast_exp(-r / EMConsts::I2G)*weight;
636// gg = sqrt(Util::fast_exp(-r / EMConsts::I2G))*weight;
637
638 size_t off;
639 off=data->add_complex_at_fast(i,j,k,dt*gg);
640// off=data->add_complex_at(i,j,k,dt*gg);
641 if (off!=nxyz) norm[off/2]+=gg;
642
643 if (i==4&&j==0&&k==0) { fprintf(out400,"%1.4f\t%1.4f\t%1.4f\t%1.4f\t%1.4f\n",dt.real(),dt.imag(),gg,std::abs(dt),std::arg(dt)); fflush(out400); }
644 if (i==8&&j==6&&k==2) { fprintf(out862,"%1.4f\t%1.4f\t%1.4f\t%1.4f\t%1.4f\n",dt.real(),dt.imag(),gg,std::abs(dt),std::arg(dt)); fflush(out862); }
645 if (i==9&&j==6&&k==2) { fprintf(out962,"%1.4f\t%1.4f\t%1.4f\t%1.4f\t%1.4f\n",dt.real(),dt.imag(),gg,std::abs(dt),std::arg(dt)); fflush(out962); }
646 if (i==8&&j==7&&k==2) { fprintf(out872,"%1.4f\t%1.4f\t%1.4f\t%1.4f\t%1.4f\n",dt.real(),dt.imag(),gg,std::abs(dt),std::arg(dt)); fflush(out872); }
647 if (i==40&&j==9&&k==3) { fprintf(out4093,"%1.4f\t%1.4f\t%1.4f\t%1.4f\t%1.4f\n",dt.real(),dt.imag(),gg,std::abs(dt),std::arg(dt)); fflush(out4093); }
648 }
649 }
650 }
651 return true;
652 }
653 else { // for subvolumes, not optimized yet
654 //size_t idx;
655 float r, gg;
656 int pc=0;
657 for (int k = z0 ; k <= z0 + 1; k++) {
658 for (int j = y0 ; j <= y0 + 1; j++) {
659 for (int i = x0; i <= x0 + 1; i ++) {
660 r = Util::hypot3sq((float) i - xx, j - yy, k - zz);
661 gg = Util::fast_exp(-r / EMConsts::I2G)*weight;
662
663 size_t off;
664 if (subx0<0) off=data->add_complex_at(i,j,k,dt*gg);
665 else off=data->add_complex_at(i,j,k,subx0,suby0,subz0,fullnx,fullny,fullnz,dt*gg);
666 if (static_cast<int>(off)!=nxyz) { norm[off/2]+=gg; pc+=1; }
667 }
668 }
669 }
670
671 if (pc>0) return true;
672 return false;
673 }
674// int x0 = (int) floor(qx);
675// int y0 = (int) floor(qy);
676// int z0 = (int) floor(qz);
677
678// int sizeW = (int)(1+2*mFreqCutoff/mDFreq);
679// int sizeWmid = sizeW/2;
680
681// for (int z = z0-mFreqCutoff; z < z0+mFreqCutoff; ++z){
682// for (int y = y0-mFreqCutoff; y < y0+mFreqCutoff; ++y){
683// for (int x = x0-mFreqCutoff; x < x0+mFreqCutoff; ++x){
684// if ( x < 0 || x >= nx ) continue;
685// if ( y < 0 || y >= ny ) continue;
686// if ( z < 0 || z >= nz ) continue;
687// float dist = (float)((x-x0)*(x-x0)+(y-y0)*(y-y0)+(z-z0)*(z-z0));
688// dist = sqrtf(dist);
689// // We enforce a spherical kernel
690// if ( dist > mFreqCutoff ) continue;
691// int idx = (int)(sizeWmid + dist/mDFreq);
692// if (idx >= sizeW) throw;
693// float residual = dist/mDFreq - (int)(dist/mDFreq);
694// if ( fabs(residual) > 1) throw;
695//
696// float factor = W[idx]*(1.0f-residual)+W[idx+1]*residual*weight;
697//
698// size_t k = z*nx*ny + y*nx + 2*x;
699//
700// // float c = Util::agauss(1, x-x0,y-y0,z-z0, EMConsts::I2G);
701// rdata[k] += fq[0]*factor;
702// rdata[k+1] += fq[1]*factor;
703//
704//
705// norm[k/2] += weight;
706//
707// }
708// }
709// }
710
711 return true;
712}
static const float I2G
Definition: emobject.h:72
EMData * data
A pointer to the constructor argument real_data.
float * norm
A pointer to the constructor argument normalize_values.
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 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

References EMAN::FourierPixelInserter3D::data, EMAN::Util::fast_exp(), EMAN::FourierPixelInserter3D::fullnx, EMAN::FourierPixelInserter3D::fullny, EMAN::FourierPixelInserter3D::fullnz, EMAN::Util::hypot3sq(), EMAN::EMConsts::I2G, EMAN::FourierPixelInserter3D::norm, EMAN::FourierPixelInserter3D::nx2, EMAN::FourierPixelInserter3D::nxyz, EMAN::FourierPixelInserter3D::ny2, EMAN::FourierPixelInserter3D::nz2, EMAN::FourierPixelInserter3D::subx0, EMAN::FourierPixelInserter3D::suby0, and EMAN::FourierPixelInserter3D::subz0.

◆ NEW()

static FourierPixelInserter3D * EMAN::FourierInserter3DMode8::NEW ( )
inlinestatic

Definition at line 429 of file reconstructor_tools.h.

430 {
431 return new FourierInserter3DMode8();
432 }

References FourierInserter3DMode8().

◆ operator=()

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

Member Data Documentation

◆ mDFreq

float EMAN::FourierInserter3DMode8::mDFreq
private

Definition at line 450 of file reconstructor_tools.h.

◆ mFreqCutoff

int EMAN::FourierInserter3DMode8::mFreqCutoff
private

Definition at line 449 of file reconstructor_tools.h.

◆ NAME

const string FourierInserter3DMode8::NAME = "experimental"
static

Definition at line 446 of file reconstructor_tools.h.

Referenced by get_name().

◆ W

float* EMAN::FourierInserter3DMode8::W
private

Definition at line 455 of file reconstructor_tools.h.

Referenced by ~FourierInserter3DMode8().


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