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

FourierPixelInserter3DMode6 - encapsulates "method 6" 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::FourierInserter3DMode6:
Inheritance graph
[legend]
Collaboration diagram for EMAN::FourierInserter3DMode6:
Collaboration graph
[legend]

Public Member Functions

 FourierInserter3DMode6 ()
 
virtual ~FourierInserter3DMode6 ()
 
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...
 
- Public Member Functions inherited from EMAN::FourierPixelInserter3D
 FourierPixelInserter3D ()
 Construct a FourierPixelInserter3D. More...
 
virtual ~FourierPixelInserter3D ()
 Desctruct a FourierPixelInserter3D. More...
 
TypeDict get_param_types () const
 
virtual void init ()
 
- 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 = "gauss_var"
 

Private Member Functions

 FourierInserter3DMode6 (const FourierInserter3DMode6 &)
 
FourierInserter3DMode6operator= (const FourierInserter3DMode6 &)
 

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

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

Definition at line 342 of file reconstructor_tools.h.

Constructor & Destructor Documentation

◆ FourierInserter3DMode6() [1/2]

EMAN::FourierInserter3DMode6::FourierInserter3DMode6 ( )
inline

Definition at line 345 of file reconstructor_tools.h.

345{}

Referenced by NEW().

◆ ~FourierInserter3DMode6()

virtual EMAN::FourierInserter3DMode6::~FourierInserter3DMode6 ( )
inlinevirtual

Definition at line 346 of file reconstructor_tools.h.

346{}

◆ FourierInserter3DMode6() [2/2]

EMAN::FourierInserter3DMode6::FourierInserter3DMode6 ( const FourierInserter3DMode6 )
private

Member Function Documentation

◆ get_desc()

virtual string EMAN::FourierInserter3DMode6::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 360 of file reconstructor_tools.h.

361 {
362 return "More exact version of gauss_5";
363 }

◆ get_name()

virtual string EMAN::FourierInserter3DMode6::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 355 of file reconstructor_tools.h.

356 {
357 return NAME;
358 }

References NAME.

◆ insert_pixel()

bool FourierInserter3DMode6::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 382 of file reconstructor_tools.cpp.

383{
384 int x0 = (int) floor(xx-2.5);
385 int y0 = (int) floor(yy-2.5);
386 int z0 = (int) floor(zz-2.5);
387
388 if (subx0<0) { // normal full reconstruction
389 if (x0<-nx2-4 || y0<-ny2-4 || z0<-nz2-4 || x0>nx2+3 || y0>ny2+3 || z0>nz2+3 ) return false;
390
391 // no error checking on add_complex_fast, so we need to be careful here
392 int x1=x0+5;
393 int y1=y0+5;
394 int z1=z0+5;
395 if (x0<-nx2) x0=-nx2;
396 if (x1>nx2) x1=nx2;
397 if (y0<-ny2) y0=-ny2;
398 if (y1>ny2) y1=ny2;
399 if (z0<-nz2) z0=-nz2;
400 if (z1>nz2) z1=nz2;
401
402// float h=2.0/((1.0+pow(Util::hypot3sq(xx,yy,zz),.5))*EMConsts::I2G);
403// float h=1.0f/EMConsts::I5G;
404// float h=1.0f/(Util::hypot3sq(xx/nx2,yy/ny2,zz/nz2)*EMConsts::I5G*2.0+.1); // 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
405 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
406 h=h<0.1?0.1:h; // new formula has h from 0.2 to 5
407// if (yy==0 &&zz==0) printf("%0.0f\t%0.0f\t%0.0f\t%g\n",xx,yy,zz,h);
408// printf("%1.0f\t%1.0f\t%1.0f\t%1.4f\n",xx,yy,zz,h);
409 float w=weight;
410
411// float h=32.0f/((8.0f+Util::hypot3(xx,yy,zz))*EMConsts::I3G);
412// float w=weight/(1.0f+6.0f*Util::fast_exp(-h)+12*Util::fast_exp(-h*2.0f)+8*Util::fast_exp(-h*3.0f)+
413// 6.0f*Util::fast_exp(-h*4.0f)+24.0f*Util::fast_exp(-h*5.0f)+24.0f*Util::fast_exp(-h*6.0f)+12.0f*Util::fast_exp(-h*8.0f)+
414// 24.0f*Util::fast_exp(-h*9.0f)+8.0f*Util::fast_exp(-h*12.0f)); // approx normalization so higer radii aren't upweighted relative to lower due to wider Gaussian
415 //size_t idx;
416 float r, gg;
417// int pc=0;
418 for (int k = z0 ; k <= z1; k++) {
419 for (int j = y0 ; j <= y1; j++) {
420 for (int i = x0; i <= x1; i ++) {
421 r = Util::hypot3sq((float) i - xx, j - yy, k - zz);
422// gg=weight;
423 gg = Util::fast_exp(-r *h);
424// if (gg<.00001) continue; // skip tiny weights for speed
425// gg = Util::fast_exp(-r / EMConsts::I2G)*weight;
426// gg = sqrt(Util::fast_exp(-r / EMConsts::I2G))*weight;
427
428 size_t off;
429 off=data->add_complex_at_fast(i,j,k,dt*gg*w);
430// if (i==16 && j==7 && k==4) printf("%g\t%g\t%g\t%g\t%g\n",dt.real(),dt.imag(),gg*w,gg,w);
431 norm[off/2]+=gg*w; // This would use a Gaussian WEIGHT with square kernel
432// norm[off/2]+=w; // This would use a Gaussian KERNEL rather than WEIGHT
433
434#ifdef RECONDEBUG
435 std::complex<double> v1=dt*gg*w,v2=gg*w;
436
437 if (k<5 && j<5&& i<5&& k>=0 && j>=0 && i>=0) {
438 int idx=i*2+j*10+k*50;
439 ddata[idx]+=v1.real();
440 ddata[idx+1]+=v1.imag();
441 dnorm[idx]+=v2.real();
442 dnorm[idx+1]+=v2.imag();
443 }
444#endif
445 }
446 }
447 }
448 return true;
449 }
450 printf("region writing not supported in mode 5\n");
451 return false;
452}
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::Util::hypot3sq(), EMAN::FourierPixelInserter3D::norm, EMAN::FourierPixelInserter3D::nx2, EMAN::FourierPixelInserter3D::ny2, EMAN::FourierPixelInserter3D::nz2, and EMAN::FourierPixelInserter3D::subx0.

◆ NEW()

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

Definition at line 350 of file reconstructor_tools.h.

351 {
352 return new FourierInserter3DMode6();
353 }

References FourierInserter3DMode6().

◆ operator=()

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

Member Data Documentation

◆ NAME

const string FourierInserter3DMode6::NAME = "gauss_var"
static

Definition at line 365 of file reconstructor_tools.h.

Referenced by get_name().


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