#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 |
EMData * | m_result |
bool | m_delete_volume |
bool | m_delete_weight |
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 821 of file reconstructor.h.
|
Definition at line 2399 of file reconstructor.cpp. References m_result, m_volume, and m_wptr.
|
|
Definition at line 2406 of file reconstructor.cpp. References load_default_settings(), m_result, m_volume, m_wptr, EMAN::Reconstructor::print_params(), and setup(). 02407 { 02408 m_volume = NULL; 02409 m_wptr = NULL; 02410 m_result = NULL; 02411 setup( symmetry, size, npad ); 02412 load_default_settings(); 02413 print_params(); 02414 }
|
|
Definition at line 2416 of file reconstructor.cpp. References checked_delete(), m_result, m_volume, and m_wptr. 02417 { 02418 if( m_delete_volume ) checked_delete(m_volume); 02419 02420 if( m_delete_weight ) checked_delete( m_wptr ); 02421 02422 checked_delete( m_result ); 02423 }
|
|
Definition at line 2496 of file reconstructor.cpp. References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::Dict::has_key(), m_delete_volume, 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(). 02496 { 02497 int offset = 2 - m_vnxp%2; 02498 02499 if( params.has_key("fftvol") ) { 02500 m_volume = params["fftvol"]; 02501 m_delete_volume = false; 02502 } else { 02503 m_volume = new EMData(); 02504 m_delete_volume = true; 02505 } 02506 02507 if( m_volume->get_xsize() != m_vnxp+offset && m_volume->get_ysize() != m_vnyp && m_volume->get_zsize() != m_vnzp ) { 02508 m_volume->set_size(m_vnxp+offset,m_vnyp,m_vnzp); 02509 m_volume->to_zero(); 02510 } 02511 // ---------------------------------------------------------------- 02512 // Added by Zhengfan Yang on 03/15/07 02513 // Original author: please check whether my revision is correct and 02514 // other Reconstructor need similiar revision. 02515 if ( m_vnxp % 2 == 0 ) m_volume->set_fftodd(0); 02516 else m_volume->set_fftodd(1); 02517 // ---------------------------------------------------------------- 02518 02519 m_volume->set_nxc(m_vnxp/2); 02520 m_volume->set_complex(true); 02521 m_volume->set_ri(true); 02522 m_volume->set_fftpad(true); 02523 m_volume->set_attr("npad", m_npad); 02524 m_volume->set_array_offsets(0,1,1); 02525 }
|
|
Definition at line 2527 of file reconstructor.cpp. References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::Dict::has_key(), m_delete_weight, 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(). 02527 { 02528 02529 if( params.has_key("weight") ) { 02530 m_wptr = params["weight"]; 02531 m_delete_weight = false; 02532 } else { 02533 m_wptr = new EMData(); 02534 m_delete_weight = true; 02535 } 02536 02537 if( m_wptr->get_xsize() != m_vnxc+1 && 02538 m_wptr->get_ysize() != m_vnyp && 02539 m_wptr->get_zsize() != m_vnzp ) { 02540 m_wptr->set_size(m_vnxc+1,m_vnyp,m_vnzp); 02541 m_wptr->to_zero(); 02542 } 02543 02544 m_wptr->set_array_offsets(0,1,1); 02545 }
|
|
Finish reconstruction and return the complete model.
Reimplemented from EMAN::Reconstructor. Definition at line 2752 of file reconstructor.cpp. References abs, circumf_rect(), EMAN::EMData::copy(), EMAN::EMData::depad(), EMAN::EMData::do_ift_inplace(), EMAN::EMData::get_attr(), m_ndim, m_result, 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(). 02753 { 02754 02755 if( m_ndim==3 ) { 02756 m_volume->symplane0_rect(m_wptr); 02757 } else { 02758 for( int i=1; i <= m_vnyp; ++i ) { 02759 02760 if( (*m_wptr)(0, i, 1)==0.0 ) { 02761 int j = m_vnyp + 1 - i; 02762 (*m_wptr)(0, i, 1) = (*m_wptr)(0, j, 1); 02763 (*m_volume)(0, i, 1) = (*m_volume)(0, j, 1); 02764 (*m_volume)(1, i, 1) = (*m_volume)(1, j, 1); 02765 } 02766 } 02767 } 02768 02769 02770 int box = 7; 02771 int kc = (box-1)/2; 02772 vector< float > pow_a( m_ndim*kc+1, 1.0 ); 02773 for( unsigned int i=1; i < pow_a.size(); ++i ) pow_a[i] = pow_a[i-1] * exp(m_wghta); 02774 pow_a.back()=0.0; 02775 02776 float alpha = 0.0; 02777 if( m_ndim==3) { 02778 int vol = box*box*box; 02779 float max = max3d( kc, pow_a ); 02780 alpha = ( 1.0f - 1.0f/(float)vol ) / max; 02781 } else { 02782 int ara = box*box; 02783 float max = max2d( kc, pow_a ); 02784 alpha = ( 1.0f - 1.0f/(float)ara ) / max; 02785 } 02786 02787 int ix,iy,iz; 02788 for (iz = 1; iz <= m_vnzp; iz++) { 02789 for (iy = 1; iy <= m_vnyp; iy++) { 02790 for (ix = 0; ix <= m_vnxc; ix++) { 02791 if ( (*m_wptr)(ix,iy,iz) > 0) {//(*v) should be treated as complex!! 02792 float tmp; 02793 tmp = (-2*((ix+iy+iz)%2)+1)/((*m_wptr)(ix,iy,iz)+m_osnr); 02794 02795 if( m_weighting == ESTIMATE ) { 02796 int cx = ix; 02797 int cy = (iy<=m_vnyc) ? iy - 1 : iy - 1 - m_vnyp; 02798 int cz = (iz<=m_vnzc) ? iz - 1 : iz - 1 - m_vnzp; 02799 float sum = 0.0; 02800 for( int ii = -kc; ii <= kc; ++ii ) { 02801 int nbrcx = cx + ii; 02802 if( nbrcx >= m_vnxc ) continue; 02803 for( int jj= -kc; jj <= kc; ++jj ) { 02804 int nbrcy = cy + jj; 02805 if( nbrcy <= -m_vnyc || nbrcy >= m_vnyc ) continue; 02806 02807 int kcz = (m_ndim==3) ? kc : 0; 02808 for( int kk = -kcz; kk <= kcz; ++kk ) { 02809 int nbrcz = cz + kk; 02810 if( nbrcz <= -m_vnyc || nbrcz >= m_vnyc ) continue; 02811 if( nbrcx < 0 ) { 02812 nbrcx = -nbrcx; 02813 nbrcy = -nbrcy; 02814 nbrcz = -nbrcz; 02815 } 02816 int nbrix = nbrcx; 02817 int nbriy = nbrcy >= 0 ? nbrcy + 1 : nbrcy + 1 + m_vnyp; 02818 int nbriz = nbrcz >= 0 ? nbrcz + 1 : nbrcz + 1 + m_vnzp; 02819 if( (*m_wptr)( nbrix, nbriy, nbriz ) == 0 ) { 02820 int c = m_ndim*kc+1 - std::abs(ii) - std::abs(jj) - std::abs(kk); 02821 sum = sum + pow_a[c]; 02822 } 02823 } 02824 } 02825 } 02826 float wght = 1.0f / ( 1.0f - alpha * sum ); 02827 tmp = tmp * wght; 02828 } 02829 (*m_volume)(2*ix,iy,iz) *= tmp; 02830 (*m_volume)(2*ix+1,iy,iz) *= tmp; 02831 } 02832 } 02833 } 02834 } 02835 02836 //if(m_ndim==2) printImage( m_volume ); 02837 02838 // back fft 02839 m_volume->do_ift_inplace(); 02840 02841 02842 int npad = m_volume->get_attr("npad"); 02843 m_volume->depad(); 02844 circumf_rect( m_volume, npad ); 02845 //circumf_rect_new( m_volume, npad,m_xratio,m_yratio); 02846 m_volume->set_array_offsets( 0, 0, 0 ); 02847 02848 m_result = m_volume->copy(); 02849 return m_result; 02850 }
|
|
Get a clear, concise description of this class.
Implements EMAN::FactoryBase. Definition at line 849 of file reconstructor.h. 00850 { 00851 return "Direct Fourier inversion routine"; 00852 }
|
|
Get the unique name of this class (especially for factory based instantiation access).
Implements EMAN::FactoryBase. Definition at line 844 of file reconstructor.h. 00845 {
00846 return NAME;
00847 }
|
|
Implements EMAN::FactoryBase. Definition at line 859 of file reconstructor.h. References EMAN::TypeDict::put(). 00860 { 00861 TypeDict d; 00862 d.put("sizeprojection", EMObject::INT); 00863 d.put("sizex", EMObject::INT); 00864 d.put("sizey", EMObject::INT); 00865 d.put("sizez", EMObject::INT); 00866 d.put("xratio", EMObject::FLOAT); 00867 d.put("yratio", EMObject::FLOAT); 00868 d.put("npad", EMObject::INT); 00869 d.put("sign", EMObject::INT); 00870 d.put("ndim", EMObject::INT); 00871 d.put("snr", EMObject::FLOAT); 00872 d.put("symmetry", EMObject::STRING); 00873 d.put("snr", EMObject::FLOAT); 00874 d.put("fftvol", EMObject::EMDATA); 00875 d.put("weight", EMObject::EMDATA); 00876 d.put("weighting", EMObject::INT); 00877 return d; 00878 }
|
|
Definition at line 2656 of file reconstructor.cpp. References Assert, EMAN::Transform::get_sym(), EMAN::EMData::insert_rect_slice(), m_npad, m_sizeofprojection, m_symmetry, m_volume, m_wptr, m_xratio, m_yratio, mult(), and t. 02657 { 02658 Assert( padded != NULL ); 02659 02660 02661 for( int isym=0; isym < m_nsym; isym++) { 02662 Transform tsym = t.get_sym( m_symmetry, isym ); 02663 m_volume->insert_rect_slice(m_wptr, padded, t, m_sizeofprojection, m_xratio, m_yratio, m_npad, mult); 02664 } 02665 02666 return 0; 02667 02668 }
|
|
Insert an image slice to the reconstructor. To insert multiple image slices, call this function multiple times.
Reimplemented from EMAN::Reconstructor. |
|
Definition at line 909 of file reconstructor.h. Referenced by nn4_rectReconstructor(). 00910 {
00911 //params["use_weights"] = false;
00912 }
|
|
Definition at line 854 of file reconstructor.h. 00855 { 00856 return new nn4_rectReconstructor(); 00857 }
|
|
Definition at line 2445 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, and m_yratio. 02446 { 02447 m_weighting = ESTIMATE; 02448 m_wghta = 0.2f; 02449 m_symmetry = symmetry; 02450 m_npad = npad; 02451 m_nsym = Transform::get_nsym(m_symmetry); 02452 02453 if( params.has_key("sizex") ) m_vnx = params["sizex"]; 02454 else if(params.has_key("xratio")) 02455 { 02456 float temp=params["xratio"]; 02457 m_vnx=int(float(sizeprojection)*temp); 02458 } 02459 else m_vnx=sizeprojection; 02460 02461 if( params.has_key("sizey") ) m_vny = params["sizey"]; 02462 else if (params.has_key("yratio")) 02463 { 02464 float temp=params["yratio"]; 02465 m_vny=int(float(sizeprojection)*temp); 02466 } 02467 else m_vny=sizeprojection; 02468 02469 if( params.has_key("sizez") ) 02470 m_vnz = params["sizez"]; 02471 else 02472 m_vnz = (m_ndim==3) ? sizeprojection : 1; 02473 02474 m_xratio=float(m_vnx)/float(sizeprojection); 02475 m_yratio=float(m_vny)/float(sizeprojection); 02476 02477 //std::cout<<"dim==="<<m_ndim<<"xratio=="<<m_xratio<<"yratio=="<<m_yratio<<std::endl; 02478 //std::cout<<"sx=="<<m_vnx<<"sy=="<<m_vny<<"sz=="<<m_vnz<<std::endl; 02479 02480 02481 m_vnxp = m_vnx*npad; 02482 m_vnyp = m_vny*npad; 02483 m_vnzp = (m_ndim==3) ? m_vnz*npad : 1; 02484 02485 m_vnxc = m_vnxp/2; 02486 m_vnyc = m_vnyp/2; 02487 m_vnzc = (m_ndim==3) ? m_vnzp/2 : 1; 02488 02489 buildFFTVolume(); 02490 buildNormVolume(); 02491 02492 02493 }
|
|
Initialize the reconstructor.
Implements EMAN::Reconstructor. Definition at line 2426 of file reconstructor.cpp. References EMAN::Dict::has_key(), m_count, m_ndim, m_osnr, and m_sizeofprojection. Referenced by nn4_rectReconstructor(). 02427 { 02428 m_sizeofprojection = params["sizeprojection"]; 02429 int npad = params["npad"]; 02430 m_count=0; 02431 02432 string symmetry; 02433 if( params.has_key("symmetry") ) symmetry = params["symmetry"].to_str(); 02434 else symmetry = "c1"; 02435 02436 if( params.has_key("ndim") ) m_ndim = params["ndim"]; 02437 else m_ndim = 3; 02438 02439 if( params.has_key( "snr" ) ) m_osnr = 1.0f/float( params["snr"] ); 02440 else m_osnr = 0.0; 02441 02442 setup( symmetry, m_sizeofprojection, npad ); 02443 }
|
|
Definition at line 900 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 890 of file reconstructor.h. Referenced by buildFFTVolume(). |
|
Definition at line 891 of file reconstructor.h. Referenced by buildNormVolume(). |
|
Definition at line 897 of file reconstructor.h. |
|
Definition at line 895 of file reconstructor.h. Referenced by buildFFTVolume(), insert_padfft_slice(), and setup(). |
|
Definition at line 896 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 908 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 889 of file reconstructor.h. Referenced by finish(), nn4_rectReconstructor(), and ~nn4_rectReconstructor(). |
|
Definition at line 903 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 892 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 894 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 899 of file reconstructor.h. Referenced by buildNormVolume(), and setup(). |
|
Definition at line 898 of file reconstructor.h. Referenced by buildFFTVolume(), and setup(). |
|
Definition at line 894 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 899 of file reconstructor.h. |
|
Definition at line 898 of file reconstructor.h. Referenced by buildFFTVolume(), buildNormVolume(), finish(), and setup(). |
|
Definition at line 894 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 899 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 898 of file reconstructor.h. Referenced by buildFFTVolume(), buildNormVolume(), and setup(). |
|
Definition at line 887 of file reconstructor.h. Referenced by buildFFTVolume(), finish(), insert_padfft_slice(), nn4_rectReconstructor(), and ~nn4_rectReconstructor(). |
|
Definition at line 893 of file reconstructor.h. |
|
Definition at line 906 of file reconstructor.h. |
|
Definition at line 907 of file reconstructor.h. |
|
Definition at line 888 of file reconstructor.h. Referenced by buildNormVolume(), finish(), insert_padfft_slice(), nn4_rectReconstructor(), and ~nn4_rectReconstructor(). |
|
Definition at line 901 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 902 of file reconstructor.h. |
|
Definition at line 901 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 902 of file reconstructor.h. |
|
Definition at line 901 of file reconstructor.h. |
|
Definition at line 82 of file reconstructor.cpp. |