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

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

ProcessorNEW ()

Static Public Attributes

const string NAME = "mask.zeroedgefill"

Detailed Description

Fill zeroes at edges with nearest horizontal/vertical value.

Definition at line 3798 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 3812 of file processor.h.

03813                 {
03814                         return "Fill zeroes at edges with nearest horizontal/vertical value.";
03815                 }

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

Referenced by process_inplace().

03804                 {
03805                         return NAME;
03806                 }

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

Definition at line 3807 of file processor.h.

03808                 {
03809                         return new SigmaZeroEdgeProcessor();
03810                 }

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 3023 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, nx, ny, EMAN::EMData::update(), and v.

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


Member Data Documentation

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

Definition at line 135 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Nov 17 12:46:15 2011 for EMAN2 by  doxygen 1.3.9.1