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

EMAN::DiffBlockProcessor Class Reference

averages over cal_half_width, then sets the value in a local block More...

#include <processor.h>

Inheritance diagram for EMAN::DiffBlockProcessor:

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

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.
string get_desc () const
 Get the descrition of this specific processor.
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "eman1.filter.blockrange"

Detailed Description

averages over cal_half_width, then sets the value in a local block

Parameters:
cal_half_width cal_half_width is dx/dy for calculating an average
fill_half_width fill_half_width is dx/dy for fill/step

Definition at line 3094 of file processor.h.


Member Function Documentation

string EMAN::DiffBlockProcessor::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 3108 of file processor.h.

03109                 {
03110                         return "averages over cal_half_width, then sets the value in a local block";
03111                 }

string EMAN::DiffBlockProcessor::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 3099 of file processor.h.

Referenced by process_inplace().

03100                 {
03101                         return NAME;
03102                 }

TypeDict EMAN::DiffBlockProcessor::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 3113 of file processor.h.

References EMAN::TypeDict::put().

03114                 {
03115                         TypeDict d;
03116                         d.put("cal_half_width", EMObject::FLOAT, "cal_half_width is dx/dy for calculating an average");
03117                         d.put("fill_half_width", EMObject::FLOAT, "fill_half_width is dx/dy for fill/step");
03118                         return d;
03119                 }

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

Definition at line 3103 of file processor.h.

03104                 {
03105                         return new DiffBlockProcessor();
03106                 }

void DiffBlockProcessor::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 1740 of file processor.cpp.

References data, EMAN::EMData::get_data(), get_name(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, nx, ny, EMAN::EMData::update(), v0, x, and y.

01741 {
01742         if (!image) {
01743                 LOGWARN("NULL Image");
01744                 return;
01745         }
01746 
01747         int nz = image->get_zsize();
01748 
01749         if (nz > 1) {
01750                 LOGERR("%s Processor doesn't support 3D", get_name().c_str());
01751                 throw ImageDimensionException("3D model not supported");
01752         }
01753 
01754         int nx = image->get_xsize();
01755         int ny = image->get_ysize();
01756 
01757         int v1 = params["cal_half_width"];
01758         int v2 = params["fill_half_width"];
01759 
01760         int v0 = v1 > v2 ? v1 : v2;
01761 
01762         if (v2 <= 0) {
01763                 v2 = v1;
01764         }
01765 
01766         float *data = image->get_data();
01767 
01768         for (int y = v0; y <= ny - v0 - 1; y += v2) {
01769                 for (int x = v0; x <= nx - v0 - 1; x += v2) {
01770 
01771                         float sum = 0;
01772                         for (int y1 = y - v1; y1 <= y + v1; y1++) {
01773                                 for (int x1 = x - v1; x1 <= x + v1; x1++) {
01774                                         sum += data[x1 + y1 * nx];
01775                                 }
01776                         }
01777                         float mean = sum / ((v1 * 2 + 1) * (v1 * 2 + 1));
01778 
01779                         for (int j = y - v2; j <= y + v2; j++) {
01780                                 for (int i = x - v2; i <= x + v2; i++) {
01781                                         data[i + j * nx] = mean;
01782                                 }
01783                         }
01784                 }
01785         }
01786 
01787         image->update();
01788 }


Member Data Documentation

const string DiffBlockProcessor::NAME = "eman1.filter.blockrange" [static]
 

Definition at line 119 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Mar 10 23:00:35 2011 for EMAN2 by  doxygen 1.3.9.1