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

03750                 {
03751                         return "Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.";
03752                 }

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

References NAME.

03740                 {
03741                         return NAME;
03742                 }

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

Definition at line 3744 of file processor.h.

03745                 {
03746                         return new MeanZeroEdgeProcessor();
03747                 }

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

03153 {
03154         if (!image) {
03155                 LOGWARN("NULL Image");
03156                 return;
03157         }
03158         if (image->get_zsize() > 1) {
03159                 LOGERR("MeanZeroEdgeProcessor doesn't support 3D model");
03160                 throw ImageDimensionException("3D model not supported");
03161         }
03162 
03163         int nx = image->get_xsize();
03164         int ny = image->get_ysize();
03165         Dict dict = image->get_attr_dict();
03166         float mean_nonzero = dict.get("mean_nonzero");
03167 
03168         float *d = image->get_data();
03169         int i = 0;
03170         int j = 0;
03171 
03172         for (j = 0; j < ny; j++) {
03173                 for (i = 0; i < nx - 1; i++) {
03174                         if (d[i + j * nx] != 0) {
03175                                 break;
03176                         }
03177                 }
03178 
03179                 if (i == nx - 1) {
03180                         i = -1;
03181                 }
03182 
03183                 float v = d[i + j * nx] - mean_nonzero;
03184 
03185                 while (i >= 0) {
03186                         v *= 0.9f;
03187                         d[i + j * nx] = v + mean_nonzero;
03188                         i--;
03189                 }
03190 
03191 
03192                 for (i = nx - 1; i > 0; i--) {
03193                         if (d[i + j * nx] != 0) {
03194                                 break;
03195                         }
03196                 }
03197 
03198                 if (i == 0) {
03199                         i = nx;
03200                 }
03201 
03202                 v = d[i + j * nx] - mean_nonzero;
03203 
03204                 while (i < nx) {
03205                         v *= .9f;
03206                         d[i + j * nx] = v + mean_nonzero;
03207                         i++;
03208                 }
03209         }
03210 
03211 
03212         for (i = 0; i < nx; i++) {
03213                 for (j = 0; j < ny; j++) {
03214                         if (d[i + j * nx] != 0)
03215                                 break;
03216                 }
03217 
03218                 float v = d[i + j * nx] - mean_nonzero;
03219 
03220                 while (j >= 0) {
03221                         v *= .9f;
03222                         d[i + j * nx] = v + mean_nonzero;
03223                         j--;
03224                 }
03225 
03226                 for (j = ny - 1; j > 0; j--) {
03227                         if (d[i + j * nx] != 0)
03228                                 break;
03229                 }
03230 
03231                 v = d[i + j * nx] - mean_nonzero;
03232 
03233                 while (j < ny) {
03234                         v *= .9f;
03235                         d[i + j * nx] = v + mean_nonzero;
03236                         j++;
03237                 }
03238         }
03239 
03240         image->update();
03241 }


Member Data Documentation

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

Definition at line 3754 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Mar 7 18:02:48 2011 for EMAN2 by  doxygen 1.4.7