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

EMAN::Wiener2DFourierProcessor Class Reference

Wiener filter based on a Ctf object either in the image header. More...

#include <processor.h>

Inheritance diagram for EMAN::Wiener2DFourierProcessor:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

string get_name () const
 Get the processor's name.
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place.
void process_inplace (EMData *image)
 To process an image in-place.
void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary.
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.
string get_desc () const
 Get the descrition of this specific processor.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "filter.wiener2d"

Protected Attributes

Ctfctf

Detailed Description

Wiener filter based on a Ctf object either in the image header.

Parameters:
ctf[in] A Ctf object to use
Author:
Steve Ludtke
Date:
2008/11/03

Definition at line 766 of file processor.h.


Member Function Documentation

string EMAN::Wiener2DFourierProcessor::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 797 of file processor.h.

00798                 {
00799                         return "Applies a 2-D Wiener filter to an image based on its Ctf parameters";
00800                 }

string EMAN::Wiener2DFourierProcessor::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 769 of file processor.h.

00770                 {
00771                         return NAME;
00772                 }

TypeDict EMAN::Wiener2DFourierProcessor::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 785 of file processor.h.

References EMAN::TypeDict::put().

00786                 {
00787                         TypeDict d;
00788                         d.put("ctf", EMObject::EMDATA, "Ctf object to use for Wiener filter parameters");
00789                         return d;
00790                 }

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

Definition at line 792 of file processor.h.

00793                 {
00794                         return new Wiener2DFourierProcessor();
00795                 }

EMData * Wiener2DFourierProcessor::process const EMData *const   image  )  [virtual]
 

To proccess an image out-of-place.

For those processors which can only be processed out-of-place, override this function to give the right behavior.

Parameters:
image The image will be copied, actual process happen on copy of image.
Returns:
the image processing result, may or may not be the same size of the input image

Reimplemented from EMAN::Processor.

Definition at line 1047 of file processor.cpp.

References EMAN::Ctf::compute_2d_complex(), EMAN::EMData::copy_head(), ctf, EMAN::EMData::do_fft(), EMAN::EMData::do_ift(), EMAN::EMData::get_attr(), in, EMAN::EMData::is_complex(), and EMAN::EMData::mult().

Referenced by process_inplace().

01048 {
01049         const EMData *in2 = 0;
01050         if (in->is_complex()) in2=in;
01051         else in=in->do_fft();
01052 
01053         EMData *filt = in->copy_head();
01054         Ctf *ictf = ctf;
01055 
01056         if (!ictf) ctf=(Ctf *)in->get_attr("ctf");
01057 
01058         ictf->compute_2d_complex(filt,Ctf::CTF_WIENER_FILTER);
01059         filt->mult(*in2);
01060         EMData *ret=filt->do_ift();
01061 
01062         delete filt;
01063         if (!in->is_complex()) delete in2;
01064 
01065         if(!ictf && ctf) {delete ctf; ctf=0;}
01066         return(ret);
01067 /*      const EMData *fft;
01068         float *fftd;
01069         int f=0;
01070 
01071         if (!image) {
01072                 LOGWARN("NULL Image");
01073                 return ret;
01074         }
01075 
01076         if (!image->is_complex()) {
01077                 fft = image->do_fft();
01078                 fftd = fft->get_data();
01079                 f=1;
01080         }
01081         else {
01082                 fft=image;
01083                 fftd=image->get_data();
01084         }
01085         powd=image->get_data();
01086 
01087         int bad=0;
01088         for (int i=0; i<image->get_xsize()*image->get_ysize(); i+=2) {
01089                 snr=(fftd[i]*fftd[i]+fftd[i+1]*fftd[i+1]-powd[i])/powd[i];
01090                 if (snr<0) { bad++; snr=0; }
01091 
01092         }
01093 
01094         print("%d bad pixels\n",snr);
01095 */      return ret;
01096 
01097 }

void Wiener2DFourierProcessor::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 1099 of file processor.cpp.

References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), process(), and EMAN::EMData::update().

01099                                                             {
01100         EMData *tmp=process(image);
01101         memcpy(image->get_data(),tmp->get_data(),image->get_xsize()*image->get_ysize()*image->get_zsize()*sizeof(float));
01102         delete tmp;
01103         image->update();
01104         return;
01105 }

void EMAN::Wiener2DFourierProcessor::set_params const Dict new_params  )  [inline, virtual]
 

Set the processor parameters using a key/value dictionary.

Parameters:
new_params A dictionary containing the new parameters.

Reimplemented from EMAN::Processor.

Definition at line 778 of file processor.h.

00779                 {
00780                         params = new_params;
00781                         ctf = params["ctf"];
00782 //                      printf("%s %f\n",params.keys()[0].c_str(),lowpass);
00783                 }


Member Data Documentation

Ctf* EMAN::Wiener2DFourierProcessor::ctf [protected]
 

Definition at line 805 of file processor.h.

Referenced by process().

const string Wiener2DFourierProcessor::NAME = "filter.wiener2d" [static]
 

Definition at line 68 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 13:47:39 2010 for EMAN2 by  doxygen 1.3.9.1