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

03744                 {
03745                         return "Fill zeroes at edges with nearest horizontal/vertical value.";
03746                 }

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

References NAME.

Referenced by process_inplace().

03735                 {
03736                         return NAME;
03737                 }

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

Definition at line 3738 of file processor.h.

03739                 {
03740                         return new SigmaZeroEdgeProcessor();
03741                 }

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 2976 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.

02977 {
02978         if (!image) {
02979                 LOGWARN("NULL Image");
02980                 return;
02981         }
02982 
02983         if (image->get_zsize() > 1) {
02984                 LOGERR("%s Processor doesn't support 3D model", get_name().c_str());
02985                 throw ImageDimensionException("3D model not supported");
02986         }
02987         float *d = image->get_data();
02988         int i = 0;
02989         int j = 0;
02990 
02991         int nx = image->get_xsize();
02992         int ny = image->get_ysize();
02993 
02994         for (j = 0; j < ny; j++) {
02995                 for (i = 0; i < nx - 1; i++) {
02996                         if (d[i + j * nx] != 0) {
02997                                 break;
02998                         }
02999                 }
03000 
03001                 float v = d[i + j * nx];
03002                 while (i >= 0) {
03003                         d[i + j * nx] = v;
03004                         i--;
03005                 }
03006 
03007                 for (i = nx - 1; i > 0; i--) {
03008                         if (d[i + j * nx] != 0)
03009                                 break;
03010                 }
03011                 v = d[i + j * nx];
03012                 while (i < nx) {
03013                         d[i + j * nx] = v;
03014                         i++;
03015                 }
03016         }
03017 
03018         for (i = 0; i < nx; i++) {
03019                 for (j = 0; j < ny; j++) {
03020                         if (d[i + j * nx] != 0)
03021                                 break;
03022                 }
03023 
03024                 float v = d[i + j * nx];
03025                 while (j >= 0) {
03026                         d[i + j * nx] = v;
03027                         j--;
03028                 }
03029 
03030                 for (j = ny - 1; j > 0; j--) {
03031                         if (d[i + j * nx] != 0)
03032                                 break;
03033                 }
03034                 v = d[i + j * nx];
03035                 while (j < ny) {
03036                         d[i + j * nx] = v;
03037                         j++;
03038                 }
03039         }
03040 
03041 
03042         image->update();
03043 }


Member Data Documentation

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

Definition at line 3748 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon May 2 13:30:30 2011 for EMAN2 by  doxygen 1.4.7