#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 6776 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 6798 of file processor.h. 06799 { 06800 return "Multiply a real-space image by a radial function. 1 value / pixel, extending to corner. Missing values -> 0."; 06801 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6781 of file processor.h. Referenced by process_inplace(). 06782 {
06783 return NAME;
06784 }
|
|
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 6791 of file processor.h. References EMAN::TypeDict::put(). 06792 { 06793 TypeDict d; 06794 d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel"); 06795 return d; 06796 }
|
|
Definition at line 6786 of file processor.h. 06787 { 06788 return new RadialProcessor(); 06789 }
|
|
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 7961 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(). 07962 { 07963 if (!image) { 07964 LOGWARN("NULL Image"); 07965 return; 07966 } 07967 07968 //Note : real image only! 07969 if(image->is_complex()) { 07970 LOGERR("%s Processor only operates on real images", get_name().c_str()); 07971 throw ImageFormatException("apply to real image only"); 07972 } 07973 07974 vector<float> table = params["table"]; 07975 vector<float>::size_type tsize = table.size(); 07976 07977 int nx = image->get_xsize(); 07978 int ny = image->get_ysize(); 07979 int nz = image->get_zsize(); 07980 07981 int nx2 = nx / 2; 07982 int ny2 = ny / 2; 07983 int nz2 = nz / 2; 07984 float sz[3]; 07985 sz[0] = static_cast<float>(nx2); 07986 sz[1] = static_cast<float>(ny2); 07987 sz[2] = static_cast<float>(nz2); 07988 float szmax = *std::max_element(&sz[0], &sz[3]); 07989 float maxsize; 07990 if(nz>1) { 07991 maxsize = (float)(1.8f * szmax); 07992 } 07993 else{ 07994 maxsize = (float)(1.5f * szmax); 07995 } 07996 for(int i=tsize+1; i<maxsize; i++) { 07997 table.push_back(0.0f); 07998 } 07999 08000 float dx = 1.0f / (float)nx; 08001 float dy = 1.0f / (float)ny; 08002 float dz = 1.0f / (float)nz; 08003 float dx2 = dx * dx; 08004 float dy2 = dy * dy; 08005 float dz2 = dz * dz; 08006 int iz, iy, ix, jz, jy, jx; 08007 float argx, argy, argz; 08008 float rf, df, f; 08009 int ir; 08010 for(iz=1; iz<=nz; iz++) { 08011 jz = iz - 1; 08012 if(jz > nz2) { 08013 jz -= nz; 08014 } 08015 argz = float(jz*jz) * dz2; 08016 08017 for(iy=1; iy<=ny; iy++) { 08018 jy = iy - 1; 08019 if(jy > ny2) { 08020 jy -= ny; 08021 } 08022 argy = argz + float(jy*jy) * dy2; 08023 08024 for(ix=1; ix<=nx; ix++) { 08025 jx = ix -1; 08026 argx = argy + float(jx*jx)*dx2; 08027 08028 rf = sqrt(argx)*2.0f*nx2; 08029 ir = int(rf); 08030 df = rf - float(ir); 08031 f = table[ir] + df*(table[ir+1]-table[ir]); 08032 08033 (*image)(ix-1,iy-1,iz-1) *= f; 08034 } 08035 } 08036 } 08037 08038 image->update(); 08039 }
|
|
Definition at line 215 of file processor.cpp. |