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

EMAN::FileFourierProcessor Class Reference

A fourier processor specified in a 2 column text file. More...

#include <processor.h>

Inheritance diagram for EMAN::FileFourierProcessor:

[legend]
Collaboration diagram for EMAN::FileFourierProcessor:
[legend]
List of all members.

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

ProcessorNEW ()

Static Public Attributes

const string NAME = "eman1.filter.byfile"

Detailed Description

A fourier processor specified in a 2 column text file.

Parameters:
filename file name for a 2 column text file which specified a radial function data array

Definition at line 5185 of file processor.h.


Member Function Documentation

virtual string EMAN::FileFourierProcessor::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 5195 of file processor.h.

05196                 {
05197                         return "A fourier processor specified in a 2 column text file.";
05198                 }

virtual string EMAN::FileFourierProcessor::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 5190 of file processor.h.

05191                 {
05192                         return NAME;
05193                 }

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.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 5205 of file processor.h.

References EMAN::TypeDict::put().

05206                 {
05207                         TypeDict d;
05208                         d.put("filename", EMObject::STRING, "file name for a 2 column text file which specified a radial function data array.");
05209                         return d;
05210                 }

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

Definition at line 5200 of file processor.h.

05201                 {
05202                         return new FileFourierProcessor();
05203                 }

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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 5687 of file processor.cpp.

References EMAN::EMData::apply_radial_func(), EMAN::EMData::do_fft(), EMAN::EMData::do_ift(), EMAN::EMData::get_xsize(), in, LOGERR, and LOGWARN.

05688 {
05689         if (!image) {
05690                 LOGWARN("NULL Image");
05691                 return;
05692         }
05693         const char *filename = params["filename"];
05694         float apix = params["apix"];
05695 
05696         FILE *in = fopen(filename, "rb");
05697         if (!in) {
05698                 LOGERR("FileFourierProcessor: cannot open file '%s'", filename);
05699                 return;
05700         }
05701 
05702         float f = 0;
05703         int n = 0;
05704         while (fscanf(in, " %f %f", &f, &f) == 2) {
05705                 n++;
05706         }
05707         rewind(in);
05708 
05709         vector < float >xd(n);
05710         vector < float >yd(n);
05711 
05712         float sf = apix * image->get_xsize();
05713 
05714         for (int i = 0; fscanf(in, " %f %f", &xd[i], &yd[i]) == 2; i++) {
05715                 xd[i] *= sf;
05716         }
05717 
05718         if (xd[2] - xd[1] != xd[1] - xd[0]) {
05719                 LOGWARN("Warning, x spacing appears nonuniform %g!=%g\n",
05720                                 xd[2] - xd[1], xd[1] - xd[0]);
05721         }
05722 
05723         EMData *d2 = image->do_fft();
05724         if( image )
05725         {
05726                 delete image;
05727                 image = 0;
05728         }
05729 
05730         d2->apply_radial_func(xd[0], xd[1] - xd[0], yd, 1);
05731         image = d2->do_ift();
05732 }


Member Data Documentation

const string FileFourierProcessor::NAME = "eman1.filter.byfile" [static]
 

Definition at line 174 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Apr 30 15:39:26 2010 for EMAN2 by  doxygen 1.3.9.1