#include <processor.h>
Inheritance diagram for EMAN::FileFourierProcessor:
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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "eman1.filter.byfile" |
filename | file name for a 2 column text file which specified a radial function data array |
Definition at line 5226 of file processor.h.
virtual string EMAN::FileFourierProcessor::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 5236 of file processor.h.
virtual string EMAN::FileFourierProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 5231 of file processor.h.
References NAME.
05232 { 05233 return NAME; 05234 }
virtual TypeDict EMAN::FileFourierProcessor::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 5246 of file processor.h.
References EMAN::TypeDict::put(), and EMAN::EMObject::STRING.
05247 { 05248 TypeDict d; 05249 d.put("filename", EMObject::STRING, "file name for a 2 column text file which specified a radial function data array."); 05250 return d; 05251 }
static Processor* EMAN::FileFourierProcessor::NEW | ( | ) | [inline, static] |
Definition at line 5241 of file processor.h.
05242 { 05243 return new FileFourierProcessor(); 05244 }
void FileFourierProcessor::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 5825 of file processor.cpp.
References EMAN::EMData::apply_radial_func(), EMAN::EMData::do_fft(), EMAN::EMData::do_ift(), EMAN::EMData::get_xsize(), in, LOGERR, LOGWARN, and EMAN::Processor::params.
05826 { 05827 if (!image) { 05828 LOGWARN("NULL Image"); 05829 return; 05830 } 05831 const char *filename = params["filename"]; 05832 float apix = params["apix"]; 05833 05834 FILE *in = fopen(filename, "rb"); 05835 if (!in) { 05836 LOGERR("FileFourierProcessor: cannot open file '%s'", filename); 05837 return; 05838 } 05839 05840 float f = 0; 05841 int n = 0; 05842 while (fscanf(in, " %f %f", &f, &f) == 2) { 05843 n++; 05844 } 05845 rewind(in); 05846 05847 vector < float >xd(n); 05848 vector < float >yd(n); 05849 05850 float sf = apix * image->get_xsize(); 05851 05852 for (int i = 0; fscanf(in, " %f %f", &xd[i], &yd[i]) == 2; i++) { 05853 xd[i] *= sf; 05854 } 05855 05856 if (xd[2] - xd[1] != xd[1] - xd[0]) { 05857 LOGWARN("Warning, x spacing appears nonuniform %g!=%g\n", 05858 xd[2] - xd[1], xd[1] - xd[0]); 05859 } 05860 05861 EMData *d2 = image->do_fft(); 05862 if( image ) 05863 { 05864 delete image; 05865 image = 0; 05866 } 05867 05868 d2->apply_radial_func(xd[0], xd[1] - xd[0], yd, 1); 05869 image = d2->do_ift(); 05870 }
const string FileFourierProcessor::NAME = "eman1.filter.byfile" [static] |