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

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

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

References NAME.

Referenced by process_inplace().

06865                 {
06866                         return NAME;
06867                 }

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

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

06875                 {
06876                         TypeDict d;
06877                         d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel");
06878                         return d;
06879                 }

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

Definition at line 6869 of file processor.h.

06870                 {
06871                         return new RadialProcessor();
06872                 }

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

08253 {
08254         if (!image) {
08255                 LOGWARN("NULL Image");
08256                 return;
08257         }
08258 
08259         //Note : real image only!
08260         if(image->is_complex()) {
08261                 LOGERR("%s Processor only operates on real images", get_name().c_str());
08262                 throw ImageFormatException("apply to real image only");
08263         }
08264 
08265         vector<float> table = params["table"];
08266         vector<float>::size_type tsize = table.size();
08267 
08268         int nx = image->get_xsize();
08269         int ny = image->get_ysize();
08270         int nz = image->get_zsize();
08271 
08272         int nx2 = nx / 2;
08273         int ny2 = ny / 2;
08274         int nz2 = nz / 2;
08275         float sz[3];
08276         sz[0] = static_cast<float>(nx2);
08277         sz[1] = static_cast<float>(ny2);
08278         sz[2] = static_cast<float>(nz2);
08279         float szmax = *std::max_element(&sz[0], &sz[3]);
08280         float maxsize;
08281         if(nz>1) {
08282                 maxsize = (float)(1.8f * szmax);
08283         }
08284         else{
08285                 maxsize = (float)(1.5f * szmax);
08286         }
08287         for(int i=tsize+1; i<maxsize; i++) {
08288                 table.push_back(0.0f);
08289         }
08290 
08291         float dx = 1.0f / (float)nx;
08292         float dy = 1.0f / (float)ny;
08293         float dz = 1.0f / (float)nz;
08294         float dx2 = dx * dx;
08295         float dy2 = dy * dy;
08296         float dz2 = dz * dz;
08297         int iz, iy, ix, jz, jy, jx;
08298         float argx, argy, argz;
08299         float rf, df, f;
08300         int ir;
08301         for(iz=1; iz<=nz; iz++) {
08302                 jz = iz - 1;
08303                 if(jz > nz2) {
08304                         jz -= nz;
08305                 }
08306                 argz = float(jz*jz) * dz2;
08307 
08308                 for(iy=1; iy<=ny; iy++) {
08309                         jy = iy - 1;
08310                         if(jy > ny2) {
08311                                 jy -= ny;
08312                         }
08313                         argy = argz + float(jy*jy) * dy2;
08314 
08315                         for(ix=1; ix<=nx; ix++) {
08316                                 jx = ix -1;
08317                                 argx = argy + float(jx*jx)*dx2;
08318 
08319                                 rf = sqrt(argx)*2.0f*nx2;
08320                                 ir = int(rf);
08321                                 df = rf - float(ir);
08322                                 f = table[ir] + df*(table[ir+1]-table[ir]);
08323 
08324                                 (*image)(ix-1,iy-1,iz-1) *= f;
08325                         }
08326                 }
08327         }
08328 
08329         image->update();
08330 }


Member Data Documentation

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

Definition at line 6886 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Thu May 3 10:11:01 2012 for EMAN2 by  doxygen 1.4.7