#include <processor.h>
Inheritance diagram for EMAN::RadialProcessor:
Public Member Functions | |
void | process_inplace (EMData *image) |
To process an image in-place. | |
string | get_name () const |
Get the processor's name. | |
TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
string | get_desc () const |
Get the descrition of this specific processor. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "mask.radialprofile" |
table | a radial table for multiplication |
ImageFormatException | this filter only apply to real image |
Definition at line 6604 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 6626 of file processor.h. 06627 { 06628 return "Multiply a real-space image by a radial function. 1 value / pixel, extending to corner. Missing values -> 0."; 06629 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6609 of file processor.h. Referenced by process_inplace(). 06610 {
06611 return NAME;
06612 }
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor. Definition at line 6619 of file processor.h. References EMAN::TypeDict::put(). 06620 { 06621 TypeDict d; 06622 d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel"); 06623 return d; 06624 }
|
|
Definition at line 6614 of file processor.h. 06615 { 06616 return new RadialProcessor(); 06617 }
|
|
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 7997 of file processor.cpp. References get_name(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageFormatException, EMAN::EMData::is_complex(), LOGERR, LOGWARN, nx, ny, EMAN::Dict::size(), sqrt(), and EMAN::EMData::update(). 07998 { 07999 if (!image) { 08000 LOGWARN("NULL Image"); 08001 return; 08002 } 08003 08004 //Note : real image only! 08005 if(image->is_complex()) { 08006 LOGERR("%s Processor only operates on real images", get_name().c_str()); 08007 throw ImageFormatException("apply to real image only"); 08008 } 08009 08010 vector<float> table = params["table"]; 08011 vector<float>::size_type tsize = table.size(); 08012 08013 int nx = image->get_xsize(); 08014 int ny = image->get_ysize(); 08015 int nz = image->get_zsize(); 08016 08017 int nx2 = nx / 2; 08018 int ny2 = ny / 2; 08019 int nz2 = nz / 2; 08020 float sz[3]; 08021 sz[0] = static_cast<float>(nx2); 08022 sz[1] = static_cast<float>(ny2); 08023 sz[2] = static_cast<float>(nz2); 08024 float szmax = *std::max_element(&sz[0], &sz[3]); 08025 float maxsize; 08026 if(nz>1) { 08027 maxsize = (float)(1.8f * szmax); 08028 } 08029 else{ 08030 maxsize = (float)(1.5f * szmax); 08031 } 08032 for(int i=tsize+1; i<maxsize; i++) { 08033 table.push_back(0.0f); 08034 } 08035 08036 float dx = 1.0f / (float)nx; 08037 float dy = 1.0f / (float)ny; 08038 float dz = 1.0f / (float)nz; 08039 float dx2 = dx * dx; 08040 float dy2 = dy * dy; 08041 float dz2 = dz * dz; 08042 int iz, iy, ix, jz, jy, jx; 08043 float argx, argy, argz; 08044 float rf, df, f; 08045 int ir; 08046 for(iz=1; iz<=nz; iz++) { 08047 jz = iz - 1; 08048 if(jz > nz2) { 08049 jz -= nz; 08050 } 08051 argz = float(jz*jz) * dz2; 08052 08053 for(iy=1; iy<=ny; iy++) { 08054 jy = iy - 1; 08055 if(jy > ny2) { 08056 jy -= ny; 08057 } 08058 argy = argz + float(jy*jy) * dy2; 08059 08060 for(ix=1; ix<=nx; ix++) { 08061 jx = ix -1; 08062 argx = argy + float(jx*jx)*dx2; 08063 08064 rf = sqrt(argx)*2.0f*nx2; 08065 ir = int(rf); 08066 df = rf - float(ir); 08067 f = table[ir] + df*(table[ir+1]-table[ir]); 08068 08069 (*image)(ix-1,iy-1,iz-1) *= f; 08070 } 08071 } 08072 } 08073 08074 image->update(); 08075 }
|
|
Definition at line 210 of file processor.cpp. |