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

03782                 {
03783                         return "Fill zeroes at edges with nearest horizontal/vertical value.";
03784                 }

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

Referenced by process_inplace().

03773                 {
03774                         return NAME;
03775                 }

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

Definition at line 3776 of file processor.h.

03777                 {
03778                         return new SigmaZeroEdgeProcessor();
03779                 }

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

03005 {
03006         if (!image) {
03007                 LOGWARN("NULL Image");
03008                 return;
03009         }
03010 
03011         if (image->get_zsize() > 1) {
03012                 LOGERR("%s Processor doesn't support 3D model", get_name().c_str());
03013                 throw ImageDimensionException("3D model not supported");
03014         }
03015         float *d = image->get_data();
03016         int i = 0;
03017         int j = 0;
03018 
03019         int nx = image->get_xsize();
03020         int ny = image->get_ysize();
03021 
03022         for (j = 0; j < ny; j++) {
03023                 for (i = 0; i < nx - 1; i++) {
03024                         if (d[i + j * nx] != 0) {
03025                                 break;
03026                         }
03027                 }
03028 
03029                 float v = d[i + j * nx];
03030                 while (i >= 0) {
03031                         d[i + j * nx] = v;
03032                         i--;
03033                 }
03034 
03035                 for (i = nx - 1; i > 0; i--) {
03036                         if (d[i + j * nx] != 0)
03037                                 break;
03038                 }
03039                 v = d[i + j * nx];
03040                 while (i < nx) {
03041                         d[i + j * nx] = v;
03042                         i++;
03043                 }
03044         }
03045 
03046         for (i = 0; i < nx; i++) {
03047                 for (j = 0; j < ny; j++) {
03048                         if (d[i + j * nx] != 0)
03049                                 break;
03050                 }
03051 
03052                 float v = d[i + j * nx];
03053                 while (j >= 0) {
03054                         d[i + j * nx] = v;
03055                         j--;
03056                 }
03057 
03058                 for (j = ny - 1; j > 0; j--) {
03059                         if (d[i + j * nx] != 0)
03060                                 break;
03061                 }
03062                 v = d[i + j * nx];
03063                 while (j < ny) {
03064                         d[i + j * nx] = v;
03065                         j++;
03066                 }
03067         }
03068 
03069 
03070         image->update();
03071 }


Member Data Documentation

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

Definition at line 140 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:52:13 2011 for EMAN2 by  doxygen 1.3.9.1