Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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

ProcessorNEW ()

Static Public Attributes

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 5187 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 5202 of file processor.h.

05203                 {
05204                         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.";
05205                 }

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

05193                 {
05194                         return NAME;
05195                 }

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 5207 of file processor.h.

References EMAN::TypeDict::put().

05208                 {
05209                         TypeDict d;
05210                         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");
05211                         d.put("snrfile", EMObject::STRING, "structure factor file name");
05212                         return d;
05213                 }

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

Definition at line 5197 of file processor.h.

05198                 {
05199                         return new SNRProcessor();
05200                 }

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 5785 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().

05786 {
05787         if (!image) {
05788                 return;
05789         }
05790 
05791         int wiener = params["wiener"];
05792         const char *snrfile = params["snrfile"];
05793 
05794         XYData sf;
05795         int err = sf.read_file(snrfile);
05796         if (err) {
05797                 LOGERR("couldn't read structure factor file!");
05798                 return;
05799         }
05800 
05801 
05802         for (size_t i = 0; i < sf.get_size(); i++) {
05803                 if (sf.get_y(i) <= 0) {
05804                         sf.set_y(i, -4.0f);
05805                 }
05806                 else {
05807                         sf.set_y(i, log10(sf.get_y(i)));
05808                 }
05809         }
05810         sf.update();
05811 
05812         Ctf *image_ctf = image->get_ctf();
05813 
05814         vector < float >ctf;
05815         if (wiener) {
05816                 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_WIENER_FILTER, &sf);
05817         }
05818         else {
05819                 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_SNR, &sf);
05820         }
05821 
05822         if(image_ctf) {delete image_ctf; image_ctf=0;}
05823 
05824         image->process_inplace("normalize.circlemean");
05825 
05826         int nx = image->get_xsize();
05827         int ny = image->get_ysize();
05828 
05829         Region clip_r(-nx / 2, -ny / 2, nx * 2, ny * 2);
05830         EMData *d3 = image->get_clip(clip_r);
05831         EMData *d2 = d3->do_fft();
05832 
05833         d2->apply_radial_func(0, 2.0f / Ctf::CTFOS, ctf, 0);
05834 
05835         if( d3 )
05836         {
05837                 delete d3;
05838                 d3 = 0;
05839         }
05840 
05841         if( image )
05842         {
05843                 delete image;
05844                 image = 0;
05845         }
05846 
05847         EMData *d1 = d2->do_ift();
05848         int d1_nx = d1->get_xsize();
05849         int d1_ny = d1->get_ysize();
05850         Region d1_r(d1_nx / 4, d1_ny / 4, d1_nx / 2, d1_ny / 2);
05851 
05852         image = d1->get_clip(d1_r);
05853 
05854         if( d1 )
05855         {
05856                 delete d1;
05857                 d1 = 0;
05858         }
05859 
05860         if( d2 )
05861         {
05862                 delete d2;
05863                 d2 = 0;
05864         }
05865 }


Member Data Documentation

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

Definition at line 174 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Nov 17 12:46:29 2011 for EMAN2 by  doxygen 1.3.9.1