Public Member Functions | Static Public Member Functions | Static Public Attributes
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
Collaboration diagram for EMAN::RadialProcessor:
Collaboration graph

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.

tablea radial table for multiplication
ImageFormatExceptionthis filter only apply to real image

Definition at line 7272 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.

The description of this processor.

Implements EMAN::Processor.

Definition at line 7294 of file processor.h.

                        return "Multiply a real-space image by a radial function. 1 value / pixel, extending to corner. Missing values -> 0.";
string EMAN::RadialProcessor::get_name ( ) const [inline, virtual]

Get the processor's name.

Each processor is identified by a unique name.

The processor's name.

Implements EMAN::Processor.

Definition at line 7277 of file processor.h.

References NAME.

                        return NAME;
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.

A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 7287 of file processor.h.

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

                        TypeDict d;
                        d.put("table", EMObject::FLOATARRAY, "Radial array of floats, 1 float/pixel");
                        return d;
static Processor* EMAN::RadialProcessor::NEW ( ) [inline, static]

Definition at line 7282 of file processor.h.

                        return new RadialProcessor();
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.

imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 8771 of file processor.cpp.

References EMAN::CutoffBlockProcessor::get_name(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageFormatException, EMAN::EMData::is_complex(), LOGERR, LOGWARN, nx, ny, EMAN::Processor::params, EMAN::Dict::size(), sqrt(), and EMAN::EMData::update().

        if (!image) {
                LOGWARN("NULL Image");

        //Note : real image only!
        if(image->is_complex()) {
                LOGERR("%s Processor only operates on real images", get_name().c_str());
                throw ImageFormatException("apply to real image only");

        vector<float> table = params["table"];
        vector<float>::size_type tsize = table.size();

        int nx = image->get_xsize();
        int ny = image->get_ysize();
        int nz = image->get_zsize();

        int nx2 = nx / 2;
        int ny2 = ny / 2;
        int nz2 = nz / 2;
        float sz[3];
        sz[0] = static_cast<float>(nx2);
        sz[1] = static_cast<float>(ny2);
        sz[2] = static_cast<float>(nz2);
        float szmax = *std::max_element(&sz[0], &sz[3]);
        float maxsize;
        if(nz>1) {
                maxsize = (float)(1.8f * szmax);
                maxsize = (float)(1.5f * szmax);
        for(int i=tsize+1; i<maxsize; i++) {

        float dx = 1.0f / (float)nx;
        float dy = 1.0f / (float)ny;
        float dz = 1.0f / (float)nz;
        float dx2 = dx * dx;
        float dy2 = dy * dy;
        float dz2 = dz * dz;
        int iz, iy, ix, jz, jy, jx;
        float argx, argy, argz;
        float rf, df, f;
        int ir;
        for(iz=1; iz<=nz; iz++) {
                jz = iz - 1;
                if(jz > nz2) {
                        jz -= nz;
                argz = float(jz*jz) * dz2;

                for(iy=1; iy<=ny; iy++) {
                        jy = iy - 1;
                        if(jy > ny2) {
                                jy -= ny;
                        argy = argz + float(jy*jy) * dy2;

                        for(ix=1; ix<=nx; ix++) {
                                jx = ix -1;
                                argx = argy + float(jx*jx)*dx2;

                                rf = sqrt(argx)*2.0f*nx2;
                                ir = int(rf);
                                df = rf - float(ir);
                                f = table[ir] + df*(table[ir+1]-table[ir]);

                                (*image)(ix-1,iy-1,iz-1) *= f;


Member Data Documentation

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

Definition at line 7299 of file processor.h.

Referenced by get_name().

The documentation for this class was generated from the following files: