#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 766 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 797 of file processor.h. 00798 { 00799 return "Applies a 2-D Wiener filter to an image based on its Ctf parameters"; 00800 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 769 of file processor.h. 00770 {
00771 return NAME;
00772 }
|
|
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 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 }
|
|
Definition at line 792 of file processor.h. 00793 { 00794 return new Wiener2DFourierProcessor(); 00795 }
|
|
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 1115 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(). 01116 { 01117 const EMData *in2 = 0; 01118 if (in->is_complex()) in2=in; 01119 else in=in->do_fft(); 01120 01121 EMData *filt = in->copy_head(); 01122 Ctf *ictf = ctf; 01123 01124 if (!ictf) ctf=(Ctf *)in->get_attr("ctf"); 01125 01126 ictf->compute_2d_complex(filt,Ctf::CTF_WIENER_FILTER); 01127 filt->mult(*in2); 01128 EMData *ret=filt->do_ift(); 01129 01130 delete filt; 01131 if (!in->is_complex()) delete in2; 01132 01133 if(!ictf && ctf) {delete ctf; ctf=0;} 01134 return(ret); 01135 /* const EMData *fft; 01136 float *fftd; 01137 int f=0; 01138 01139 if (!image) { 01140 LOGWARN("NULL Image"); 01141 return ret; 01142 } 01143 01144 if (!image->is_complex()) { 01145 fft = image->do_fft(); 01146 fftd = fft->get_data(); 01147 f=1; 01148 } 01149 else { 01150 fft=image; 01151 fftd=image->get_data(); 01152 } 01153 powd=image->get_data(); 01154 01155 int bad=0; 01156 for (int i=0; i<image->get_xsize()*image->get_ysize(); i+=2) { 01157 snr=(fftd[i]*fftd[i]+fftd[i+1]*fftd[i+1]-powd[i])/powd[i]; 01158 if (snr<0) { bad++; snr=0; } 01159 01160 } 01161 01162 print("%d bad pixels\n",snr); 01163 */ return ret; 01164 01165 }
|
|
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 1167 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(). 01167 { 01168 EMData *tmp=process(image); 01169 memcpy(image->get_data(),tmp->get_data(),image->get_xsize()*image->get_ysize()*image->get_zsize()*sizeof(float)); 01170 delete tmp; 01171 image->update(); 01172 return; 01173 }
|
|
Set the processor parameters using a key/value dictionary.
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 }
|
|
Definition at line 805 of file processor.h. Referenced by process(). |
|
Definition at line 69 of file processor.cpp. |