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

static ProcessorNEW ()

Static Public Attributes

static 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 6777 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 6799 of file processor.h.

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

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

References NAME.

Referenced by process_inplace().

06783                 {
06784                         return NAME;
06785                 }

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

References EMAN::EMObject::FLOATARRAY, and EMAN::TypeDict::put().

06793                 {
06794                         TypeDict d;
06795                         d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel");
06796                         return d;
06797                 }

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

Definition at line 6787 of file processor.h.

06788                 {
06789                         return new RadialProcessor();
06790                 }

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 7992 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, EMAN::Processor::params, EMAN::Dict::size(), sqrt(), and EMAN::EMData::update().

07993 {
07994         if (!image) {
07995                 LOGWARN("NULL Image");
07996                 return;
07997         }
07998 
07999         //Note : real image only!
08000         if(image->is_complex()) {
08001                 LOGERR("%s Processor only operates on real images", get_name().c_str());
08002                 throw ImageFormatException("apply to real image only");
08003         }
08004 
08005         vector<float> table = params["table"];
08006         vector<float>::size_type tsize = table.size();
08007 
08008         int nx = image->get_xsize();
08009         int ny = image->get_ysize();
08010         int nz = image->get_zsize();
08011 
08012         int nx2 = nx / 2;
08013         int ny2 = ny / 2;
08014         int nz2 = nz / 2;
08015         float sz[3];
08016         sz[0] = static_cast<float>(nx2);
08017         sz[1] = static_cast<float>(ny2);
08018         sz[2] = static_cast<float>(nz2);
08019         float szmax = *std::max_element(&sz[0], &sz[3]);
08020         float maxsize;
08021         if(nz>1) {
08022                 maxsize = (float)(1.8f * szmax);
08023         }
08024         else{
08025                 maxsize = (float)(1.5f * szmax);
08026         }
08027         for(int i=tsize+1; i<maxsize; i++) {
08028                 table.push_back(0.0f);
08029         }
08030 
08031         float dx = 1.0f / (float)nx;
08032         float dy = 1.0f / (float)ny;
08033         float dz = 1.0f / (float)nz;
08034         float dx2 = dx * dx;
08035         float dy2 = dy * dy;
08036         float dz2 = dz * dz;
08037         int iz, iy, ix, jz, jy, jx;
08038         float argx, argy, argz;
08039         float rf, df, f;
08040         int ir;
08041         for(iz=1; iz<=nz; iz++) {
08042                 jz = iz - 1;
08043                 if(jz > nz2) {
08044                         jz -= nz;
08045                 }
08046                 argz = float(jz*jz) * dz2;
08047 
08048                 for(iy=1; iy<=ny; iy++) {
08049                         jy = iy - 1;
08050                         if(jy > ny2) {
08051                                 jy -= ny;
08052                         }
08053                         argy = argz + float(jy*jy) * dy2;
08054 
08055                         for(ix=1; ix<=nx; ix++) {
08056                                 jx = ix -1;
08057                                 argx = argy + float(jx*jx)*dx2;
08058 
08059                                 rf = sqrt(argx)*2.0f*nx2;
08060                                 ir = int(rf);
08061                                 df = rf - float(ir);
08062                                 f = table[ir] + df*(table[ir+1]-table[ir]);
08063 
08064                                 (*image)(ix-1,iy-1,iz-1) *= f;
08065                         }
08066                 }
08067         }
08068 
08069         image->update();
08070 }


Member Data Documentation

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

Definition at line 6804 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue May 25 17:17:42 2010 for EMAN2 by  doxygen 1.4.7