#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 3741 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 3756 of file processor.h. 03757 {
03758 return "This will replace the image with a full-circle 2D fft amplitude rendering. Note that this renders amplitude, when intensity is more common.";
03759 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3746 of file processor.h. Referenced by process_inplace(). 03747 {
03748 return NAME;
03749 }
|
|
|
Definition at line 3751 of file processor.h. 03752 {
03753 return new RealToFFTProcessor();
03754 }
|
|
|
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 2946 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. 02947 {
02948 if (!image) {
02949 LOGWARN("NULL Image");
02950 return;
02951 }
02952
02953 //Note : real image only!
02954 if(image->is_complex()) {
02955 LOGERR("%s Processor only operates on real images", get_name().c_str());
02956 throw ImageFormatException("apply to real image only");
02957 }
02958
02959 // Note : 2D only!
02960 int nz = image->get_zsize();
02961 if (nz > 1) {
02962 LOGERR("%s Processor doesn't support 3D models", get_name().c_str());
02963 throw ImageDimensionException("3D model not supported");
02964 }
02965
02966 EMData *ff=image->do_fft();
02967 ff->ri2ap();
02968
02969 int nx=image->get_xsize();
02970 int ny=image->get_ysize();
02971
02972 int x,y;
02973 float norm=static_cast<float>(nx*ny);
02974
02975 for (y=0; y<ny; y++) image->set_value_at(0,y,0);
02976
02977 for (x=1; x<nx/2; x++) {
02978 for (y=0; y<ny; y++) {
02979 int y2;
02980 if (y<ny/2) y2=y+ny/2;
02981 else if (y==ny/2) y2=ny;
02982 else y2=y-ny/2;
02983 image->set_value_at(x,y,ff->get_value_at(nx-x*2,ny-y2)/norm);
02984 }
02985 }
02986
02987 for (x=nx/2; x<nx; x++) {
02988 for (y=0; y<ny; y++) {
02989 int y2;
02990 if (y<ny/2) y2=y+ny/2;
02991 else y2=y-ny/2;
02992 image->set_value_at(x,y,ff->get_value_at(x*2-nx,y2)/norm);
02993 }
02994 }
02995
02996 image->update();
02997 if( ff )
02998 {
02999 delete ff;
03000 ff = 0;
03001 }
03002 }
|
|
|
Definition at line 139 of file processor.cpp. |
1.3.9.1