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

03603                 {
03604                         return "Fill zeroes at edges with nearest horizontal/vertical value.";
03605                 }

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

Referenced by process_inplace().

03594                 {
03595                         return NAME;
03596                 }

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

Definition at line 3597 of file processor.h.

03598                 {
03599                         return new SigmaZeroEdgeProcessor();
03600                 }

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

02885 {
02886         if (!image) {
02887                 LOGWARN("NULL Image");
02888                 return;
02889         }
02890 
02891         if (image->get_zsize() > 1) {
02892                 LOGERR("%s Processor doesn't support 3D model", get_name().c_str());
02893                 throw ImageDimensionException("3D model not supported");
02894         }
02895         float *d = image->get_data();
02896         int i = 0;
02897         int j = 0;
02898 
02899         int nx = image->get_xsize();
02900         int ny = image->get_ysize();
02901 
02902         for (j = 0; j < ny; j++) {
02903                 for (i = 0; i < nx - 1; i++) {
02904                         if (d[i + j * nx] != 0) {
02905                                 break;
02906                         }
02907                 }
02908 
02909                 float v = d[i + j * nx];
02910                 while (i >= 0) {
02911                         d[i + j * nx] = v;
02912                         i--;
02913                 }
02914 
02915                 for (i = nx - 1; i > 0; i--) {
02916                         if (d[i + j * nx] != 0)
02917                                 break;
02918                 }
02919                 v = d[i + j * nx];
02920                 while (i < nx) {
02921                         d[i + j * nx] = v;
02922                         i++;
02923                 }
02924         }
02925 
02926         for (i = 0; i < nx; i++) {
02927                 for (j = 0; j < ny; j++) {
02928                         if (d[i + j * nx] != 0)
02929                                 break;
02930                 }
02931 
02932                 float v = d[i + j * nx];
02933                 while (j >= 0) {
02934                         d[i + j * nx] = v;
02935                         j--;
02936                 }
02937 
02938                 for (j = ny - 1; j > 0; j--) {
02939                         if (d[i + j * nx] != 0)
02940                                 break;
02941                 }
02942                 v = d[i + j * nx];
02943                 while (j < ny) {
02944                         d[i + j * nx] = v;
02945                         j++;
02946                 }
02947         }
02948 
02949 
02950         image->update();
02951 }


Member Data Documentation

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

Definition at line 129 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 13:48:01 2010 for EMAN2 by  doxygen 1.3.9.1