#include <processor.h>
Inheritance diagram for EMAN::SNRProcessor:
Public Member Functions | |
virtual void | process_inplace (EMData *image) |
To process an image in-place. | |
virtual string | get_name () const |
Get the processor's name. | |
virtual string | get_desc () const |
Get the descrition of this specific processor. | |
virtual TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "eman1.filter.snr" |
wiener | if set to 1, then use wiener processor to process the images using the estimated SNR with CTF amplitude correction | |
snrfile | structure factor file name |
Definition at line 5187 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 5202 of file processor.h. 05203 { 05204 return "Processor the images by the estimated SNR in each image.if parameter 'wiener' is 1, then wiener processor the images using the estimated SNR with CTF amplitude correction."; 05205 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5192 of file processor.h. 05193 {
05194 return NAME;
05195 }
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor. Definition at line 5207 of file processor.h. References EMAN::TypeDict::put(). 05208 { 05209 TypeDict d; 05210 d.put("wiener", EMObject::INT, "if set to 1, then use wiener processor to process the images using the estimated SNR with CTF amplitude correction"); 05211 d.put("snrfile", EMObject::STRING, "structure factor file name"); 05212 return d; 05213 }
|
|
Definition at line 5197 of file processor.h. 05198 { 05199 return new SNRProcessor(); 05200 }
|
|
To process an image in-place. For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.
Implements EMAN::Processor. Definition at line 5785 of file processor.cpp. References EMAN::Ctf::apix, EMAN::EMData::apply_radial_func(), EMAN::Ctf::compute_1d(), EMAN::EMData::do_fft(), EMAN::EMData::do_ift(), EMAN::EMData::get_clip(), EMAN::EMData::get_ctf(), EMAN::XYData::get_size(), EMAN::EMData::get_xsize(), EMAN::XYData::get_y(), EMAN::EMData::get_ysize(), log10(), LOGERR, nx, ny, EMAN::EMData::process_inplace(), EMAN::XYData::read_file(), EMAN::XYData::set_y(), and EMAN::XYData::update(). 05786 { 05787 if (!image) { 05788 return; 05789 } 05790 05791 int wiener = params["wiener"]; 05792 const char *snrfile = params["snrfile"]; 05793 05794 XYData sf; 05795 int err = sf.read_file(snrfile); 05796 if (err) { 05797 LOGERR("couldn't read structure factor file!"); 05798 return; 05799 } 05800 05801 05802 for (size_t i = 0; i < sf.get_size(); i++) { 05803 if (sf.get_y(i) <= 0) { 05804 sf.set_y(i, -4.0f); 05805 } 05806 else { 05807 sf.set_y(i, log10(sf.get_y(i))); 05808 } 05809 } 05810 sf.update(); 05811 05812 Ctf *image_ctf = image->get_ctf(); 05813 05814 vector < float >ctf; 05815 if (wiener) { 05816 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_WIENER_FILTER, &sf); 05817 } 05818 else { 05819 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_SNR, &sf); 05820 } 05821 05822 if(image_ctf) {delete image_ctf; image_ctf=0;} 05823 05824 image->process_inplace("normalize.circlemean"); 05825 05826 int nx = image->get_xsize(); 05827 int ny = image->get_ysize(); 05828 05829 Region clip_r(-nx / 2, -ny / 2, nx * 2, ny * 2); 05830 EMData *d3 = image->get_clip(clip_r); 05831 EMData *d2 = d3->do_fft(); 05832 05833 d2->apply_radial_func(0, 2.0f / Ctf::CTFOS, ctf, 0); 05834 05835 if( d3 ) 05836 { 05837 delete d3; 05838 d3 = 0; 05839 } 05840 05841 if( image ) 05842 { 05843 delete image; 05844 image = 0; 05845 } 05846 05847 EMData *d1 = d2->do_ift(); 05848 int d1_nx = d1->get_xsize(); 05849 int d1_ny = d1->get_ysize(); 05850 Region d1_r(d1_nx / 4, d1_ny / 4, d1_nx / 2, d1_ny / 2); 05851 05852 image = d1->get_clip(d1_r); 05853 05854 if( d1 ) 05855 { 05856 delete d1; 05857 d1 = 0; 05858 } 05859 05860 if( d2 ) 05861 { 05862 delete d2; 05863 d2 = 0; 05864 } 05865 }
|
|
Definition at line 174 of file processor.cpp. |