#include <reconstructor_tools.h>
Inheritance diagram for EMAN::FourierInserter3DMode2:
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 &) | |
FourierInserter3DMode2 & | operator= (const FourierInserter3DMode2 &) |
Static Public Member Functions | |
static FourierPixelInserter3D * | NEW () |
Static Public Attributes | |
static const string | NAME = "gauss_2" |
Definition at line 192 of file reconstructor_tools.h.
EMAN::FourierInserter3DMode2::FourierInserter3DMode2 | ( | ) | [inline] |
virtual EMAN::FourierInserter3DMode2::~FourierInserter3DMode2 | ( | ) | [inline, virtual] |
EMAN::FourierInserter3DMode2::FourierInserter3DMode2 | ( | const FourierInserter3DMode2 & | ) |
virtual string EMAN::FourierInserter3DMode2::get_desc | ( | ) | const [inline, virtual] |
Get a clear, concise description of this class.
Implements EMAN::FactoryBase.
Definition at line 210 of file reconstructor_tools.h.
00211 { 00212 return "Fourier pixel insertion using interpolation and the nearest 8 voxels"; 00213 }
virtual string EMAN::FourierInserter3DMode2::get_name | ( | ) | const [inline, virtual] |
Get the unique name of this class (especially for factory based instantiation access).
Implements EMAN::FactoryBase.
Definition at line 205 of file reconstructor_tools.h.
References NAME.
00206 { 00207 return NAME; 00208 }
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.
xx | the floating point x coordinate | |
yy | the floating point y coordinate | |
zz | the floating point z coordinate | |
dt | the complex pixel value (dt[0] is real, dt[1] is imaginary) | |
weight | the weight to given to this complex pixel |
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, and EMAN::FourierPixelInserter3D::subz0.
00119 { 00120 int x0 = (int) floor(xx); 00121 int y0 = (int) floor(yy); 00122 int z0 = (int) floor(zz); 00123 00124 if (subx0<0) { // normal full reconstruction 00125 if (x0<-nx2-1 || y0<-ny2-1 || z0<-nz2-1 || x0>nx2 || y0>ny2 || z0>nz2 ) return false; 00126 00127 // no error checking on add_complex_fast, so we need to be careful here 00128 int x1=x0+1; 00129 int y1=y0+1; 00130 int z1=z0+1; 00131 if (x0<-nx2) x0=-nx2; 00132 if (x1>nx2) x1=nx2; 00133 if (y0<-ny2) y0=-ny2; 00134 if (y1>ny2) y1=ny2; 00135 if (z0<-nz2) z0=-nz2; 00136 if (z1>nz2) z1=nz2; 00137 00138 // float h=2.0/((1.0+pow(Util::hypot3sq(xx,yy,zz),.5))*EMConsts::I2G); 00139 float h=1.0f/EMConsts::I2G; 00140 //size_t idx; 00141 float r, gg; 00142 // int pc=0; 00143 for (int k = z0 ; k <= z1; k++) { 00144 for (int j = y0 ; j <= y1; j++) { 00145 for (int i = x0; i <= x1; i ++) { 00146 r = Util::hypot3sq((float) i - xx, j - yy, k - zz); 00147 // gg=weight; 00148 gg = Util::fast_exp(-r *h)*weight; 00149 // gg = Util::fast_exp(-r / EMConsts::I2G)*weight; 00150 // gg = sqrt(Util::fast_exp(-r / EMConsts::I2G))*weight; 00151 00152 size_t off; 00153 off=data->add_complex_at_fast(i,j,k,dt*gg); 00154 // off=data->add_complex_at(i,j,k,dt*gg); 00155 norm[off/2]+=gg; 00156 } 00157 } 00158 } 00159 return true; 00160 } 00161 else { // for subvolumes, not optimized yet 00162 //size_t idx; 00163 float r, gg; 00164 int pc=0; 00165 for (int k = z0 ; k <= z0 + 1; k++) { 00166 for (int j = y0 ; j <= y0 + 1; j++) { 00167 for (int i = x0; i <= x0 + 1; i ++) { 00168 r = Util::hypot3sq((float) i - xx, j - yy, k - zz); 00169 gg = Util::fast_exp(-r / EMConsts::I2G)*weight; 00170 00171 size_t off; 00172 if (subx0<0) off=data->add_complex_at(i,j,k,dt*gg); 00173 else off=data->add_complex_at(i,j,k,subx0,suby0,subz0,fullnx,fullny,fullnz,dt*gg); 00174 if (static_cast<int>(off)!=nxyz) { norm[off/2]+=gg; pc+=1; } 00175 } 00176 } 00177 } 00178 00179 if (pc>0) return true; 00180 return false; 00181 } 00182 }
static FourierPixelInserter3D* EMAN::FourierInserter3DMode2::NEW | ( | ) | [inline, static] |
Definition at line 200 of file reconstructor_tools.h.
References FourierInserter3DMode2().
00201 { 00202 return new FourierInserter3DMode2(); 00203 }
FourierInserter3DMode2& EMAN::FourierInserter3DMode2::operator= | ( | const FourierInserter3DMode2 & | ) |
const string FourierInserter3DMode2::NAME = "gauss_2" [static] |