#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 3562 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 3577 of file processor.h. 03578 { 03579 return "This will replace the image with a full-circle 2D fft amplitude rendering. Note that this renders amplitude, when intensity is more common."; 03580 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3567 of file processor.h. Referenced by process_inplace(). 03568 {
03569 return NAME;
03570 }
|
|
Definition at line 3572 of file processor.h. 03573 { 03574 return new RealToFFTProcessor(); 03575 }
|
|
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 2826 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. 02827 { 02828 if (!image) { 02829 LOGWARN("NULL Image"); 02830 return; 02831 } 02832 02833 //Note : real image only! 02834 if(image->is_complex()) { 02835 LOGERR("%s Processor only operates on real images", get_name().c_str()); 02836 throw ImageFormatException("apply to real image only"); 02837 } 02838 02839 // Note : 2D only! 02840 int nz = image->get_zsize(); 02841 if (nz > 1) { 02842 LOGERR("%s Processor doesn't support 3D models", get_name().c_str()); 02843 throw ImageDimensionException("3D model not supported"); 02844 } 02845 02846 EMData *ff=image->do_fft(); 02847 ff->ri2ap(); 02848 02849 int nx=image->get_xsize(); 02850 int ny=image->get_ysize(); 02851 02852 int x,y; 02853 float norm=static_cast<float>(nx*ny); 02854 02855 for (y=0; y<ny; y++) image->set_value_at(0,y,0); 02856 02857 for (x=1; x<nx/2; x++) { 02858 for (y=0; y<ny; y++) { 02859 int y2; 02860 if (y<ny/2) y2=y+ny/2; 02861 else if (y==ny/2) y2=ny; 02862 else y2=y-ny/2; 02863 image->set_value_at(x,y,ff->get_value_at(nx-x*2,ny-y2)/norm); 02864 } 02865 } 02866 02867 for (x=nx/2; x<nx; x++) { 02868 for (y=0; y<ny; y++) { 02869 int y2; 02870 if (y<ny/2) y2=y+ny/2; 02871 else y2=y-ny/2; 02872 image->set_value_at(x,y,ff->get_value_at(x*2-nx,y2)/norm); 02873 } 02874 } 02875 02876 image->update(); 02877 if( ff ) 02878 { 02879 delete ff; 02880 ff = 0; 02881 } 02882 }
|
|
Definition at line 128 of file processor.cpp. |