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

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

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

References NAME.

03912                 {
03913                         return NAME;
03914                 }

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

Definition at line 3916 of file processor.h.

03917                 {
03918                         return new MeanZeroEdgeProcessor();
03919                 }

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

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


Member Data Documentation

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

Definition at line 3926 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 12:44:08 2013 for EMAN2 by  doxygen 1.4.7