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

FourierPixelInserter3DMode5 - encapsulates "method 5" 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::FourierInserter3DMode5:
Inheritance graph
[legend]
Collaboration diagram for EMAN::FourierInserter3DMode5:
Collaboration graph
[legend]

Public Member Functions

 FourierInserter3DMode5 ()
 
virtual ~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 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_5"
 

Private Member Functions

 FourierInserter3DMode5 (const FourierInserter3DMode5 &)
 
FourierInserter3DMode5operator= (const FourierInserter3DMode5 &)
 

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

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

Definition at line 294 of file reconstructor_tools.h.

Constructor & Destructor Documentation

◆ FourierInserter3DMode5() [1/2]

EMAN::FourierInserter3DMode5::FourierInserter3DMode5 ( )
inline

Definition at line 297 of file reconstructor_tools.h.

298 {
299// gimx = EMAN::Interp::get_gimx();
300 }

Referenced by NEW().

◆ ~FourierInserter3DMode5()

virtual EMAN::FourierInserter3DMode5::~FourierInserter3DMode5 ( )
inlinevirtual

Definition at line 302 of file reconstructor_tools.h.

303 {
304 // Don't delete gimx it causes a seg fault
305// if ( gimx != 0 )
306// {
307// delete gimx;
308// gimx = 0;
309// }
310 }

◆ FourierInserter3DMode5() [2/2]

EMAN::FourierInserter3DMode5::FourierInserter3DMode5 ( const FourierInserter3DMode5 )
private

Member Function Documentation

◆ get_desc()

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

325 {
326 return "Fourier pixel insertion mode 5";
327 }

◆ get_name()

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

320 {
321 return NAME;
322 }

References NAME.

◆ insert_pixel()

bool FourierInserter3DMode5::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 315 of file reconstructor_tools.cpp.

316{
317 int x0 = (int) floor(xx-2.5);
318 int y0 = (int) floor(yy-2.5);
319 int z0 = (int) floor(zz-2.5);
320
321 if (subx0<0) { // normal full reconstruction
322 if (x0<-nx2-4 || y0<-ny2-4 || z0<-nz2-4 || x0>nx2+3 || y0>ny2+3 || z0>nz2+3 ) return false;
323
324 // no error checking on add_complex_fast, so we need to be careful here
325 int x1=x0+5;
326 int y1=y0+5;
327 int z1=z0+5;
328 if (x0<-nx2) x0=-nx2;
329 if (x1>nx2) x1=nx2;
330 if (y0<-ny2) y0=-ny2;
331 if (y1>ny2) y1=ny2;
332 if (z0<-nz2) z0=-nz2;
333 if (z1>nz2) z1=nz2;
334
335// float h=2.0/((1.0+pow(Util::hypot3sq(xx,yy,zz),.5))*EMConsts::I2G);
336 float h=1.0f/EMConsts::I5G;
337 float w=weight;
338
339 // Not sure exactly what this was doing? Using wider Gaussian at high radius?
340// float h=32.0f/((8.0f+Util::hypot3(xx,yy,zz))*EMConsts::I3G);
341// 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)+
342// 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)+
343// 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
344 //size_t idx;
345 float r, gg;
346// int pc=0;
347 for (int k = z0 ; k <= z1; k++) {
348 for (int j = y0 ; j <= y1; j++) {
349 for (int i = x0; i <= x1; i ++) {
350 r = Util::hypot3sq((float) i - xx, j - yy, k - zz);
351// gg=weight;
352 gg = Util::fast_exp(-r *h);
353// gg = Util::fast_exp(-r / EMConsts::I2G)*weight;
354// gg = sqrt(Util::fast_exp(-r / EMConsts::I2G))*weight;
355
356 size_t off;
357 off=data->add_complex_at_fast(i,j,k,dt*gg*w);
358 norm[off/2]+=gg*w; // This would use a Gaussian WEIGHT with square kernel
359// norm[off/2]+=w; // This would use a Gaussian KERNEL rather than WEIGHT
360
361#ifdef RECONDEBUG
362 std::complex<double> v1=dt*gg*w,v2=gg*w;
363
364 if (k<5 && j<5&& i<5&& k>=0 && j>=0 && i>=0) {
365 int idx=i*2+j*10+k*50;
366 ddata[idx]+=v1.real();
367 ddata[idx+1]+=v1.imag();
368 dnorm[idx]+=v2.real();
369 dnorm[idx+1]+=v2.imag();
370 }
371#endif
372 }
373 }
374 }
375 return true;
376 }
377 printf("region writing not supported in mode 5\n");
378 return false;
379}
static const float I5G
Definition: emobject.h:75
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::EMConsts::I5G, EMAN::FourierPixelInserter3D::norm, EMAN::FourierPixelInserter3D::nx2, EMAN::FourierPixelInserter3D::ny2, EMAN::FourierPixelInserter3D::nz2, and EMAN::FourierPixelInserter3D::subx0.

◆ NEW()

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

Definition at line 314 of file reconstructor_tools.h.

315 {
316 return new FourierInserter3DMode5();
317 }

References FourierInserter3DMode5().

◆ operator=()

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

Member Data Documentation

◆ NAME

const string FourierInserter3DMode5::NAME = "gauss_5"
static

Definition at line 329 of file reconstructor_tools.h.

Referenced by get_name().


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