#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 6814 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 6836 of file processor.h. 06837 { 06838 return "Multiply a real-space image by a radial function. 1 value / pixel, extending to corner. Missing values -> 0."; 06839 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6819 of file processor.h. Referenced by process_inplace(). 06820 {
06821 return NAME;
06822 }
|
|
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 6829 of file processor.h. References EMAN::TypeDict::put(). 06830 { 06831 TypeDict d; 06832 d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel"); 06833 return d; 06834 }
|
|
Definition at line 6824 of file processor.h. 06825 { 06826 return new RadialProcessor(); 06827 }
|
|
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 8180 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(). 08181 { 08182 if (!image) { 08183 LOGWARN("NULL Image"); 08184 return; 08185 } 08186 08187 //Note : real image only! 08188 if(image->is_complex()) { 08189 LOGERR("%s Processor only operates on real images", get_name().c_str()); 08190 throw ImageFormatException("apply to real image only"); 08191 } 08192 08193 vector<float> table = params["table"]; 08194 vector<float>::size_type tsize = table.size(); 08195 08196 int nx = image->get_xsize(); 08197 int ny = image->get_ysize(); 08198 int nz = image->get_zsize(); 08199 08200 int nx2 = nx / 2; 08201 int ny2 = ny / 2; 08202 int nz2 = nz / 2; 08203 float sz[3]; 08204 sz[0] = static_cast<float>(nx2); 08205 sz[1] = static_cast<float>(ny2); 08206 sz[2] = static_cast<float>(nz2); 08207 float szmax = *std::max_element(&sz[0], &sz[3]); 08208 float maxsize; 08209 if(nz>1) { 08210 maxsize = (float)(1.8f * szmax); 08211 } 08212 else{ 08213 maxsize = (float)(1.5f * szmax); 08214 } 08215 for(int i=tsize+1; i<maxsize; i++) { 08216 table.push_back(0.0f); 08217 } 08218 08219 float dx = 1.0f / (float)nx; 08220 float dy = 1.0f / (float)ny; 08221 float dz = 1.0f / (float)nz; 08222 float dx2 = dx * dx; 08223 float dy2 = dy * dy; 08224 float dz2 = dz * dz; 08225 int iz, iy, ix, jz, jy, jx; 08226 float argx, argy, argz; 08227 float rf, df, f; 08228 int ir; 08229 for(iz=1; iz<=nz; iz++) { 08230 jz = iz - 1; 08231 if(jz > nz2) { 08232 jz -= nz; 08233 } 08234 argz = float(jz*jz) * dz2; 08235 08236 for(iy=1; iy<=ny; iy++) { 08237 jy = iy - 1; 08238 if(jy > ny2) { 08239 jy -= ny; 08240 } 08241 argy = argz + float(jy*jy) * dy2; 08242 08243 for(ix=1; ix<=nx; ix++) { 08244 jx = ix -1; 08245 argx = argy + float(jx*jx)*dx2; 08246 08247 rf = sqrt(argx)*2.0f*nx2; 08248 ir = int(rf); 08249 df = rf - float(ir); 08250 f = table[ir] + df*(table[ir+1]-table[ir]); 08251 08252 (*image)(ix-1,iy-1,iz-1) *= f; 08253 } 08254 } 08255 } 08256 08257 image->update(); 08258 }
|
|
Definition at line 215 of file processor.cpp. |