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

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

ProcessorNEW ()

Static Public Attributes

const string NAME = "math.realtofft"

Detailed Description

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

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

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

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

Referenced by process_inplace().

03653                 {
03654                         return NAME;
03655                 }

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

Definition at line 3657 of file processor.h.

03658                 {
03659                         return new RealToFFTProcessor();
03660                 }

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 2887 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(), nx, ny, EMAN::EMData::ri2ap(), EMAN::EMData::set_value_at(), EMAN::EMData::update(), x, and y.

02888 {
02889         if (!image) {
02890                 LOGWARN("NULL Image");
02891                 return;
02892         }
02893 
02894         //Note : real image only!
02895         if(image->is_complex()) {
02896                 LOGERR("%s Processor only operates on real images", get_name().c_str());
02897                 throw ImageFormatException("apply to real image only");
02898         }
02899 
02900         // Note : 2D only!
02901         int nz = image->get_zsize();
02902         if (nz > 1) {
02903                 LOGERR("%s Processor doesn't support 3D models", get_name().c_str());
02904                 throw ImageDimensionException("3D model not supported");
02905         }
02906 
02907         EMData *ff=image->do_fft();
02908         ff->ri2ap();
02909 
02910         int nx=image->get_xsize();
02911         int ny=image->get_ysize();
02912 
02913         int x,y;
02914         float norm=static_cast<float>(nx*ny);
02915 
02916         for (y=0; y<ny; y++) image->set_value_at(0,y,0);
02917 
02918         for (x=1; x<nx/2; x++) {
02919                 for (y=0; y<ny; y++) {
02920                         int y2;
02921                         if (y<ny/2) y2=y+ny/2;
02922                         else if (y==ny/2) y2=ny;
02923                         else y2=y-ny/2;
02924                         image->set_value_at(x,y,ff->get_value_at(nx-x*2,ny-y2)/norm);
02925                 }
02926         }
02927 
02928         for (x=nx/2; x<nx; x++) {
02929                 for (y=0; y<ny; y++) {
02930                         int y2;
02931                         if (y<ny/2) y2=y+ny/2;
02932                         else y2=y-ny/2;
02933                         image->set_value_at(x,y,ff->get_value_at(x*2-nx,y2)/norm);
02934                 }
02935         }
02936 
02937         image->update();
02938         if( ff )
02939         {
02940                 delete ff;
02941                 ff = 0;
02942         }
02943 }


Member Data Documentation

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

Definition at line 131 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Mar 10 23:00:39 2011 for EMAN2 by  doxygen 1.3.9.1