#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 4977 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 4992 of file processor.h. 04993 { 04994 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."; 04995 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4982 of file processor.h. 04983 {
04984 return NAME;
04985 }
|
|
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 4997 of file processor.h. References EMAN::TypeDict::put(). 04998 { 04999 TypeDict d; 05000 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"); 05001 d.put("snrfile", EMObject::STRING, "structure factor file name"); 05002 return d; 05003 }
|
|
Definition at line 4987 of file processor.h. 04988 { 04989 return new SNRProcessor(); 04990 }
|
|
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 5605 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(). 05606 { 05607 if (!image) { 05608 return; 05609 } 05610 05611 int wiener = params["wiener"]; 05612 const char *snrfile = params["snrfile"]; 05613 05614 XYData sf; 05615 int err = sf.read_file(snrfile); 05616 if (err) { 05617 LOGERR("couldn't read structure factor file!"); 05618 return; 05619 } 05620 05621 05622 for (size_t i = 0; i < sf.get_size(); i++) { 05623 if (sf.get_y(i) <= 0) { 05624 sf.set_y(i, -4.0f); 05625 } 05626 else { 05627 sf.set_y(i, log10(sf.get_y(i))); 05628 } 05629 } 05630 sf.update(); 05631 05632 Ctf *image_ctf = image->get_ctf(); 05633 05634 vector < float >ctf; 05635 if (wiener) { 05636 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_WIENER_FILTER, &sf); 05637 } 05638 else { 05639 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_SNR, &sf); 05640 } 05641 05642 if(image_ctf) {delete image_ctf; image_ctf=0;} 05643 05644 image->process_inplace("normalize.circlemean"); 05645 05646 int nx = image->get_xsize(); 05647 int ny = image->get_ysize(); 05648 05649 Region clip_r(-nx / 2, -ny / 2, nx * 2, ny * 2); 05650 EMData *d3 = image->get_clip(clip_r); 05651 EMData *d2 = d3->do_fft(); 05652 05653 d2->apply_radial_func(0, 2.0f / Ctf::CTFOS, ctf, 0); 05654 05655 if( d3 ) 05656 { 05657 delete d3; 05658 d3 = 0; 05659 } 05660 05661 if( image ) 05662 { 05663 delete image; 05664 image = 0; 05665 } 05666 05667 EMData *d1 = d2->do_ift(); 05668 int d1_nx = d1->get_xsize(); 05669 int d1_ny = d1->get_ysize(); 05670 Region d1_r(d1_nx / 4, d1_ny / 4, d1_nx / 2, d1_ny / 2); 05671 05672 image = d1->get_clip(d1_r); 05673 05674 if( d1 ) 05675 { 05676 delete d1; 05677 d1 = 0; 05678 } 05679 05680 if( d2 ) 05681 { 05682 delete d2; 05683 d2 = 0; 05684 } 05685 }
|
|
Definition at line 168 of file processor.cpp. |