#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 3647 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 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 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3652 of file processor.h. Referenced by process_inplace(). 03653 {
03654 return NAME;
03655 }
|
|
Definition at line 3657 of file processor.h. 03658 { 03659 return new RealToFFTProcessor(); 03660 }
|
|
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 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 }
|
|
Definition at line 131 of file processor.cpp. |