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 6745 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 6767 of file processor.h.

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

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 6750 of file processor.h.

Referenced by process_inplace().

06751                 {
06752                         return NAME;
06753                 }

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 6760 of file processor.h.

References EMAN::TypeDict::put().

06761                 {
06762                         TypeDict d;
06763                         d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel");
06764                         return d;
06765                 }

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

Definition at line 6755 of file processor.h.

06756                 {
06757                         return new RadialProcessor();
06758                 }

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 8066 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().

08067 {
08068         if (!image) {
08069                 LOGWARN("NULL Image");
08070                 return;
08071         }
08072 
08073         //Note : real image only!
08074         if(image->is_complex()) {
08075                 LOGERR("%s Processor only operates on real images", get_name().c_str());
08076                 throw ImageFormatException("apply to real image only");
08077         }
08078 
08079         vector<float> table = params["table"];
08080         vector<float>::size_type tsize = table.size();
08081 
08082         int nx = image->get_xsize();
08083         int ny = image->get_ysize();
08084         int nz = image->get_zsize();
08085 
08086         int nx2 = nx / 2;
08087         int ny2 = ny / 2;
08088         int nz2 = nz / 2;
08089         float sz[3];
08090         sz[0] = static_cast<float>(nx2);
08091         sz[1] = static_cast<float>(ny2);
08092         sz[2] = static_cast<float>(nz2);
08093         float szmax = *std::max_element(&sz[0], &sz[3]);
08094         float maxsize;
08095         if(nz>1) {
08096                 maxsize = (float)(1.8f * szmax);
08097         }
08098         else{
08099                 maxsize = (float)(1.5f * szmax);
08100         }
08101         for(int i=tsize+1; i<maxsize; i++) {
08102                 table.push_back(0.0f);
08103         }
08104 
08105         float dx = 1.0f / (float)nx;
08106         float dy = 1.0f / (float)ny;
08107         float dz = 1.0f / (float)nz;
08108         float dx2 = dx * dx;
08109         float dy2 = dy * dy;
08110         float dz2 = dz * dz;
08111         int iz, iy, ix, jz, jy, jx;
08112         float argx, argy, argz;
08113         float rf, df, f;
08114         int ir;
08115         for(iz=1; iz<=nz; iz++) {
08116                 jz = iz - 1;
08117                 if(jz > nz2) {
08118                         jz -= nz;
08119                 }
08120                 argz = float(jz*jz) * dz2;
08121 
08122                 for(iy=1; iy<=ny; iy++) {
08123                         jy = iy - 1;
08124                         if(jy > ny2) {
08125                                 jy -= ny;
08126                         }
08127                         argy = argz + float(jy*jy) * dy2;
08128 
08129                         for(ix=1; ix<=nx; ix++) {
08130                                 jx = ix -1;
08131                                 argx = argy + float(jx*jx)*dx2;
08132 
08133                                 rf = sqrt(argx)*2.0f*nx2;
08134                                 ir = int(rf);
08135                                 df = rf - float(ir);
08136                                 f = table[ir] + df*(table[ir+1]-table[ir]);
08137 
08138                                 (*image)(ix-1,iy-1,iz-1) *= f;
08139                         }
08140                 }
08141         }
08142 
08143         image->update();
08144 }


Member Data Documentation

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

Definition at line 215 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Mon May 2 13:30:56 2011 for EMAN2 by  doxygen 1.3.9.1