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

03858                 {
03859                         return "Fill zeroes at edges with nearest horizontal/vertical value.";
03860                 }

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

References NAME.

Referenced by process_inplace().

03849                 {
03850                         return NAME;
03851                 }

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

Definition at line 3852 of file processor.h.

03853                 {
03854                         return new SigmaZeroEdgeProcessor();
03855                 }

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

03100 {
03101         if (!image) {
03102                 LOGWARN("NULL Image");
03103                 return;
03104         }
03105 
03106         if (image->get_zsize() > 1) {
03107                 LOGERR("%s Processor doesn't support 3D model", get_name().c_str());
03108                 throw ImageDimensionException("3D model not supported");
03109         }
03110         float *d = image->get_data();
03111         int i = 0;
03112         int j = 0;
03113 
03114         int nx = image->get_xsize();
03115         int ny = image->get_ysize();
03116 
03117         for (j = 0; j < ny; j++) {
03118                 for (i = 0; i < nx - 1; i++) {
03119                         if (d[i + j * nx] != 0) {
03120                                 break;
03121                         }
03122                 }
03123 
03124                 float v = d[i + j * nx];
03125                 while (i >= 0) {
03126                         d[i + j * nx] = v;
03127                         i--;
03128                 }
03129 
03130                 for (i = nx - 1; i > 0; i--) {
03131                         if (d[i + j * nx] != 0)
03132                                 break;
03133                 }
03134                 v = d[i + j * nx];
03135                 while (i < nx) {
03136                         d[i + j * nx] = v;
03137                         i++;
03138                 }
03139         }
03140 
03141         for (i = 0; i < nx; i++) {
03142                 for (j = 0; j < ny; j++) {
03143                         if (d[i + j * nx] != 0)
03144                                 break;
03145                 }
03146 
03147                 float v = d[i + j * nx];
03148                 while (j >= 0) {
03149                         d[i + j * nx] = v;
03150                         j--;
03151                 }
03152 
03153                 for (j = ny - 1; j > 0; j--) {
03154                         if (d[i + j * nx] != 0)
03155                                 break;
03156                 }
03157                 v = d[i + j * nx];
03158                 while (j < ny) {
03159                         d[i + j * nx] = v;
03160                         j++;
03161                 }
03162         }
03163 
03164 
03165         image->update();
03166 }


Member Data Documentation

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

Definition at line 3862 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Fri Aug 10 16:36:12 2012 for EMAN2 by  doxygen 1.4.7