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

03688                 {
03689                         return "Fill zeroes at edges with nearest horizontal/vertical value.";
03690                 }

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

References NAME.

Referenced by process_inplace().

03679                 {
03680                         return NAME;
03681                 }

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

Definition at line 3682 of file processor.h.

03683                 {
03684                         return new SigmaZeroEdgeProcessor();
03685                 }

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

02946 {
02947         if (!image) {
02948                 LOGWARN("NULL Image");
02949                 return;
02950         }
02951 
02952         if (image->get_zsize() > 1) {
02953                 LOGERR("%s Processor doesn't support 3D model", get_name().c_str());
02954                 throw ImageDimensionException("3D model not supported");
02955         }
02956         float *d = image->get_data();
02957         int i = 0;
02958         int j = 0;
02959 
02960         int nx = image->get_xsize();
02961         int ny = image->get_ysize();
02962 
02963         for (j = 0; j < ny; j++) {
02964                 for (i = 0; i < nx - 1; i++) {
02965                         if (d[i + j * nx] != 0) {
02966                                 break;
02967                         }
02968                 }
02969 
02970                 float v = d[i + j * nx];
02971                 while (i >= 0) {
02972                         d[i + j * nx] = v;
02973                         i--;
02974                 }
02975 
02976                 for (i = nx - 1; i > 0; i--) {
02977                         if (d[i + j * nx] != 0)
02978                                 break;
02979                 }
02980                 v = d[i + j * nx];
02981                 while (i < nx) {
02982                         d[i + j * nx] = v;
02983                         i++;
02984                 }
02985         }
02986 
02987         for (i = 0; i < nx; i++) {
02988                 for (j = 0; j < ny; j++) {
02989                         if (d[i + j * nx] != 0)
02990                                 break;
02991                 }
02992 
02993                 float v = d[i + j * nx];
02994                 while (j >= 0) {
02995                         d[i + j * nx] = v;
02996                         j--;
02997                 }
02998 
02999                 for (j = ny - 1; j > 0; j--) {
03000                         if (d[i + j * nx] != 0)
03001                                 break;
03002                 }
03003                 v = d[i + j * nx];
03004                 while (j < ny) {
03005                         d[i + j * nx] = v;
03006                         j++;
03007                 }
03008         }
03009 
03010 
03011         image->update();
03012 }


Member Data Documentation

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

Definition at line 3692 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Mar 7 18:02:47 2011 for EMAN2 by  doxygen 1.4.7