Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::ZeroEdgeRowProcessor Class Reference

zero edges of image on top and bottom, and on left and right. More...

#include <processor.h>

Inheritance diagram for EMAN::ZeroEdgeRowProcessor:

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

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.
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "mask.zeroedge2d"

Detailed Description

zero edges of image on top and bottom, and on left and right.

Parameters:
x0 The number of columns to zero from left
x1 The number of columns to zero from right
y0 The number of rows to zero from the bottom
y1 The number of rows to zero from the top

Definition at line 3915 of file processor.h.


Member Function Documentation

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

03930                 {
03931                         return "zero edges of image on top and bottom, and on left and right.";
03932                 }

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

03920                 {
03921                         return NAME;
03922                 }

TypeDict EMAN::ZeroEdgeRowProcessor::get_param_types  )  const [inline, virtual]
 

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 3934 of file processor.h.

References EMAN::TypeDict::put().

03935                 {
03936                         TypeDict d;
03937                         d.put("x0", EMObject::INT, "The number of columns to zero from left");
03938                         d.put("x1", EMObject::INT, "The number of columns to zero from right");
03939                         d.put("y0", EMObject::INT, "The number of rows to zero from the bottom");
03940                         d.put("y1", EMObject::INT, "The number of rows to zero from the top");
03941                         return d;
03942                 }

Processor* EMAN::ZeroEdgeRowProcessor::NEW  )  [inline, static]
 

Definition at line 3924 of file processor.h.

03925                 {
03926                         return new ZeroEdgeRowProcessor();
03927                 }

void ZeroEdgeRowProcessor::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 3367 of file processor.cpp.

References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, nx, ny, and EMAN::EMData::update().

03368 {
03369         if (!image) {
03370                 LOGWARN("NULL Image");
03371                 return;
03372         }
03373 
03374         if (image->get_zsize() > 1) {
03375                 LOGERR("ZeroEdgeRowProcessor is not supported in 3D models");
03376                 throw ImageDimensionException("3D model not supported");
03377         }
03378 
03379         int nx = image->get_xsize();
03380         int ny = image->get_ysize();
03381 
03382         float *d = image->get_data();
03383         int top_nrows = params["y0"];
03384         int bottom_nrows = params["y1"];
03385 
03386         int left_ncols = params["x0"];
03387         int right_ncols = params["x1"];
03388 
03389         size_t row_size = nx * sizeof(float);
03390 
03391         memset(d, 0, top_nrows * row_size);
03392         memset(d + (ny - bottom_nrows) * nx, 0, bottom_nrows * row_size);
03393 
03394         for (int i = top_nrows; i < ny - bottom_nrows; i++) {
03395                 memset(d + i * nx, 0, left_ncols * sizeof(float));
03396                 memset(d + i * nx + nx - right_ncols, 0, right_ncols * sizeof(float));
03397         }
03398         image->update();
03399 }


Member Data Documentation

const string ZeroEdgeRowProcessor::NAME = "mask.zeroedge2d" [static]
 

Definition at line 145 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:52:14 2011 for EMAN2 by  doxygen 1.3.9.1