#include <processor.h>
Inheritance diagram for EMAN::Wiener2DFourierProcessor:
Public Member Functions | |
string | get_name () const |
Get the processor's name. | |
virtual EMData * | process (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 | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "filter.wiener2d" |
Protected Attributes | |
Ctf * | ctf |
ctf[in] | A Ctf object to use |
Definition at line 845 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 876 of file processor.h. 00877 { 00878 return "Applies a 2-D Wiener filter to an image based on its Ctf parameters"; 00879 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 848 of file processor.h. 00849 {
00850 return NAME;
00851 }
|
|
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 864 of file processor.h. References EMAN::TypeDict::put(). 00865 { 00866 TypeDict d; 00867 d.put("ctf", EMObject::EMDATA, "Ctf object to use for Wiener filter parameters"); 00868 return d; 00869 }
|
|
Definition at line 871 of file processor.h. 00872 { 00873 return new Wiener2DFourierProcessor(); 00874 }
|
|
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.
Reimplemented from EMAN::Processor. Definition at line 1084 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(). 01085 { 01086 const EMData *in2 = 0; 01087 if (in->is_complex()) in2=in; 01088 else in=in->do_fft(); 01089 01090 EMData *filt = in->copy_head(); 01091 Ctf *ictf = ctf; 01092 01093 if (!ictf) ctf=(Ctf *)in->get_attr("ctf"); 01094 01095 ictf->compute_2d_complex(filt,Ctf::CTF_WIENER_FILTER); 01096 filt->mult(*in2); 01097 EMData *ret=filt->do_ift(); 01098 01099 delete filt; 01100 if (!in->is_complex()) delete in2; 01101 01102 if(!ictf && ctf) {delete ctf; ctf=0;} 01103 return(ret); 01104 /* const EMData *fft; 01105 float *fftd; 01106 int f=0; 01107 01108 if (!image) { 01109 LOGWARN("NULL Image"); 01110 return ret; 01111 } 01112 01113 if (!image->is_complex()) { 01114 fft = image->do_fft(); 01115 fftd = fft->get_data(); 01116 f=1; 01117 } 01118 else { 01119 fft=image; 01120 fftd=image->get_data(); 01121 } 01122 powd=image->get_data(); 01123 01124 int bad=0; 01125 for (int i=0; i<image->get_xsize()*image->get_ysize(); i+=2) { 01126 snr=(fftd[i]*fftd[i]+fftd[i+1]*fftd[i+1]-powd[i])/powd[i]; 01127 if (snr<0) { bad++; snr=0; } 01128 01129 } 01130 01131 print("%d bad pixels\n",snr); 01132 */ return ret; 01133 01134 }
|
|
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 1136 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(). 01136 { 01137 EMData *tmp=process(image); 01138 memcpy(image->get_data(),tmp->get_data(),image->get_xsize()*image->get_ysize()*image->get_zsize()*sizeof(float)); 01139 delete tmp; 01140 image->update(); 01141 return; 01142 }
|
|
Set the processor parameters using a key/value dictionary.
Reimplemented from EMAN::Processor. Definition at line 857 of file processor.h. 00858 { 00859 params = new_params; 00860 ctf = params["ctf"]; 00861 // printf("%s %f\n",params.keys()[0].c_str(),lowpass); 00862 }
|
|
Definition at line 884 of file processor.h. Referenced by process(). |
|
Definition at line 67 of file processor.cpp. |