#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static 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 5232 of file processor.h.
virtual string EMAN::SNRProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 5247 of file processor.h.
05248 { 05249 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."; 05250 }
virtual string EMAN::SNRProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 5237 of file processor.h.
References NAME.
05238 { 05239 return NAME; 05240 }
virtual TypeDict EMAN::SNRProcessor::get_param_types | ( | ) | const [inline, virtual] |
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 5252 of file processor.h.
References EMAN::EMObject::INT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.
05253 { 05254 TypeDict d; 05255 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"); 05256 d.put("snrfile", EMObject::STRING, "structure factor file name"); 05257 return d; 05258 }
static Processor* EMAN::SNRProcessor::NEW | ( | ) | [inline, static] |
void SNRProcessor::process_inplace | ( | EMData * | image | ) | [virtual] |
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 5857 of file processor.cpp.
References EMAN::Ctf::apix, EMAN::EMData::apply_radial_func(), EMAN::Ctf::compute_1d(), EMAN::Ctf::CTF_SNR, EMAN::Ctf::CTF_WIENER_FILTER, EMAN::Ctf::CTFOS, 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, EMAN::Processor::params, EMAN::EMData::process_inplace(), EMAN::XYData::read_file(), EMAN::XYData::set_y(), and EMAN::XYData::update().
05858 { 05859 if (!image) { 05860 return; 05861 } 05862 05863 int wiener = params["wiener"]; 05864 const char *snrfile = params["snrfile"]; 05865 05866 XYData sf; 05867 int err = sf.read_file(snrfile); 05868 if (err) { 05869 LOGERR("couldn't read structure factor file!"); 05870 return; 05871 } 05872 05873 05874 for (size_t i = 0; i < sf.get_size(); i++) { 05875 if (sf.get_y(i) <= 0) { 05876 sf.set_y(i, -4.0f); 05877 } 05878 else { 05879 sf.set_y(i, log10(sf.get_y(i))); 05880 } 05881 } 05882 sf.update(); 05883 05884 Ctf *image_ctf = image->get_ctf(); 05885 05886 vector < float >ctf; 05887 if (wiener) { 05888 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_WIENER_FILTER, &sf); 05889 } 05890 else { 05891 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_SNR, &sf); 05892 } 05893 05894 if(image_ctf) {delete image_ctf; image_ctf=0;} 05895 05896 image->process_inplace("normalize.circlemean"); 05897 05898 int nx = image->get_xsize(); 05899 int ny = image->get_ysize(); 05900 05901 Region clip_r(-nx / 2, -ny / 2, nx * 2, ny * 2); 05902 EMData *d3 = image->get_clip(clip_r); 05903 EMData *d2 = d3->do_fft(); 05904 05905 d2->apply_radial_func(0, 2.0f / Ctf::CTFOS, ctf, 0); 05906 05907 if( d3 ) 05908 { 05909 delete d3; 05910 d3 = 0; 05911 } 05912 05913 if( image ) 05914 { 05915 delete image; 05916 image = 0; 05917 } 05918 05919 EMData *d1 = d2->do_ift(); 05920 int d1_nx = d1->get_xsize(); 05921 int d1_ny = d1->get_ysize(); 05922 Region d1_r(d1_nx / 4, d1_ny / 4, d1_nx / 2, d1_ny / 2); 05923 05924 image = d1->get_clip(d1_r); 05925 05926 if( d1 ) 05927 { 05928 delete d1; 05929 d1 = 0; 05930 } 05931 05932 if( d2 ) 05933 { 05934 delete d2; 05935 d2 = 0; 05936 } 05937 }
const string SNRProcessor::NAME = "eman1.filter.snr" [static] |