#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 5156 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 5171 of file processor.h. 05172 {
05173 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.";
05174 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5161 of file processor.h. 05162 {
05163 return NAME;
05164 }
|
|
|
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 5176 of file processor.h. References EMAN::TypeDict::put(). 05177 {
05178 TypeDict d;
05179 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");
05180 d.put("snrfile", EMObject::STRING, "structure factor file name");
05181 return d;
05182 }
|
|
|
Definition at line 5166 of file processor.h. 05167 {
05168 return new SNRProcessor();
05169 }
|
|
|
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 5699 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(). 05700 {
05701 if (!image) {
05702 return;
05703 }
05704
05705 int wiener = params["wiener"];
05706 const char *snrfile = params["snrfile"];
05707
05708 XYData sf;
05709 int err = sf.read_file(snrfile);
05710 if (err) {
05711 LOGERR("couldn't read structure factor file!");
05712 return;
05713 }
05714
05715
05716 for (size_t i = 0; i < sf.get_size(); i++) {
05717 if (sf.get_y(i) <= 0) {
05718 sf.set_y(i, -4.0f);
05719 }
05720 else {
05721 sf.set_y(i, log10(sf.get_y(i)));
05722 }
05723 }
05724 sf.update();
05725
05726 Ctf *image_ctf = image->get_ctf();
05727
05728 vector < float >ctf;
05729 if (wiener) {
05730 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_WIENER_FILTER, &sf);
05731 }
05732 else {
05733 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_SNR, &sf);
05734 }
05735
05736 if(image_ctf) {delete image_ctf; image_ctf=0;}
05737
05738 image->process_inplace("normalize.circlemean");
05739
05740 int nx = image->get_xsize();
05741 int ny = image->get_ysize();
05742
05743 Region clip_r(-nx / 2, -ny / 2, nx * 2, ny * 2);
05744 EMData *d3 = image->get_clip(clip_r);
05745 EMData *d2 = d3->do_fft();
05746
05747 d2->apply_radial_func(0, 2.0f / Ctf::CTFOS, ctf, 0);
05748
05749 if( d3 )
05750 {
05751 delete d3;
05752 d3 = 0;
05753 }
05754
05755 if( image )
05756 {
05757 delete image;
05758 image = 0;
05759 }
05760
05761 EMData *d1 = d2->do_ift();
05762 int d1_nx = d1->get_xsize();
05763 int d1_ny = d1->get_ysize();
05764 Region d1_r(d1_nx / 4, d1_ny / 4, d1_nx / 2, d1_ny / 2);
05765
05766 image = d1->get_clip(d1_r);
05767
05768 if( d1 )
05769 {
05770 delete d1;
05771 d1 = 0;
05772 }
05773
05774 if( d2 )
05775 {
05776 delete d2;
05777 d2 = 0;
05778 }
05779 }
|
|
|
Definition at line 179 of file processor.cpp. |
1.3.9.1