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

03819                 {
03820                         return "Fill zeroes at edges with nearest horizontal/vertical value.";
03821                 }

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

References NAME.

Referenced by process_inplace().

03810                 {
03811                         return NAME;
03812                 }

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

Definition at line 3813 of file processor.h.

03814                 {
03815                         return new SigmaZeroEdgeProcessor();
03816                 }

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

03037 {
03038         if (!image) {
03039                 LOGWARN("NULL Image");
03040                 return;
03041         }
03042 
03043         if (image->get_zsize() > 1) {
03044                 LOGERR("%s Processor doesn't support 3D model", get_name().c_str());
03045                 throw ImageDimensionException("3D model not supported");
03046         }
03047         float *d = image->get_data();
03048         int i = 0;
03049         int j = 0;
03050 
03051         int nx = image->get_xsize();
03052         int ny = image->get_ysize();
03053 
03054         for (j = 0; j < ny; j++) {
03055                 for (i = 0; i < nx - 1; i++) {
03056                         if (d[i + j * nx] != 0) {
03057                                 break;
03058                         }
03059                 }
03060 
03061                 float v = d[i + j * nx];
03062                 while (i >= 0) {
03063                         d[i + j * nx] = v;
03064                         i--;
03065                 }
03066 
03067                 for (i = nx - 1; i > 0; i--) {
03068                         if (d[i + j * nx] != 0)
03069                                 break;
03070                 }
03071                 v = d[i + j * nx];
03072                 while (i < nx) {
03073                         d[i + j * nx] = v;
03074                         i++;
03075                 }
03076         }
03077 
03078         for (i = 0; i < nx; i++) {
03079                 for (j = 0; j < ny; j++) {
03080                         if (d[i + j * nx] != 0)
03081                                 break;
03082                 }
03083 
03084                 float v = d[i + j * nx];
03085                 while (j >= 0) {
03086                         d[i + j * nx] = v;
03087                         j--;
03088                 }
03089 
03090                 for (j = ny - 1; j > 0; j--) {
03091                         if (d[i + j * nx] != 0)
03092                                 break;
03093                 }
03094                 v = d[i + j * nx];
03095                 while (j < ny) {
03096                         d[i + j * nx] = v;
03097                         j++;
03098                 }
03099         }
03100 
03101 
03102         image->update();
03103 }


Member Data Documentation

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

Definition at line 3823 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 12:43:36 2010 for EMAN2 by  doxygen 1.4.7