#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 5118 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 5133 of file processor.h. 05134 {
05135 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.";
05136 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5123 of file processor.h. 05124 {
05125 return NAME;
05126 }
|
|
|
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 5138 of file processor.h. References EMAN::TypeDict::put(). 05139 {
05140 TypeDict d;
05141 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");
05142 d.put("snrfile", EMObject::STRING, "structure factor file name");
05143 return d;
05144 }
|
|
|
Definition at line 5128 of file processor.h. 05129 {
05130 return new SNRProcessor();
05131 }
|
|
|
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 5671 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(). 05672 {
05673 if (!image) {
05674 return;
05675 }
05676
05677 int wiener = params["wiener"];
05678 const char *snrfile = params["snrfile"];
05679
05680 XYData sf;
05681 int err = sf.read_file(snrfile);
05682 if (err) {
05683 LOGERR("couldn't read structure factor file!");
05684 return;
05685 }
05686
05687
05688 for (size_t i = 0; i < sf.get_size(); i++) {
05689 if (sf.get_y(i) <= 0) {
05690 sf.set_y(i, -4.0f);
05691 }
05692 else {
05693 sf.set_y(i, log10(sf.get_y(i)));
05694 }
05695 }
05696 sf.update();
05697
05698 Ctf *image_ctf = image->get_ctf();
05699
05700 vector < float >ctf;
05701 if (wiener) {
05702 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_WIENER_FILTER, &sf);
05703 }
05704 else {
05705 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_SNR, &sf);
05706 }
05707
05708 if(image_ctf) {delete image_ctf; image_ctf=0;}
05709
05710 image->process_inplace("normalize.circlemean");
05711
05712 int nx = image->get_xsize();
05713 int ny = image->get_ysize();
05714
05715 Region clip_r(-nx / 2, -ny / 2, nx * 2, ny * 2);
05716 EMData *d3 = image->get_clip(clip_r);
05717 EMData *d2 = d3->do_fft();
05718
05719 d2->apply_radial_func(0, 2.0f / Ctf::CTFOS, ctf, 0);
05720
05721 if( d3 )
05722 {
05723 delete d3;
05724 d3 = 0;
05725 }
05726
05727 if( image )
05728 {
05729 delete image;
05730 image = 0;
05731 }
05732
05733 EMData *d1 = d2->do_ift();
05734 int d1_nx = d1->get_xsize();
05735 int d1_ny = d1->get_ysize();
05736 Region d1_r(d1_nx / 4, d1_ny / 4, d1_nx / 2, d1_ny / 2);
05737
05738 image = d1->get_clip(d1_r);
05739
05740 if( d1 )
05741 {
05742 delete d1;
05743 d1 = 0;
05744 }
05745
05746 if( d2 )
05747 {
05748 delete d2;
05749 d2 = 0;
05750 }
05751 }
|
|
|
Definition at line 173 of file processor.cpp. |
1.3.9.1