EMAN::SNRProcessor Class Reference

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. More...

#include <processor.h>

Inheritance diagram for EMAN::SNRProcessor:

Inheritance graph
[legend]
Collaboration diagram for EMAN::SNRProcessor:

Collaboration graph
[legend]
List of all members.

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 ProcessorNEW ()

Static Public Attributes

static const string NAME = "eman1.filter.snr"

Detailed Description

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.

Parameters:
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 5192 of file processor.h.


Member Function Documentation

virtual string EMAN::SNRProcessor::get_desc (  )  const [inline, virtual]

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns:
The description of this processor.

Implements EMAN::Processor.

Definition at line 5207 of file processor.h.

05208                 {
05209                         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.";
05210                 }

virtual string EMAN::SNRProcessor::get_name (  )  const [inline, virtual]

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 5197 of file processor.h.

References NAME.

05198                 {
05199                         return NAME;
05200                 }

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.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 5212 of file processor.h.

References EMAN::EMObject::INT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.

05213                 {
05214                         TypeDict d;
05215                         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");
05216                         d.put("snrfile", EMObject::STRING, "structure factor file name");
05217                         return d;
05218                 }

static Processor* EMAN::SNRProcessor::NEW (  )  [inline, static]

Definition at line 5202 of file processor.h.

05203                 {
05204                         return new SNRProcessor();
05205                 }

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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 5743 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().

05744 {
05745         if (!image) {
05746                 return;
05747         }
05748 
05749         int wiener = params["wiener"];
05750         const char *snrfile = params["snrfile"];
05751 
05752         XYData sf;
05753         int err = sf.read_file(snrfile);
05754         if (err) {
05755                 LOGERR("couldn't read structure factor file!");
05756                 return;
05757         }
05758 
05759 
05760         for (size_t i = 0; i < sf.get_size(); i++) {
05761                 if (sf.get_y(i) <= 0) {
05762                         sf.set_y(i, -4.0f);
05763                 }
05764                 else {
05765                         sf.set_y(i, log10(sf.get_y(i)));
05766                 }
05767         }
05768         sf.update();
05769 
05770         Ctf *image_ctf = image->get_ctf();
05771 
05772         vector < float >ctf;
05773         if (wiener) {
05774                 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_WIENER_FILTER, &sf);
05775         }
05776         else {
05777                 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_SNR, &sf);
05778         }
05779 
05780         if(image_ctf) {delete image_ctf; image_ctf=0;}
05781 
05782         image->process_inplace("normalize.circlemean");
05783 
05784         int nx = image->get_xsize();
05785         int ny = image->get_ysize();
05786 
05787         Region clip_r(-nx / 2, -ny / 2, nx * 2, ny * 2);
05788         EMData *d3 = image->get_clip(clip_r);
05789         EMData *d2 = d3->do_fft();
05790 
05791         d2->apply_radial_func(0, 2.0f / Ctf::CTFOS, ctf, 0);
05792 
05793         if( d3 )
05794         {
05795                 delete d3;
05796                 d3 = 0;
05797         }
05798 
05799         if( image )
05800         {
05801                 delete image;
05802                 image = 0;
05803         }
05804 
05805         EMData *d1 = d2->do_ift();
05806         int d1_nx = d1->get_xsize();
05807         int d1_ny = d1->get_ysize();
05808         Region d1_r(d1_nx / 4, d1_ny / 4, d1_nx / 2, d1_ny / 2);
05809 
05810         image = d1->get_clip(d1_r);
05811 
05812         if( d1 )
05813         {
05814                 delete d1;
05815                 d1 = 0;
05816         }
05817 
05818         if( d2 )
05819         {
05820                 delete d2;
05821                 d2 = 0;
05822         }
05823 }


Member Data Documentation

const string SNRProcessor::NAME = "eman1.filter.snr" [static]

Definition at line 5220 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 12:43:56 2010 for EMAN2 by  doxygen 1.4.7