#include <reconstructor.h>
Inheritance diagram for EMAN::nn4_rectReconstructor:
Public Member Functions | |
nn4_rectReconstructor () | |
nn4_rectReconstructor (const string &symmetry, int size, int npad) | |
virtual | ~nn4_rectReconstructor () |
virtual void | setup () |
Initialize the reconstructor. | |
virtual int | insert_slice (const EMData *const slice, const Transform &euler, const float weight=1.0) |
Insert an image slice to the reconstructor. | |
virtual EMData * | finish (bool doift=true) |
Finish reconstruction and return the complete model. | |
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. | |
virtual TypeDict | get_param_types () const |
void | setup (const string &symmetry, int size, int npad) |
int | insert_padfft_slice (EMData *padded, const Transform &trans, int mult=1) |
Static Public Member Functions | |
Reconstructor * | NEW () |
Static Public Attributes | |
const string | NAME = "nn4_rect" |
Private Member Functions | |
void | buildFFTVolume () |
void | buildNormVolume () |
void | load_default_settings () |
Private Attributes | |
EMData * | m_volume |
EMData * | m_wptr |
string | m_symmetry |
int | m_weighting |
int | m_vnx |
int | m_vny |
int | m_vnz |
int | m_npad |
int | m_nsym |
int | m_ndim |
int | m_vnzp |
int | m_vnyp |
int | m_vnxp |
int | m_vnzc |
int | m_vnyc |
int | m_vnxc |
int | m_count |
float | m_xratio |
float | m_yratio |
float | m_zratio |
float | m_xscale |
float | m_yscale |
int | m_sizeofprojection |
float | m_wghta |
float | m_wghtb |
float | m_osnr |
Definition at line 1035 of file reconstructor.h.
|
Definition at line 2409 of file reconstructor.cpp. References m_volume, and m_wptr.
|
|
Definition at line 2415 of file reconstructor.cpp. References load_default_settings(), m_volume, m_wptr, EMAN::Reconstructor::print_params(), and setup(). 02416 { 02417 m_volume = NULL; 02418 m_wptr = NULL; 02419 setup( symmetry, size, npad ); 02420 load_default_settings(); 02421 print_params(); 02422 }
|
|
Definition at line 2424 of file reconstructor.cpp. 02425 { 02426 //if( m_delete_volume ) checked_delete(m_volume); 02427 02428 //if( m_delete_weight ) checked_delete( m_wptr ); 02429 02430 //checked_delete( m_result ); 02431 }
|
|
Definition at line 2505 of file reconstructor.cpp. References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), m_npad, m_vnxp, m_vnyp, m_vnzp, m_volume, EMAN::EMData::set_array_offsets(), EMAN::EMData::set_attr(), EMAN::EMData::set_complex(), EMAN::EMData::set_fftodd(), EMAN::EMData::set_fftpad(), EMAN::EMData::set_nxc(), EMAN::EMData::set_ri(), EMAN::EMData::set_size(), and EMAN::EMData::to_zero(). Referenced by setup(). 02505 { 02506 int offset = 2 - m_vnxp%2; 02507 02508 m_volume = params["fftvol"]; 02509 02510 if( m_volume->get_xsize() != m_vnxp+offset && m_volume->get_ysize() != m_vnyp && m_volume->get_zsize() != m_vnzp ) { 02511 m_volume->set_size(m_vnxp+offset,m_vnyp,m_vnzp); 02512 m_volume->to_zero(); 02513 } 02514 // ---------------------------------------------------------------- 02515 // Added by Zhengfan Yang on 03/15/07 02516 // Original author: please check whether my revision is correct and 02517 // other Reconstructor need similiar revision. 02518 if ( m_vnxp % 2 == 0 ) m_volume->set_fftodd(0); 02519 else m_volume->set_fftodd(1); 02520 // ---------------------------------------------------------------- 02521 02522 m_volume->set_nxc(m_vnxp/2); 02523 m_volume->set_complex(true); 02524 m_volume->set_ri(true); 02525 m_volume->set_fftpad(true); 02526 m_volume->set_attr("npad", m_npad); 02527 m_volume->set_array_offsets(0,1,1); 02528 }
|
|
Definition at line 2530 of file reconstructor.cpp. References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), m_vnxc, m_vnyp, m_vnzp, m_wptr, EMAN::EMData::set_array_offsets(), EMAN::EMData::set_size(), and EMAN::EMData::to_zero(). Referenced by setup(). 02530 { 02531 02532 m_wptr = params["weight"]; 02533 02534 if( m_wptr->get_xsize() != m_vnxc+1 && 02535 m_wptr->get_ysize() != m_vnyp && 02536 m_wptr->get_zsize() != m_vnzp ) { 02537 m_wptr->set_size(m_vnxc+1,m_vnyp,m_vnzp); 02538 m_wptr->to_zero(); 02539 } 02540 02541 m_wptr->set_array_offsets(0,1,1); 02542 }
|
|
Finish reconstruction and return the complete model.
Reimplemented from EMAN::Reconstructor. Definition at line 2745 of file reconstructor.cpp. References abs, circumf_rect(), EMAN::EMData::depad(), EMAN::EMData::do_ift_inplace(), EMAN::EMData::get_attr(), m_ndim, m_vnyc, m_vnyp, m_volume, m_weighting, m_wghta, m_wptr, max, max2d(), max3d(), EMAN::EMData::set_array_offsets(), and EMAN::EMData::symplane0_rect(). 02746 { 02747 02748 if( m_ndim==3 ) { 02749 m_volume->symplane0_rect(m_wptr); 02750 } else { 02751 for( int i=1; i <= m_vnyp; ++i ) { 02752 02753 if( (*m_wptr)(0, i, 1)==0.0 ) { 02754 int j = m_vnyp + 1 - i; 02755 (*m_wptr)(0, i, 1) = (*m_wptr)(0, j, 1); 02756 (*m_volume)(0, i, 1) = (*m_volume)(0, j, 1); 02757 (*m_volume)(1, i, 1) = (*m_volume)(1, j, 1); 02758 } 02759 } 02760 } 02761 02762 02763 int box = 7; 02764 int kc = (box-1)/2; 02765 vector< float > pow_a( m_ndim*kc+1, 1.0 ); 02766 for( unsigned int i=1; i < pow_a.size(); ++i ) pow_a[i] = pow_a[i-1] * exp(m_wghta); 02767 pow_a.back()=0.0; 02768 02769 float alpha = 0.0; 02770 if( m_ndim==3) { 02771 int vol = box*box*box; 02772 float max = max3d( kc, pow_a ); 02773 alpha = ( 1.0f - 1.0f/(float)vol ) / max; 02774 } else { 02775 int ara = box*box; 02776 float max = max2d( kc, pow_a ); 02777 alpha = ( 1.0f - 1.0f/(float)ara ) / max; 02778 } 02779 02780 int ix,iy,iz; 02781 for (iz = 1; iz <= m_vnzp; iz++) { 02782 for (iy = 1; iy <= m_vnyp; iy++) { 02783 for (ix = 0; ix <= m_vnxc; ix++) { 02784 if ( (*m_wptr)(ix,iy,iz) > 0) {//(*v) should be treated as complex!! 02785 float tmp; 02786 tmp = (-2*((ix+iy+iz)%2)+1)/((*m_wptr)(ix,iy,iz)+m_osnr); 02787 02788 if( m_weighting == ESTIMATE ) { 02789 int cx = ix; 02790 int cy = (iy<=m_vnyc) ? iy - 1 : iy - 1 - m_vnyp; 02791 int cz = (iz<=m_vnzc) ? iz - 1 : iz - 1 - m_vnzp; 02792 float sum = 0.0; 02793 for( int ii = -kc; ii <= kc; ++ii ) { 02794 int nbrcx = cx + ii; 02795 if( nbrcx >= m_vnxc ) continue; 02796 for( int jj= -kc; jj <= kc; ++jj ) { 02797 int nbrcy = cy + jj; 02798 if( nbrcy <= -m_vnyc || nbrcy >= m_vnyc ) continue; 02799 02800 int kcz = (m_ndim==3) ? kc : 0; 02801 for( int kk = -kcz; kk <= kcz; ++kk ) { 02802 int nbrcz = cz + kk; 02803 if( nbrcz <= -m_vnyc || nbrcz >= m_vnyc ) continue; 02804 if( nbrcx < 0 ) { 02805 nbrcx = -nbrcx; 02806 nbrcy = -nbrcy; 02807 nbrcz = -nbrcz; 02808 } 02809 int nbrix = nbrcx; 02810 int nbriy = nbrcy >= 0 ? nbrcy + 1 : nbrcy + 1 + m_vnyp; 02811 int nbriz = nbrcz >= 0 ? nbrcz + 1 : nbrcz + 1 + m_vnzp; 02812 if( (*m_wptr)( nbrix, nbriy, nbriz ) == 0 ) { 02813 int c = m_ndim*kc+1 - std::abs(ii) - std::abs(jj) - std::abs(kk); 02814 sum = sum + pow_a[c]; 02815 } 02816 } 02817 } 02818 } 02819 float wght = 1.0f / ( 1.0f - alpha * sum ); 02820 tmp = tmp * wght; 02821 } 02822 (*m_volume)(2*ix,iy,iz) *= tmp; 02823 (*m_volume)(2*ix+1,iy,iz) *= tmp; 02824 } 02825 } 02826 } 02827 } 02828 02829 //if(m_ndim==2) printImage( m_volume ); 02830 02831 // back fft 02832 m_volume->do_ift_inplace(); 02833 02834 02835 int npad = m_volume->get_attr("npad"); 02836 m_volume->depad(); 02837 circumf_rect( m_volume, npad ); 02838 //circumf_rect_new( m_volume, npad,m_xratio,m_yratio); 02839 m_volume->set_array_offsets( 0, 0, 0 ); 02840 02841 return 0; 02842 }
|
|
Get a clear, concise description of this class.
Implements EMAN::FactoryBase. Definition at line 1063 of file reconstructor.h. 01064 { 01065 return "Direct Fourier inversion routine"; 01066 }
|
|
Get the unique name of this class (especially for factory based instantiation access).
Implements EMAN::FactoryBase. Definition at line 1058 of file reconstructor.h. 01059 {
01060 return NAME;
01061 }
|
|
Implements EMAN::FactoryBase. Definition at line 1073 of file reconstructor.h. References EMAN::TypeDict::put(). 01074 { 01075 TypeDict d; 01076 d.put("sizeprojection", EMObject::INT); 01077 d.put("sizex", EMObject::INT); 01078 d.put("sizey", EMObject::INT); 01079 d.put("sizez", EMObject::INT); 01080 d.put("xratio", EMObject::FLOAT); 01081 d.put("yratio", EMObject::FLOAT); 01082 d.put("zratio", EMObject::FLOAT); 01083 d.put("npad", EMObject::INT); 01084 d.put("sign", EMObject::INT); 01085 d.put("ndim", EMObject::INT); 01086 d.put("snr", EMObject::FLOAT); 01087 d.put("symmetry", EMObject::STRING); 01088 d.put("snr", EMObject::FLOAT); 01089 d.put("fftvol", EMObject::EMDATA); 01090 d.put("weight", EMObject::EMDATA); 01091 d.put("weighting", EMObject::INT); 01092 return d; 01093 }
|
|
Definition at line 2651 of file reconstructor.cpp. References Assert, EMAN::Transform::get_sym_proj(), EMAN::EMData::insert_rect_slice(), m_npad, m_sizeofprojection, m_symmetry, m_volume, m_wptr, m_xratio, m_yratio, m_zratio, mult(), and t. 02652 { 02653 Assert( padded != NULL ); 02654 02655 vector<Transform> tsym = t.get_sym_proj(m_symmetry); 02656 for (unsigned int isym=0; isym < tsym.size(); isym++) { 02657 m_volume->insert_rect_slice(m_wptr, padded, tsym[isym], m_sizeofprojection, m_xratio, m_yratio, m_zratio, m_npad, mult); 02658 } 02659 02660 02661 return 0; 02662 02663 }
|
|
Insert an image slice to the reconstructor. To insert multiple image slices, call this function multiple times.
Reimplemented from EMAN::Reconstructor. |
|
Definition at line 1121 of file reconstructor.h. Referenced by nn4_rectReconstructor(). 01122 {
01123 //params["use_weights"] = false;
01124 }
|
|
Definition at line 1068 of file reconstructor.h. 01069 { 01070 return new nn4_rectReconstructor(); 01071 }
|
|
Definition at line 2453 of file reconstructor.cpp. References buildFFTVolume(), buildNormVolume(), EMAN::Transform::get_nsym(), EMAN::Dict::has_key(), m_ndim, m_npad, m_nsym, m_symmetry, m_vnx, m_vnxc, m_vnxp, m_vny, m_vnyc, m_vnyp, m_vnz, m_vnzc, m_vnzp, m_weighting, m_wghta, m_xratio, m_yratio, and m_zratio. 02454 { 02455 m_weighting = ESTIMATE; 02456 m_wghta = 0.2f; 02457 m_symmetry = symmetry; 02458 m_npad = npad; 02459 m_nsym = Transform::get_nsym(m_symmetry); 02460 02461 if( params.has_key("sizex") ) m_vnx = params["sizex"]; 02462 else if(params.has_key("xratio")) 02463 { 02464 float temp=params["xratio"]; 02465 m_vnx=int(float(sizeprojection)*temp); 02466 } 02467 else m_vnx=sizeprojection; 02468 02469 if( params.has_key("sizey") ) m_vny = params["sizey"]; 02470 else if (params.has_key("yratio")) 02471 { 02472 float temp=params["yratio"]; 02473 m_vny=int(float(sizeprojection)*temp); 02474 } 02475 else m_vny=sizeprojection; 02476 02477 if( params.has_key("sizez") ) 02478 m_vnz = params["sizez"]; 02479 else 02480 if (params.has_key("zratio")) 02481 { 02482 float temp=params["zratio"]; 02483 m_vnz=int(float(sizeprojection)*temp); 02484 } 02485 else 02486 m_vnz = (m_ndim==3) ? sizeprojection : 1; 02487 02488 m_xratio=float(m_vnx)/float(sizeprojection); 02489 m_yratio=float(m_vny)/float(sizeprojection); 02490 m_zratio=float(m_vnz)/float(sizeprojection); 02491 02492 m_vnxp = m_vnx*npad; 02493 m_vnyp = m_vny*npad; 02494 m_vnzp = (m_ndim==3) ? m_vnz*npad : 1; 02495 02496 m_vnxc = m_vnxp/2; 02497 m_vnyc = m_vnyp/2; 02498 m_vnzc = (m_ndim==3) ? m_vnzp/2 : 1; 02499 02500 buildFFTVolume(); 02501 buildNormVolume(); 02502 }
|
|
Initialize the reconstructor.
Implements EMAN::Reconstructor. Definition at line 2434 of file reconstructor.cpp. References EMAN::Dict::has_key(), m_count, m_ndim, m_osnr, and m_sizeofprojection. Referenced by nn4_rectReconstructor(). 02435 { 02436 m_sizeofprojection = params["sizeprojection"]; 02437 int npad = params["npad"]; 02438 m_count=0; 02439 02440 string symmetry; 02441 if( params.has_key("symmetry") ) symmetry = params["symmetry"].to_str(); 02442 else symmetry = "c1"; 02443 02444 if( params.has_key("ndim") ) m_ndim = params["ndim"]; 02445 else m_ndim = 3; 02446 02447 if( params.has_key( "snr" ) ) m_osnr = 1.0f/float( params["snr"] ); 02448 else m_osnr = 0.0; 02449 02450 setup( symmetry, m_sizeofprojection, npad ); 02451 }
|
|
Definition at line 1112 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 1109 of file reconstructor.h. |
|
Definition at line 1107 of file reconstructor.h. Referenced by buildFFTVolume(), insert_padfft_slice(), and setup(). |
|
Definition at line 1108 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 1120 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 1115 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 1104 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 1106 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 1111 of file reconstructor.h. Referenced by buildNormVolume(), and setup(). |
|
Definition at line 1110 of file reconstructor.h. Referenced by buildFFTVolume(), and setup(). |
|
Definition at line 1106 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 1111 of file reconstructor.h. |
|
Definition at line 1110 of file reconstructor.h. Referenced by buildFFTVolume(), buildNormVolume(), finish(), and setup(). |
|
Definition at line 1106 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 1111 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 1110 of file reconstructor.h. Referenced by buildFFTVolume(), buildNormVolume(), and setup(). |
|
Definition at line 1102 of file reconstructor.h. Referenced by buildFFTVolume(), finish(), insert_padfft_slice(), and nn4_rectReconstructor(). |
|
Definition at line 1105 of file reconstructor.h. |
|
Definition at line 1118 of file reconstructor.h. |
|
Definition at line 1119 of file reconstructor.h. |
|
Definition at line 1103 of file reconstructor.h. Referenced by buildNormVolume(), finish(), insert_padfft_slice(), and nn4_rectReconstructor(). |
|
Definition at line 1113 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 1114 of file reconstructor.h. |
|
Definition at line 1113 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 1114 of file reconstructor.h. |
|
Definition at line 1113 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 83 of file reconstructor.cpp. |