EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
EMAN::FourierInserter3DMode2 Class Reference

FourierPixelInserter3DMode2 - encapsulates "method 2" 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::FourierInserter3DMode2:
Inheritance graph
[legend]
Collaboration diagram for EMAN::FourierInserter3DMode2:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FourierInserter3DMode2 ()
virtual ~FourierInserter3DMode2 ()
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.
virtual string get_name () const
 Get the unique name of this class (especially for factory based instantiation access)
virtual string get_desc () const
 Get a clear, concise description of this class.
 FourierInserter3DMode2 (const FourierInserter3DMode2 &)
FourierInserter3DMode2operator= (const FourierInserter3DMode2 &)

Static Public Member Functions

static FourierPixelInserter3DNEW ()

Static Public Attributes

static const string NAME = "gauss_2"

Detailed Description

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

Definition at line 192 of file reconstructor_tools.h.


Constructor & Destructor Documentation

EMAN::FourierInserter3DMode2::FourierInserter3DMode2 ( ) [inline]

Definition at line 195 of file reconstructor_tools.h.

Referenced by NEW().

{}
virtual EMAN::FourierInserter3DMode2::~FourierInserter3DMode2 ( ) [inline, virtual]

Definition at line 196 of file reconstructor_tools.h.

{}
EMAN::FourierInserter3DMode2::FourierInserter3DMode2 ( const FourierInserter3DMode2 )

Member Function Documentation

virtual string EMAN::FourierInserter3DMode2::get_desc ( ) const [inline, virtual]

Get a clear, concise description of this class.

Returns:
a clear, concise description of this class

Implements EMAN::FactoryBase.

Definition at line 210 of file reconstructor_tools.h.

                        {
                                return "Fourier pixel insertion using interpolation and the nearest 8 voxels";
                        }
virtual string EMAN::FourierInserter3DMode2::get_name ( ) const [inline, virtual]

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 205 of file reconstructor_tools.h.

References NAME.

                        {
                                return NAME;
                        }
bool FourierInserter3DMode2::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 118 of file reconstructor_tools.cpp.

References EMAN::EMData::add_complex_at(), EMAN::EMData::add_complex_at_fast(), 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, EMAN::FourierPixelInserter3D::subz0, and weight.

{
        int x0 = (int) floor(xx);
        int y0 = (int) floor(yy);
        int z0 = (int) floor(zz);
        
        if (subx0<0) {                  // normal full reconstruction
                if (x0<-nx2-1 || y0<-ny2-1 || z0<-nz2-1 || x0>nx2 || y0>ny2 || z0>nz2 ) return false;

                // no error checking on add_complex_fast, so we need to be careful here
                int x1=x0+1;
                int y1=y0+1;
                int z1=z0+1;
                if (x0<-nx2) x0=-nx2;
                if (x1>nx2) x1=nx2;
                if (y0<-ny2) y0=-ny2;
                if (y1>ny2) y1=ny2;
                if (z0<-nz2) z0=-nz2;
                if (z1>nz2) z1=nz2;
                
//              float h=2.0/((1.0+pow(Util::hypot3sq(xx,yy,zz),.5))*EMConsts::I2G);
                float h=1.0f/EMConsts::I2G;
                //size_t idx;
                float r, gg;
//              int pc=0;
                for (int k = z0 ; k <= z1; k++) {
                        for (int j = y0 ; j <= y1; j++) {
                                for (int i = x0; i <= x1; i ++) {
                                        r = Util::hypot3sq((float) i - xx, j - yy, k - zz);
//                                      gg=weight;
                                        gg = Util::fast_exp(-r *h)*weight;
//                                      gg = Util::fast_exp(-r / EMConsts::I2G)*weight;
//                                      gg = sqrt(Util::fast_exp(-r / EMConsts::I2G))*weight;
                                        
                                        size_t off;
                                        off=data->add_complex_at_fast(i,j,k,dt*gg);
//                                      off=data->add_complex_at(i,j,k,dt*gg);
                                        norm[off/2]+=gg;
                                }
                        }
                }
                return true;
        } 
        else {                                  // for subvolumes, not optimized yet
                //size_t idx;
                float r, gg;
                int pc=0;
                for (int k = z0 ; k <= z0 + 1; k++) {
                        for (int j = y0 ; j <= y0 + 1; j++) {
                                for (int i = x0; i <= x0 + 1; i ++) {
                                        r = Util::hypot3sq((float) i - xx, j - yy, k - zz);
                                        gg = Util::fast_exp(-r / EMConsts::I2G)*weight;

                                        size_t off;
                                        if (subx0<0) off=data->add_complex_at(i,j,k,dt*gg);
                                        else off=data->add_complex_at(i,j,k,subx0,suby0,subz0,fullnx,fullny,fullnz,dt*gg);
                                        if (static_cast<int>(off)!=nxyz) { norm[off/2]+=gg; pc+=1; }
                                }
                        }
                }
                
                if (pc>0)  return true;
                return false;
        }
}
static FourierPixelInserter3D* EMAN::FourierInserter3DMode2::NEW ( ) [inline, static]

Definition at line 200 of file reconstructor_tools.h.

References FourierInserter3DMode2().

                        {
                                return new FourierInserter3DMode2();
                        }
FourierInserter3DMode2& EMAN::FourierInserter3DMode2::operator= ( const FourierInserter3DMode2 )

Member Data Documentation

const string FourierInserter3DMode2::NAME = "gauss_2" [static]

Definition at line 215 of file reconstructor_tools.h.

Referenced by get_name().


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