EMAN::SigmaZeroEdgeProcessor Class Reference

Fill zeroes at edges with nearest horizontal/vertical value. More...

#include <processor.h>

Inheritance diagram for EMAN::SigmaZeroEdgeProcessor:

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

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.

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "mask.zeroedgefill"

Detailed Description

Fill zeroes at edges with nearest horizontal/vertical value.

Definition at line 3764 of file processor.h.


Member Function Documentation

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

03779                 {
03780                         return "Fill zeroes at edges with nearest horizontal/vertical value.";
03781                 }

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

References NAME.

Referenced by process_inplace().

03770                 {
03771                         return NAME;
03772                 }

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

Definition at line 3773 of file processor.h.

03774                 {
03775                         return new SigmaZeroEdgeProcessor();
03776                 }

void SigmaZeroEdgeProcessor::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 2929 of file processor.cpp.

References EMAN::EMData::get_data(), get_name(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, EMAN::EMData::update(), and v.

02930 {
02931         if (!image) {
02932                 LOGWARN("NULL Image");
02933                 return;
02934         }
02935 
02936         if (image->get_zsize() > 1) {
02937                 LOGERR("%s Processor doesn't support 3D model", get_name().c_str());
02938                 throw ImageDimensionException("3D model not supported");
02939         }
02940         float *d = image->get_data();
02941         int i = 0;
02942         int j = 0;
02943 
02944         int nx = image->get_xsize();
02945         int ny = image->get_ysize();
02946 
02947         for (j = 0; j < ny; j++) {
02948                 for (i = 0; i < nx - 1; i++) {
02949                         if (d[i + j * nx] != 0) {
02950                                 break;
02951                         }
02952                 }
02953 
02954                 float v = d[i + j * nx];
02955                 while (i >= 0) {
02956                         d[i + j * nx] = v;
02957                         i--;
02958                 }
02959 
02960                 for (i = nx - 1; i > 0; i--) {
02961                         if (d[i + j * nx] != 0)
02962                                 break;
02963                 }
02964                 v = d[i + j * nx];
02965                 while (i < nx) {
02966                         d[i + j * nx] = v;
02967                         i++;
02968                 }
02969         }
02970 
02971         for (i = 0; i < nx; i++) {
02972                 for (j = 0; j < ny; j++) {
02973                         if (d[i + j * nx] != 0)
02974                                 break;
02975                 }
02976 
02977                 float v = d[i + j * nx];
02978                 while (j >= 0) {
02979                         d[i + j * nx] = v;
02980                         j--;
02981                 }
02982 
02983                 for (j = ny - 1; j > 0; j--) {
02984                         if (d[i + j * nx] != 0)
02985                                 break;
02986                 }
02987                 v = d[i + j * nx];
02988                 while (j < ny) {
02989                         d[i + j * nx] = v;
02990                         j++;
02991                 }
02992         }
02993 
02994 
02995         image->update();
02996 }


Member Data Documentation

const string SigmaZeroEdgeProcessor::NAME = "mask.zeroedgefill" [static]

Definition at line 3783 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:02 2010 for EMAN2 by  doxygen 1.4.7