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

FourierPixelInserter3DMode3 - encapsulates "method 3" 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::FourierInserter3DMode3:
Inheritance graph
[legend]
Collaboration diagram for EMAN::FourierInserter3DMode3:
Collaboration graph
[legend]

Public Member Functions

 FourierInserter3DMode3 ()
 
virtual ~FourierInserter3DMode3 ()
 
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_3"
 

Private Member Functions

 FourierInserter3DMode3 (const FourierInserter3DMode3 &)
 
FourierInserter3DMode3operator= (const FourierInserter3DMode3 &)
 

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

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

Definition at line 260 of file reconstructor_tools.h.

Constructor & Destructor Documentation

◆ FourierInserter3DMode3() [1/2]

EMAN::FourierInserter3DMode3::FourierInserter3DMode3 ( )
inline

Definition at line 263 of file reconstructor_tools.h.

263{}

Referenced by NEW().

◆ ~FourierInserter3DMode3()

virtual EMAN::FourierInserter3DMode3::~FourierInserter3DMode3 ( )
inlinevirtual

Definition at line 264 of file reconstructor_tools.h.

264{}

◆ FourierInserter3DMode3() [2/2]

EMAN::FourierInserter3DMode3::FourierInserter3DMode3 ( const FourierInserter3DMode3 )
private

Member Function Documentation

◆ get_desc()

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

279 {
280 return "Fourier pixel insertion using a 3x3x3 Gaussian kernel";
281 }

◆ get_name()

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

274 {
275 return NAME;
276 }

References NAME.

◆ insert_pixel()

bool FourierInserter3DMode3::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 265 of file reconstructor_tools.cpp.

266{
267 int x0 = (int) floor(xx-.5);
268 int y0 = (int) floor(yy-.5);
269 int z0 = (int) floor(zz-.5);
270
271 if (subx0<0) { // normal full reconstruction
272 if (x0<-nx2-2 || y0<-ny2-2 || z0<-nz2-2 || x0>nx2+1 || y0>ny2+1 || z0>nz2+1 ) return false;
273
274 // no error checking on add_complex_fast, so we need to be careful here
275 int x1=x0+2;
276 int y1=y0+2;
277 int z1=z0+2;
278 if (x0<-nx2) x0=-nx2;
279 if (x1>nx2) x1=nx2;
280 if (y0<-ny2) y0=-ny2;
281 if (y1>ny2) y1=ny2;
282 if (z0<-nz2) z0=-nz2;
283 if (z1>nz2) z1=nz2;
284
285// float h=2.0/((1.0+pow(Util::hypot3sq(xx,yy,zz),.5))*EMConsts::I2G);
286// float h=2.0/EMConsts::I3G;
287 float h=32.0f/((8.0f+Util::hypot3(xx,yy,zz))*EMConsts::I3G);
288// float w=weight;
289 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)); // approx normalization so higer radii aren't upweighted relative to lower due to wider Gaussian
290 //size_t idx;
291 float r, gg;
292// int pc=0;
293 for (int k = z0 ; k <= z1; k++) {
294 for (int j = y0 ; j <= y1; j++) {
295 for (int i = x0; i <= x1; i ++) {
296 r = Util::hypot3sq((float) i - xx, (float)j - yy, (float)k - zz);
297// gg=weight;
298 gg = Util::fast_exp(-r *h)*w;
299// gg = Util::fast_exp(-r / EMConsts::I2G)*weight;
300// gg = sqrt(Util::fast_exp(-r / EMConsts::I2G))*weight;
301
302 size_t off;
303 off=data->add_complex_at_fast(i,j,k,dt*gg);
304 norm[off/2]+=gg;
305 }
306 }
307 }
308 return true;
309 }
310 printf("region writing not supported in mode 3\n");
311 return false;
312}
static const float I3G
Definition: emobject.h:73
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 hypot3(int x, int y, int z)
Euclidean distance function in 3D: f(x,y,z) = sqrt(x*x + y*y + z*z);.
Definition: util.h:827
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::hypot3(), EMAN::Util::hypot3sq(), EMAN::EMConsts::I3G, EMAN::FourierPixelInserter3D::norm, EMAN::FourierPixelInserter3D::nx2, EMAN::FourierPixelInserter3D::ny2, EMAN::FourierPixelInserter3D::nz2, and EMAN::FourierPixelInserter3D::subx0.

◆ NEW()

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

Definition at line 268 of file reconstructor_tools.h.

269 {
270 return new FourierInserter3DMode3();
271 }

References FourierInserter3DMode3().

◆ operator=()

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

Member Data Documentation

◆ NAME

const string FourierInserter3DMode3::NAME = "gauss_3"
static

Definition at line 283 of file reconstructor_tools.h.

Referenced by get_name().


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