Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::RadialProcessor Class Reference

Perform a multiplication of real image with a radial table. More...

#include <processor.h>

Inheritance diagram for EMAN::RadialProcessor:

Inheritance graph
[legend]
Collaboration diagram for EMAN::RadialProcessor:

Collaboration graph
[legend]
List of all members.

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

ProcessorNEW ()

Static Public Attributes

const string NAME = "mask.radialprofile"

Detailed Description

Perform a multiplication of real image with a radial table.

Parameters:
table a radial table for multiplication
Exceptions:
ImageFormatException this filter only apply to real image

Definition at line 6900 of file processor.h.


Member Function Documentation

string EMAN::RadialProcessor::get_desc  )  const [inline, virtual]
 

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns:
The description of this processor.

Implements EMAN::Processor.

Definition at line 6922 of file processor.h.

06923                 {
06924                         return "Multiply a real-space image by a radial function. 1 value / pixel, extending to corner. Missing values -> 0.";
06925                 }

string EMAN::RadialProcessor::get_name  )  const [inline, virtual]
 

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 6905 of file processor.h.

Referenced by process_inplace().

06906                 {
06907                         return NAME;
06908                 }

TypeDict EMAN::RadialProcessor::get_param_types  )  const [inline, virtual]
 

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 6915 of file processor.h.

References EMAN::TypeDict::put().

06916                 {
06917                         TypeDict d;
06918                         d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel");
06919                         return d;
06920                 }

Processor* EMAN::RadialProcessor::NEW  )  [inline, static]
 

Definition at line 6910 of file processor.h.

06911                 {
06912                         return new RadialProcessor();
06913                 }

void RadialProcessor::process_inplace EMData image  )  [virtual]
 

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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 8332 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().

08333 {
08334         if (!image) {
08335                 LOGWARN("NULL Image");
08336                 return;
08337         }
08338 
08339         //Note : real image only!
08340         if(image->is_complex()) {
08341                 LOGERR("%s Processor only operates on real images", get_name().c_str());
08342                 throw ImageFormatException("apply to real image only");
08343         }
08344 
08345         vector<float> table = params["table"];
08346         vector<float>::size_type tsize = table.size();
08347 
08348         int nx = image->get_xsize();
08349         int ny = image->get_ysize();
08350         int nz = image->get_zsize();
08351 
08352         int nx2 = nx / 2;
08353         int ny2 = ny / 2;
08354         int nz2 = nz / 2;
08355         float sz[3];
08356         sz[0] = static_cast<float>(nx2);
08357         sz[1] = static_cast<float>(ny2);
08358         sz[2] = static_cast<float>(nz2);
08359         float szmax = *std::max_element(&sz[0], &sz[3]);
08360         float maxsize;
08361         if(nz>1) {
08362                 maxsize = (float)(1.8f * szmax);
08363         }
08364         else{
08365                 maxsize = (float)(1.5f * szmax);
08366         }
08367         for(int i=tsize+1; i<maxsize; i++) {
08368                 table.push_back(0.0f);
08369         }
08370 
08371         float dx = 1.0f / (float)nx;
08372         float dy = 1.0f / (float)ny;
08373         float dz = 1.0f / (float)nz;
08374         float dx2 = dx * dx;
08375         float dy2 = dy * dy;
08376         float dz2 = dz * dz;
08377         int iz, iy, ix, jz, jy, jx;
08378         float argx, argy, argz;
08379         float rf, df, f;
08380         int ir;
08381         for(iz=1; iz<=nz; iz++) {
08382                 jz = iz - 1;
08383                 if(jz > nz2) {
08384                         jz -= nz;
08385                 }
08386                 argz = float(jz*jz) * dz2;
08387 
08388                 for(iy=1; iy<=ny; iy++) {
08389                         jy = iy - 1;
08390                         if(jy > ny2) {
08391                                 jy -= ny;
08392                         }
08393                         argy = argz + float(jy*jy) * dy2;
08394 
08395                         for(ix=1; ix<=nx; ix++) {
08396                                 jx = ix -1;
08397                                 argx = argy + float(jx*jx)*dx2;
08398 
08399                                 rf = sqrt(argx)*2.0f*nx2;
08400                                 ir = int(rf);
08401                                 df = rf - float(ir);
08402                                 f = table[ir] + df*(table[ir+1]-table[ir]);
08403 
08404                                 (*image)(ix-1,iy-1,iz-1) *= f;
08405                         }
08406                 }
08407         }
08408 
08409         image->update();
08410 }


Member Data Documentation

const string RadialProcessor::NAME = "mask.radialprofile" [static]
 

Definition at line 216 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 13:49:16 2013 for EMAN2 by  doxygen 1.3.9.1