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

This will replace the image with a full-circle 2D fft amplitude rendering. More...

#include <processor.h>

Inheritance diagram for EMAN::RealToFFTProcessor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::RealToFFTProcessor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void process_inplace (EMData *image)
 To process an image in-place.
string get_name () const
 Get the processor's name.
string get_desc () const
 Get the descrition of this specific processor.

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "math.realtofft"

Detailed Description

This will replace the image with a full-circle 2D fft amplitude rendering.

Definition at line 4006 of file processor.h.


Member Function Documentation

string EMAN::RealToFFTProcessor::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 4021 of file processor.h.

                {
                        return "This will replace the image with a full-circle 2D fft amplitude rendering. Note that this renders amplitude, when intensity is more common.";
                }
string EMAN::RealToFFTProcessor::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 4011 of file processor.h.

References NAME.

                {
                        return NAME;
                }
static Processor* EMAN::RealToFFTProcessor::NEW ( ) [inline, static]

Definition at line 4016 of file processor.h.

                {
                        return new RealToFFTProcessor();
                }
void RealToFFTProcessor::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 3057 of file processor.cpp.

References EMAN::EMData::do_fft(), EMAN::CutoffBlockProcessor::get_name(), EMAN::EMData::get_value_at(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, ImageFormatException, EMAN::EMData::is_complex(), LOGERR, LOGWARN, norm(), nx, ny, EMAN::EMData::ri2ap(), EMAN::EMData::set_value_at(), EMAN::EMData::update(), x, and y.

{
        if (!image) {
                LOGWARN("NULL Image");
                return;
        }

        //Note : real image only!
        if(image->is_complex()) {
                LOGERR("%s Processor only operates on real images", get_name().c_str());
                throw ImageFormatException("apply to real image only");
        }

        // Note : 2D only!
        int nz = image->get_zsize();
        if (nz > 1) {
                LOGERR("%s Processor doesn't support 3D models", get_name().c_str());
                throw ImageDimensionException("3D model not supported");
        }

        EMData *ff=image->do_fft();
        ff->ri2ap();

        int nx=image->get_xsize();
        int ny=image->get_ysize();

        int x,y;
        float norm=static_cast<float>(nx*ny);

        for (y=0; y<ny; y++) image->set_value_at(0,y,0);

        for (x=1; x<nx/2; x++) {
                for (y=0; y<ny; y++) {
                        int y2;
                        if (y<ny/2) y2=y+ny/2;
                        else if (y==ny/2) y2=ny;
                        else y2=y-ny/2;
                        image->set_value_at(x,y,ff->get_value_at(nx-x*2,ny-y2)/norm);
                }
        }

        for (x=nx/2; x<nx; x++) {
                for (y=0; y<ny; y++) {
                        int y2;
                        if (y<ny/2) y2=y+ny/2;
                        else y2=y-ny/2;
                        image->set_value_at(x,y,ff->get_value_at(x*2-nx,y2)/norm);
                }
        }

        image->update();
        if( ff )
        {
                delete ff;
                ff = 0;
        }
}

Member Data Documentation

const string RealToFFTProcessor::NAME = "math.realtofft" [static]

Definition at line 4026 of file processor.h.

Referenced by get_name().


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