#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "filter.wiener2d" |
Protected Attributes | |
Ctf * | ctf |
ctf[in] | A Ctf object to use |
Definition at line 766 of file processor.h.
string EMAN::Wiener2DFourierProcessor::get_desc | ( | ) | const [inline, virtual] |
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.
string EMAN::Wiener2DFourierProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 769 of file processor.h.
References NAME.
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.
Reimplemented from EMAN::Processor.
Definition at line 785 of file processor.h.
References EMAN::EMObject::EMDATA, and 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 }
static Processor* EMAN::Wiener2DFourierProcessor::NEW | ( | ) | [inline, static] |
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.
image | The image will be copied, actual process happen on copy of image. |
Reimplemented from EMAN::Processor.
Definition at line 1143 of file processor.cpp.
References EMAN::Ctf::compute_2d_complex(), ctf, EMAN::Ctf::CTF_WIENER_FILTER, EMAN::EMData::do_ift(), in, and EMAN::EMData::mult().
Referenced by process_inplace().
01144 { 01145 const EMData *in2 = 0; 01146 if (in->is_complex()) in2=in; 01147 else in=in->do_fft(); 01148 01149 EMData *filt = in->copy_head(); 01150 Ctf *ictf = ctf; 01151 01152 if (!ictf) ctf=(Ctf *)in->get_attr("ctf"); 01153 01154 ictf->compute_2d_complex(filt,Ctf::CTF_WIENER_FILTER); 01155 filt->mult(*in2); 01156 EMData *ret=filt->do_ift(); 01157 01158 delete filt; 01159 if (!in->is_complex()) delete in2; 01160 01161 if(!ictf && ctf) {delete ctf; ctf=0;} 01162 return(ret); 01163 /* const EMData *fft; 01164 float *fftd; 01165 int f=0; 01166 01167 if (!image) { 01168 LOGWARN("NULL Image"); 01169 return ret; 01170 } 01171 01172 if (!image->is_complex()) { 01173 fft = image->do_fft(); 01174 fftd = fft->get_data(); 01175 f=1; 01176 } 01177 else { 01178 fft=image; 01179 fftd=image->get_data(); 01180 } 01181 powd=image->get_data(); 01182 01183 int bad=0; 01184 for (int i=0; i<image->get_xsize()*image->get_ysize(); i+=2) { 01185 snr=(fftd[i]*fftd[i]+fftd[i+1]*fftd[i+1]-powd[i])/powd[i]; 01186 if (snr<0) { bad++; snr=0; } 01187 01188 } 01189 01190 print("%d bad pixels\n",snr); 01191 */ return ret; 01192 01193 }
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 1195 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().
01195 { 01196 EMData *tmp=process(image); 01197 memcpy(image->get_data(),tmp->get_data(),image->get_xsize()*image->get_ysize()*image->get_zsize()*sizeof(float)); 01198 delete tmp; 01199 image->update(); 01200 return; 01201 }
void EMAN::Wiener2DFourierProcessor::set_params | ( | const Dict & | new_params | ) | [inline, virtual] |
Set the processor parameters using a key/value dictionary.
new_params | A dictionary containing the new parameters. |
Reimplemented from EMAN::Processor.
Definition at line 778 of file processor.h.
References ctf, and EMAN::Processor::params.
00779 { 00780 params = new_params; 00781 ctf = params["ctf"]; 00782 // printf("%s %f\n",params.keys()[0].c_str(),lowpass); 00783 }
Ctf* EMAN::Wiener2DFourierProcessor::ctf [protected] |
const string Wiener2DFourierProcessor::NAME = "filter.wiener2d" [static] |