#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 6783 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 6805 of file processor.h. 06806 { 06807 return "Multiply a real-space image by a radial function. 1 value / pixel, extending to corner. Missing values -> 0."; 06808 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6788 of file processor.h. Referenced by process_inplace(). 06789 {
06790 return NAME;
06791 }
|
|
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 6798 of file processor.h. References EMAN::TypeDict::put(). 06799 { 06800 TypeDict d; 06801 d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel"); 06802 return d; 06803 }
|
|
Definition at line 6793 of file processor.h. 06794 { 06795 return new RadialProcessor(); 06796 }
|
|
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 8094 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(). 08095 { 08096 if (!image) { 08097 LOGWARN("NULL Image"); 08098 return; 08099 } 08100 08101 //Note : real image only! 08102 if(image->is_complex()) { 08103 LOGERR("%s Processor only operates on real images", get_name().c_str()); 08104 throw ImageFormatException("apply to real image only"); 08105 } 08106 08107 vector<float> table = params["table"]; 08108 vector<float>::size_type tsize = table.size(); 08109 08110 int nx = image->get_xsize(); 08111 int ny = image->get_ysize(); 08112 int nz = image->get_zsize(); 08113 08114 int nx2 = nx / 2; 08115 int ny2 = ny / 2; 08116 int nz2 = nz / 2; 08117 float sz[3]; 08118 sz[0] = static_cast<float>(nx2); 08119 sz[1] = static_cast<float>(ny2); 08120 sz[2] = static_cast<float>(nz2); 08121 float szmax = *std::max_element(&sz[0], &sz[3]); 08122 float maxsize; 08123 if(nz>1) { 08124 maxsize = (float)(1.8f * szmax); 08125 } 08126 else{ 08127 maxsize = (float)(1.5f * szmax); 08128 } 08129 for(int i=tsize+1; i<maxsize; i++) { 08130 table.push_back(0.0f); 08131 } 08132 08133 float dx = 1.0f / (float)nx; 08134 float dy = 1.0f / (float)ny; 08135 float dz = 1.0f / (float)nz; 08136 float dx2 = dx * dx; 08137 float dy2 = dy * dy; 08138 float dz2 = dz * dz; 08139 int iz, iy, ix, jz, jy, jx; 08140 float argx, argy, argz; 08141 float rf, df, f; 08142 int ir; 08143 for(iz=1; iz<=nz; iz++) { 08144 jz = iz - 1; 08145 if(jz > nz2) { 08146 jz -= nz; 08147 } 08148 argz = float(jz*jz) * dz2; 08149 08150 for(iy=1; iy<=ny; iy++) { 08151 jy = iy - 1; 08152 if(jy > ny2) { 08153 jy -= ny; 08154 } 08155 argy = argz + float(jy*jy) * dy2; 08156 08157 for(ix=1; ix<=nx; ix++) { 08158 jx = ix -1; 08159 argx = argy + float(jx*jx)*dx2; 08160 08161 rf = sqrt(argx)*2.0f*nx2; 08162 ir = int(rf); 08163 df = rf - float(ir); 08164 f = table[ir] + df*(table[ir+1]-table[ir]); 08165 08166 (*image)(ix-1,iy-1,iz-1) *= f; 08167 } 08168 } 08169 } 08170 08171 image->update(); 08172 }
|
|
Definition at line 220 of file processor.cpp. |