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

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

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

Referenced by process_inplace().

03709                 {
03710                         return NAME;
03711                 }

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

Definition at line 3713 of file processor.h.

03714                 {
03715                         return new RealToFFTProcessor();
03716                 }

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 2918 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.

02919 {
02920         if (!image) {
02921                 LOGWARN("NULL Image");
02922                 return;
02923         }
02924 
02925         //Note : real image only!
02926         if(image->is_complex()) {
02927                 LOGERR("%s Processor only operates on real images", get_name().c_str());
02928                 throw ImageFormatException("apply to real image only");
02929         }
02930 
02931         // Note : 2D only!
02932         int nz = image->get_zsize();
02933         if (nz > 1) {
02934                 LOGERR("%s Processor doesn't support 3D models", get_name().c_str());
02935                 throw ImageDimensionException("3D model not supported");
02936         }
02937 
02938         EMData *ff=image->do_fft();
02939         ff->ri2ap();
02940 
02941         int nx=image->get_xsize();
02942         int ny=image->get_ysize();
02943 
02944         int x,y;
02945         float norm=static_cast<float>(nx*ny);
02946 
02947         for (y=0; y<ny; y++) image->set_value_at(0,y,0);
02948 
02949         for (x=1; x<nx/2; x++) {
02950                 for (y=0; y<ny; y++) {
02951                         int y2;
02952                         if (y<ny/2) y2=y+ny/2;
02953                         else if (y==ny/2) y2=ny;
02954                         else y2=y-ny/2;
02955                         image->set_value_at(x,y,ff->get_value_at(nx-x*2,ny-y2)/norm);
02956                 }
02957         }
02958 
02959         for (x=nx/2; x<nx; x++) {
02960                 for (y=0; y<ny; y++) {
02961                         int y2;
02962                         if (y<ny/2) y2=y+ny/2;
02963                         else y2=y-ny/2;
02964                         image->set_value_at(x,y,ff->get_value_at(x*2-nx,y2)/norm);
02965                 }
02966         }
02967 
02968         image->update();
02969         if( ff )
02970         {
02971                 delete ff;
02972                 ff = 0;
02973         }
02974 }


Member Data Documentation

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

Definition at line 133 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Mon May 2 13:30:24 2011 for EMAN2 by  doxygen 1.3.9.1