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

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


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 Thu May 3 10:10:18 2012 for EMAN2 by  doxygen 1.4.7