#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "math.realtofft" |
Definition at line 3738 of file processor.h.
string EMAN::RealToFFTProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 3753 of file processor.h.
03754 { 03755 return "This will replace the image with a full-circle 2D fft amplitude rendering. Note that this renders amplitude, when intensity is more common."; 03756 }
string EMAN::RealToFFTProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 3743 of file processor.h.
References NAME.
Referenced by process_inplace().
03744 { 03745 return NAME; 03746 }
static Processor* EMAN::RealToFFTProcessor::NEW | ( | ) | [inline, static] |
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 2871 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(), EMAN::EMData::ri2ap(), EMAN::EMData::set_value_at(), EMAN::EMData::update(), and x.
02872 { 02873 if (!image) { 02874 LOGWARN("NULL Image"); 02875 return; 02876 } 02877 02878 //Note : real image only! 02879 if(image->is_complex()) { 02880 LOGERR("%s Processor only operates on real images", get_name().c_str()); 02881 throw ImageFormatException("apply to real image only"); 02882 } 02883 02884 // Note : 2D only! 02885 int nz = image->get_zsize(); 02886 if (nz > 1) { 02887 LOGERR("%s Processor doesn't support 3D models", get_name().c_str()); 02888 throw ImageDimensionException("3D model not supported"); 02889 } 02890 02891 EMData *ff=image->do_fft(); 02892 ff->ri2ap(); 02893 02894 int nx=image->get_xsize(); 02895 int ny=image->get_ysize(); 02896 02897 int x,y; 02898 float norm=static_cast<float>(nx*ny); 02899 02900 for (y=0; y<ny; y++) image->set_value_at(0,y,0); 02901 02902 for (x=1; x<nx/2; x++) { 02903 for (y=0; y<ny; y++) { 02904 int y2; 02905 if (y<ny/2) y2=y+ny/2; 02906 else if (y==ny/2) y2=ny; 02907 else y2=y-ny/2; 02908 image->set_value_at(x,y,ff->get_value_at(nx-x*2,ny-y2)/norm); 02909 } 02910 } 02911 02912 for (x=nx/2; x<nx; x++) { 02913 for (y=0; y<ny; y++) { 02914 int y2; 02915 if (y<ny/2) y2=y+ny/2; 02916 else y2=y-ny/2; 02917 image->set_value_at(x,y,ff->get_value_at(x*2-nx,y2)/norm); 02918 } 02919 } 02920 02921 image->update(); 02922 if( ff ) 02923 { 02924 delete ff; 02925 ff = 0; 02926 } 02927 }
const string RealToFFTProcessor::NAME = "math.realtofft" [static] |