EMAN::MeanZeroEdgeProcessor Class Reference

Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2. More...

#include <processor.h>

Inheritance diagram for EMAN::MeanZeroEdgeProcessor:

Inheritance graph
[legend]
Collaboration diagram for EMAN::MeanZeroEdgeProcessor:

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.dampedzeroedgefill"

Detailed Description

Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.

Definition at line 3904 of file processor.h.


Member Function Documentation

string EMAN::MeanZeroEdgeProcessor::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 3919 of file processor.h.

03920                 {
03921                         return "Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.";
03922                 }

string EMAN::MeanZeroEdgeProcessor::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 3909 of file processor.h.

References NAME.

03910                 {
03911                         return NAME;
03912                 }

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

Definition at line 3914 of file processor.h.

03915                 {
03916                         return new MeanZeroEdgeProcessor();
03917                 }

void MeanZeroEdgeProcessor::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 3306 of file processor.cpp.

References EMAN::Dict::get(), EMAN::EMData::get_attr_dict(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, EMAN::EMData::update(), and v.

03307 {
03308         if (!image) {
03309                 LOGWARN("NULL Image");
03310                 return;
03311         }
03312         if (image->get_zsize() > 1) {
03313                 LOGERR("MeanZeroEdgeProcessor doesn't support 3D model");
03314                 throw ImageDimensionException("3D model not supported");
03315         }
03316 
03317         int nx = image->get_xsize();
03318         int ny = image->get_ysize();
03319         Dict dict = image->get_attr_dict();
03320         float mean_nonzero = dict.get("mean_nonzero");
03321 
03322         float *d = image->get_data();
03323         int i = 0;
03324         int j = 0;
03325 
03326         for (j = 0; j < ny; j++) {
03327                 for (i = 0; i < nx - 1; i++) {
03328                         if (d[i + j * nx] != 0) {
03329                                 break;
03330                         }
03331                 }
03332 
03333                 if (i == nx - 1) {
03334                         i = -1;
03335                 }
03336 
03337                 float v = d[i + j * nx] - mean_nonzero;
03338 
03339                 while (i >= 0) {
03340                         v *= 0.9f;
03341                         d[i + j * nx] = v + mean_nonzero;
03342                         i--;
03343                 }
03344 
03345 
03346                 for (i = nx - 1; i > 0; i--) {
03347                         if (d[i + j * nx] != 0) {
03348                                 break;
03349                         }
03350                 }
03351 
03352                 if (i == 0) {
03353                         i = nx;
03354                 }
03355 
03356                 v = d[i + j * nx] - mean_nonzero;
03357 
03358                 while (i < nx) {
03359                         v *= .9f;
03360                         d[i + j * nx] = v + mean_nonzero;
03361                         i++;
03362                 }
03363         }
03364 
03365 
03366         for (i = 0; i < nx; i++) {
03367                 for (j = 0; j < ny; j++) {
03368                         if (d[i + j * nx] != 0)
03369                                 break;
03370                 }
03371 
03372                 float v = d[i + j * nx] - mean_nonzero;
03373 
03374                 while (j >= 0) {
03375                         v *= .9f;
03376                         d[i + j * nx] = v + mean_nonzero;
03377                         j--;
03378                 }
03379 
03380                 for (j = ny - 1; j > 0; j--) {
03381                         if (d[i + j * nx] != 0)
03382                                 break;
03383                 }
03384 
03385                 v = d[i + j * nx] - mean_nonzero;
03386 
03387                 while (j < ny) {
03388                         v *= .9f;
03389                         d[i + j * nx] = v + mean_nonzero;
03390                         j++;
03391                 }
03392         }
03393 
03394         image->update();
03395 }


Member Data Documentation

const string MeanZeroEdgeProcessor::NAME = "mask.dampedzeroedgefill" [static]

Definition at line 3924 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:13 2012 for EMAN2 by  doxygen 1.4.7