#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 819 of file reconstructor.h.
|
Definition at line 2393 of file reconstructor.cpp. References m_volume, and m_wptr.
|
|
Definition at line 2399 of file reconstructor.cpp. References load_default_settings(), m_volume, m_wptr, EMAN::Reconstructor::print_params(), and setup(). 02400 { 02401 m_volume = NULL; 02402 m_wptr = NULL; 02403 setup( symmetry, size, npad ); 02404 load_default_settings(); 02405 print_params(); 02406 }
|
|
Definition at line 2408 of file reconstructor.cpp. 02409 { 02410 //if( m_delete_volume ) checked_delete(m_volume); 02411 02412 //if( m_delete_weight ) checked_delete( m_wptr ); 02413 02414 //checked_delete( m_result ); 02415 }
|
|
Definition at line 2482 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(). 02482 { 02483 int offset = 2 - m_vnxp%2; 02484 02485 m_volume = params["fftvol"]; 02486 02487 if( m_volume->get_xsize() != m_vnxp+offset && m_volume->get_ysize() != m_vnyp && m_volume->get_zsize() != m_vnzp ) { 02488 m_volume->set_size(m_vnxp+offset,m_vnyp,m_vnzp); 02489 m_volume->to_zero(); 02490 } 02491 // ---------------------------------------------------------------- 02492 // Added by Zhengfan Yang on 03/15/07 02493 // Original author: please check whether my revision is correct and 02494 // other Reconstructor need similiar revision. 02495 if ( m_vnxp % 2 == 0 ) m_volume->set_fftodd(0); 02496 else m_volume->set_fftodd(1); 02497 // ---------------------------------------------------------------- 02498 02499 m_volume->set_nxc(m_vnxp/2); 02500 m_volume->set_complex(true); 02501 m_volume->set_ri(true); 02502 m_volume->set_fftpad(true); 02503 m_volume->set_attr("npad", m_npad); 02504 m_volume->set_array_offsets(0,1,1); 02505 }
|
|
Definition at line 2507 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(). 02507 { 02508 02509 m_wptr = params["weight"]; 02510 02511 if( m_wptr->get_xsize() != m_vnxc+1 && 02512 m_wptr->get_ysize() != m_vnyp && 02513 m_wptr->get_zsize() != m_vnzp ) { 02514 m_wptr->set_size(m_vnxc+1,m_vnyp,m_vnzp); 02515 m_wptr->to_zero(); 02516 } 02517 02518 m_wptr->set_array_offsets(0,1,1); 02519 }
|
|
Finish reconstruction and return the complete model.
Reimplemented from EMAN::Reconstructor. Definition at line 2722 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(). 02723 { 02724 02725 if( m_ndim==3 ) { 02726 m_volume->symplane0_rect(m_wptr); 02727 } else { 02728 for( int i=1; i <= m_vnyp; ++i ) { 02729 02730 if( (*m_wptr)(0, i, 1)==0.0 ) { 02731 int j = m_vnyp + 1 - i; 02732 (*m_wptr)(0, i, 1) = (*m_wptr)(0, j, 1); 02733 (*m_volume)(0, i, 1) = (*m_volume)(0, j, 1); 02734 (*m_volume)(1, i, 1) = (*m_volume)(1, j, 1); 02735 } 02736 } 02737 } 02738 02739 02740 int box = 7; 02741 int kc = (box-1)/2; 02742 vector< float > pow_a( m_ndim*kc+1, 1.0 ); 02743 for( unsigned int i=1; i < pow_a.size(); ++i ) pow_a[i] = pow_a[i-1] * exp(m_wghta); 02744 pow_a.back()=0.0; 02745 02746 float alpha = 0.0; 02747 if( m_ndim==3) { 02748 int vol = box*box*box; 02749 float max = max3d( kc, pow_a ); 02750 alpha = ( 1.0f - 1.0f/(float)vol ) / max; 02751 } else { 02752 int ara = box*box; 02753 float max = max2d( kc, pow_a ); 02754 alpha = ( 1.0f - 1.0f/(float)ara ) / max; 02755 } 02756 02757 int ix,iy,iz; 02758 for (iz = 1; iz <= m_vnzp; iz++) { 02759 for (iy = 1; iy <= m_vnyp; iy++) { 02760 for (ix = 0; ix <= m_vnxc; ix++) { 02761 if ( (*m_wptr)(ix,iy,iz) > 0) {//(*v) should be treated as complex!! 02762 float tmp; 02763 tmp = (-2*((ix+iy+iz)%2)+1)/((*m_wptr)(ix,iy,iz)+m_osnr); 02764 02765 if( m_weighting == ESTIMATE ) { 02766 int cx = ix; 02767 int cy = (iy<=m_vnyc) ? iy - 1 : iy - 1 - m_vnyp; 02768 int cz = (iz<=m_vnzc) ? iz - 1 : iz - 1 - m_vnzp; 02769 float sum = 0.0; 02770 for( int ii = -kc; ii <= kc; ++ii ) { 02771 int nbrcx = cx + ii; 02772 if( nbrcx >= m_vnxc ) continue; 02773 for( int jj= -kc; jj <= kc; ++jj ) { 02774 int nbrcy = cy + jj; 02775 if( nbrcy <= -m_vnyc || nbrcy >= m_vnyc ) continue; 02776 02777 int kcz = (m_ndim==3) ? kc : 0; 02778 for( int kk = -kcz; kk <= kcz; ++kk ) { 02779 int nbrcz = cz + kk; 02780 if( nbrcz <= -m_vnyc || nbrcz >= m_vnyc ) continue; 02781 if( nbrcx < 0 ) { 02782 nbrcx = -nbrcx; 02783 nbrcy = -nbrcy; 02784 nbrcz = -nbrcz; 02785 } 02786 int nbrix = nbrcx; 02787 int nbriy = nbrcy >= 0 ? nbrcy + 1 : nbrcy + 1 + m_vnyp; 02788 int nbriz = nbrcz >= 0 ? nbrcz + 1 : nbrcz + 1 + m_vnzp; 02789 if( (*m_wptr)( nbrix, nbriy, nbriz ) == 0 ) { 02790 int c = m_ndim*kc+1 - std::abs(ii) - std::abs(jj) - std::abs(kk); 02791 sum = sum + pow_a[c]; 02792 } 02793 } 02794 } 02795 } 02796 float wght = 1.0f / ( 1.0f - alpha * sum ); 02797 tmp = tmp * wght; 02798 } 02799 (*m_volume)(2*ix,iy,iz) *= tmp; 02800 (*m_volume)(2*ix+1,iy,iz) *= tmp; 02801 } 02802 } 02803 } 02804 } 02805 02806 //if(m_ndim==2) printImage( m_volume ); 02807 02808 // back fft 02809 m_volume->do_ift_inplace(); 02810 02811 02812 int npad = m_volume->get_attr("npad"); 02813 m_volume->depad(); 02814 circumf_rect( m_volume, npad ); 02815 //circumf_rect_new( m_volume, npad,m_xratio,m_yratio); 02816 m_volume->set_array_offsets( 0, 0, 0 ); 02817 02818 return 0; 02819 }
|
|
Get a clear, concise description of this class.
Implements EMAN::FactoryBase. Definition at line 847 of file reconstructor.h. 00848 { 00849 return "Direct Fourier inversion routine"; 00850 }
|
|
Get the unique name of this class (especially for factory based instantiation access).
Implements EMAN::FactoryBase. Definition at line 842 of file reconstructor.h. 00843 {
00844 return NAME;
00845 }
|
|
Implements EMAN::FactoryBase. Definition at line 857 of file reconstructor.h. References EMAN::TypeDict::put(). 00858 { 00859 TypeDict d; 00860 d.put("sizeprojection", EMObject::INT); 00861 d.put("sizex", EMObject::INT); 00862 d.put("sizey", EMObject::INT); 00863 d.put("sizez", EMObject::INT); 00864 d.put("xratio", EMObject::FLOAT); 00865 d.put("yratio", EMObject::FLOAT); 00866 d.put("npad", EMObject::INT); 00867 d.put("sign", EMObject::INT); 00868 d.put("ndim", EMObject::INT); 00869 d.put("snr", EMObject::FLOAT); 00870 d.put("symmetry", EMObject::STRING); 00871 d.put("snr", EMObject::FLOAT); 00872 d.put("fftvol", EMObject::EMDATA); 00873 d.put("weight", EMObject::EMDATA); 00874 d.put("weighting", EMObject::INT); 00875 return d; 00876 }
|
|
Definition at line 2628 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, mult(), and t. 02629 { 02630 Assert( padded != NULL ); 02631 02632 vector<Transform> tsym = t.get_sym_proj(m_symmetry); 02633 for (unsigned int isym=0; isym < tsym.size(); isym++) { 02634 m_volume->insert_rect_slice(m_wptr, padded, tsym[isym], m_sizeofprojection, m_xratio, m_yratio, m_npad, mult); 02635 } 02636 02637 02638 return 0; 02639 02640 }
|
|
Insert an image slice to the reconstructor. To insert multiple image slices, call this function multiple times.
Reimplemented from EMAN::Reconstructor. |
|
Definition at line 904 of file reconstructor.h. Referenced by nn4_rectReconstructor(). 00905 {
00906 //params["use_weights"] = false;
00907 }
|
|
Definition at line 852 of file reconstructor.h. 00853 { 00854 return new nn4_rectReconstructor(); 00855 }
|
|
Definition at line 2437 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. 02438 { 02439 m_weighting = ESTIMATE; 02440 m_wghta = 0.2f; 02441 m_symmetry = symmetry; 02442 m_npad = npad; 02443 m_nsym = Transform::get_nsym(m_symmetry); 02444 02445 if( params.has_key("sizex") ) m_vnx = params["sizex"]; 02446 else if(params.has_key("xratio")) 02447 { 02448 float temp=params["xratio"]; 02449 m_vnx=int(float(sizeprojection)*temp); 02450 } 02451 else m_vnx=sizeprojection; 02452 02453 if( params.has_key("sizey") ) m_vny = params["sizey"]; 02454 else if (params.has_key("yratio")) 02455 { 02456 float temp=params["yratio"]; 02457 m_vny=int(float(sizeprojection)*temp); 02458 } 02459 else m_vny=sizeprojection; 02460 02461 if( params.has_key("sizez") ) 02462 m_vnz = params["sizez"]; 02463 else 02464 m_vnz = (m_ndim==3) ? sizeprojection : 1; 02465 02466 m_xratio=float(m_vnx)/float(sizeprojection); 02467 m_yratio=float(m_vny)/float(sizeprojection); 02468 02469 m_vnxp = m_vnx*npad; 02470 m_vnyp = m_vny*npad; 02471 m_vnzp = (m_ndim==3) ? m_vnz*npad : 1; 02472 02473 m_vnxc = m_vnxp/2; 02474 m_vnyc = m_vnyp/2; 02475 m_vnzc = (m_ndim==3) ? m_vnzp/2 : 1; 02476 02477 buildFFTVolume(); 02478 buildNormVolume(); 02479 }
|
|
Initialize the reconstructor.
Implements EMAN::Reconstructor. Definition at line 2418 of file reconstructor.cpp. References EMAN::Dict::has_key(), m_count, m_ndim, m_osnr, and m_sizeofprojection. Referenced by nn4_rectReconstructor(). 02419 { 02420 m_sizeofprojection = params["sizeprojection"]; 02421 int npad = params["npad"]; 02422 m_count=0; 02423 02424 string symmetry; 02425 if( params.has_key("symmetry") ) symmetry = params["symmetry"].to_str(); 02426 else symmetry = "c1"; 02427 02428 if( params.has_key("ndim") ) m_ndim = params["ndim"]; 02429 else m_ndim = 3; 02430 02431 if( params.has_key( "snr" ) ) m_osnr = 1.0f/float( params["snr"] ); 02432 else m_osnr = 0.0; 02433 02434 setup( symmetry, m_sizeofprojection, npad ); 02435 }
|
|
Definition at line 895 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 892 of file reconstructor.h. |
|
Definition at line 890 of file reconstructor.h. Referenced by buildFFTVolume(), insert_padfft_slice(), and setup(). |
|
Definition at line 891 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 903 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 898 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 887 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 889 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 894 of file reconstructor.h. Referenced by buildNormVolume(), and setup(). |
|
Definition at line 893 of file reconstructor.h. Referenced by buildFFTVolume(), and setup(). |
|
Definition at line 889 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 894 of file reconstructor.h. |
|
Definition at line 893 of file reconstructor.h. Referenced by buildFFTVolume(), buildNormVolume(), finish(), and setup(). |
|
Definition at line 889 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 894 of file reconstructor.h. Referenced by setup(). |
|
Definition at line 893 of file reconstructor.h. Referenced by buildFFTVolume(), buildNormVolume(), and setup(). |
|
Definition at line 885 of file reconstructor.h. Referenced by buildFFTVolume(), finish(), insert_padfft_slice(), and nn4_rectReconstructor(). |
|
Definition at line 888 of file reconstructor.h. |
|
Definition at line 901 of file reconstructor.h. |
|
Definition at line 902 of file reconstructor.h. |
|
Definition at line 886 of file reconstructor.h. Referenced by buildNormVolume(), finish(), insert_padfft_slice(), and nn4_rectReconstructor(). |
|
Definition at line 896 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 897 of file reconstructor.h. |
|
Definition at line 896 of file reconstructor.h. Referenced by insert_padfft_slice(), and setup(). |
|
Definition at line 897 of file reconstructor.h. |
|
Definition at line 896 of file reconstructor.h. |
|
Definition at line 82 of file reconstructor.cpp. |