EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
EMAN::FileFourierProcessor Class Reference

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

#include <processor.h>

Inheritance diagram for EMAN::FileFourierProcessor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::FileFourierProcessor:
Collaboration graph
[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

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "eman1.filter.byfile"

Detailed Description

A fourier processor specified in a 2 column text file.

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

Definition at line 5641 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 5651 of file processor.h.

                {
                        return "A fourier processor specified in a 2 column text file.";
                }
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 5646 of file processor.h.

References NAME.

                {
                        return NAME;
                }
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 5661 of file processor.h.

References EMAN::TypeDict::put(), and EMAN::EMObject::STRING.

                {
                        TypeDict d;
                        d.put("filename", EMObject::STRING, "file name for a 2 column text file which specified a radial function data array.");
                        return d;
                }
static Processor* EMAN::FileFourierProcessor::NEW ( ) [inline, static]

Definition at line 5656 of file processor.h.

                {
                        return new FileFourierProcessor();
                }
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:
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 6301 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.

{
        if (!image) {
                LOGWARN("NULL Image");
                return;
        }
        const char *filename = params["filename"];
        float apix = params["apix"];

        FILE *in = fopen(filename, "rb");
        if (!in) {
                LOGERR("FileFourierProcessor: cannot open file '%s'", filename);
                return;
        }

        float f = 0;
        int n = 0;
        while (fscanf(in, " %f %f", &f, &f) == 2) {
                n++;
        }
        rewind(in);

        vector < float >xd(n);
        vector < float >yd(n);

        float sf = apix * image->get_xsize();

        for (int i = 0; fscanf(in, " %f %f", &xd[i], &yd[i]) == 2; i++) {
                xd[i] *= sf;
        }

        if (xd[2] - xd[1] != xd[1] - xd[0]) {
                LOGWARN("Warning, x spacing appears nonuniform %g!=%g\n",
                                xd[2] - xd[1], xd[1] - xd[0]);
        }

        EMData *d2 = image->do_fft();
        if( image )
        {
                delete image;
                image = 0;
        }

        d2->apply_radial_func(xd[0], xd[1] - xd[0], yd, 1);
        image = d2->do_ift();
}

Member Data Documentation

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

Definition at line 5668 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: