#include <processor.h>
Inheritance diagram for EMAN::RealToFFTProcessor:
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 | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "math.realtofft" |
Definition at line 3819 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 3834 of file processor.h. 03835 { 03836 return "This will replace the image with a full-circle 2D fft amplitude rendering. Note that this renders amplitude, when intensity is more common."; 03837 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3824 of file processor.h. Referenced by process_inplace(). 03825 {
03826 return NAME;
03827 }
|
|
Definition at line 3829 of file processor.h. 03830 { 03831 return new RealToFFTProcessor(); 03832 }
|
|
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.
Implements EMAN::Processor. Definition at line 3043 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. 03044 { 03045 if (!image) { 03046 LOGWARN("NULL Image"); 03047 return; 03048 } 03049 03050 //Note : real image only! 03051 if(image->is_complex()) { 03052 LOGERR("%s Processor only operates on real images", get_name().c_str()); 03053 throw ImageFormatException("apply to real image only"); 03054 } 03055 03056 // Note : 2D only! 03057 int nz = image->get_zsize(); 03058 if (nz > 1) { 03059 LOGERR("%s Processor doesn't support 3D models", get_name().c_str()); 03060 throw ImageDimensionException("3D model not supported"); 03061 } 03062 03063 EMData *ff=image->do_fft(); 03064 ff->ri2ap(); 03065 03066 int nx=image->get_xsize(); 03067 int ny=image->get_ysize(); 03068 03069 int x,y; 03070 float norm=static_cast<float>(nx*ny); 03071 03072 for (y=0; y<ny; y++) image->set_value_at(0,y,0); 03073 03074 for (x=1; x<nx/2; x++) { 03075 for (y=0; y<ny; y++) { 03076 int y2; 03077 if (y<ny/2) y2=y+ny/2; 03078 else if (y==ny/2) y2=ny; 03079 else y2=y-ny/2; 03080 image->set_value_at(x,y,ff->get_value_at(nx-x*2,ny-y2)/norm); 03081 } 03082 } 03083 03084 for (x=nx/2; x<nx; x++) { 03085 for (y=0; y<ny; y++) { 03086 int y2; 03087 if (y<ny/2) y2=y+ny/2; 03088 else y2=y-ny/2; 03089 image->set_value_at(x,y,ff->get_value_at(x*2-nx,y2)/norm); 03090 } 03091 } 03092 03093 image->update(); 03094 if( ff ) 03095 { 03096 delete ff; 03097 ff = 0; 03098 } 03099 }
|
|
Definition at line 134 of file processor.cpp. |