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 3778 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 3793 of file processor.h.

03794                 {
03795                         return "This will replace the image with a full-circle 2D fft amplitude rendering. Note that this renders amplitude, when intensity is more common.";
03796                 }

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 3783 of file processor.h.

References NAME.

Referenced by process_inplace().

03784                 {
03785                         return NAME;
03786                 }

static Processor* EMAN::RealToFFTProcessor::NEW (  )  [inline, static]

Definition at line 3788 of file processor.h.

03789                 {
03790                         return new RealToFFTProcessor();
03791                 }

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:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 2978 of file processor.cpp.

References EMAN::EMData::do_fft(), 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(), EMAN::EMData::ri2ap(), EMAN::EMData::set_value_at(), EMAN::EMData::update(), and x.

02979 {
02980         if (!image) {
02981                 LOGWARN("NULL Image");
02982                 return;
02983         }
02984 
02985         //Note : real image only!
02986         if(image->is_complex()) {
02987                 LOGERR("%s Processor only operates on real images", get_name().c_str());
02988                 throw ImageFormatException("apply to real image only");
02989         }
02990 
02991         // Note : 2D only!
02992         int nz = image->get_zsize();
02993         if (nz > 1) {
02994                 LOGERR("%s Processor doesn't support 3D models", get_name().c_str());
02995                 throw ImageDimensionException("3D model not supported");
02996         }
02997 
02998         EMData *ff=image->do_fft();
02999         ff->ri2ap();
03000 
03001         int nx=image->get_xsize();
03002         int ny=image->get_ysize();
03003 
03004         int x,y;
03005         float norm=static_cast<float>(nx*ny);
03006 
03007         for (y=0; y<ny; y++) image->set_value_at(0,y,0);
03008 
03009         for (x=1; x<nx/2; x++) {
03010                 for (y=0; y<ny; y++) {
03011                         int y2;
03012                         if (y<ny/2) y2=y+ny/2;
03013                         else if (y==ny/2) y2=ny;
03014                         else y2=y-ny/2;
03015                         image->set_value_at(x,y,ff->get_value_at(nx-x*2,ny-y2)/norm);
03016                 }
03017         }
03018 
03019         for (x=nx/2; x<nx; x++) {
03020                 for (y=0; y<ny; y++) {
03021                         int y2;
03022                         if (y<ny/2) y2=y+ny/2;
03023                         else y2=y-ny/2;
03024                         image->set_value_at(x,y,ff->get_value_at(x*2-nx,y2)/norm);
03025                 }
03026         }
03027 
03028         image->update();
03029         if( ff )
03030         {
03031                 delete ff;
03032                 ff = 0;
03033         }
03034 }


Member Data Documentation

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

Definition at line 3798 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 12:43:35 2010 for EMAN2 by  doxygen 1.4.7