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

EMAN::ZeroEdgePlaneProcessor Class Reference

zero edges of volume on all sides More...

#include <processor.h>

Inheritance diagram for EMAN::ZeroEdgePlaneProcessor:

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

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

Detailed Description

zero edges of volume on all sides

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
z0 The number of slices to zero from the bottom
z1 The number of slices to zero from the top

Definition at line 3986 of file processor.h.


Member Function Documentation

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

04001                 {
04002                         return "zero edges of volume on all sides";
04003                 }

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

03991                 {
03992                         return NAME;
03993                 }

TypeDict EMAN::ZeroEdgePlaneProcessor::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 4005 of file processor.h.

References EMAN::TypeDict::put().

04006                 {
04007                         TypeDict d;
04008                         d.put("x0", EMObject::INT, "The number of columns to zero from left");
04009                         d.put("x1", EMObject::INT, "The number of columns to zero from right");
04010                         d.put("y0", EMObject::INT, "The number of rows to zero from the bottom");
04011                         d.put("y1", EMObject::INT, "The number of rows to zero from the top");
04012                         d.put("z0", EMObject::INT, "The number of slices to zero from the bottom");
04013                         d.put("z1", EMObject::INT, "The number of slices to zero from the top");
04014                         return d;
04015                 }

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

Definition at line 3995 of file processor.h.

03996                 {
03997                         return new ZeroEdgePlaneProcessor();
03998                 }

void ZeroEdgePlaneProcessor::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 3420 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, EMAN::EMData::update(), and y.

03421 {
03422         if (!image) {
03423                 LOGWARN("NULL Image");
03424                 return;
03425         }
03426 
03427         if (image->get_zsize() <= 1) {
03428                 LOGERR("ZeroEdgePlaneProcessor only support 3D models");
03429                 throw ImageDimensionException("3D model only");
03430         }
03431 
03432         int nx = image->get_xsize();
03433         int ny = image->get_ysize();
03434         int nz = image->get_zsize();
03435 
03436         float *d = image->get_data();
03437 
03438         int x0=params["x0"];
03439         int x1=params["x1"];
03440         int y0=params["y0"];
03441         int y1=params["y1"];
03442         int z0=params["z0"];
03443         int z1=params["z1"];
03444 
03445         size_t row_size = nx * sizeof(float);
03446         size_t nxy = nx * ny;
03447         size_t sec_size = nxy * sizeof(float);
03448         size_t y0row = y0 * row_size;
03449         size_t y1row = y1 * row_size;
03450         int max_y = ny-y1;
03451         size_t x0size = x0*sizeof(float);
03452         size_t x1size = x1*sizeof(float);
03453 
03454         memset(d,0,z0*sec_size);                                        // zero -z
03455         memset(d+(nxy*(nz-z1)),0,sec_size*z1);      // zero +z
03456 
03457         for (int z=z0; z<nz-z1; z++) {
03458                 memset(d+z*nxy,0,y0row);                        // zero -y
03459                 memset(d+z*nxy+(ny-y1)*nx,0,y1row);     // zero +y
03460 
03461                 int znxy = z * nxy;
03462                 int znxy2 = znxy + nx - x1;
03463 
03464                 for (int y=y0; y<max_y; y++) {
03465                         memset(d+znxy+y*nx,0,x0size);   // zero -x
03466                         memset(d+znxy2+y*nx,0,x1size);  // zero +x
03467                 }
03468         }
03469 
03470         image->update();
03471 }


Member Data Documentation

const string ZeroEdgePlaneProcessor::NAME = "mask.zeroedge3d" [static]
 

Definition at line 141 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Nov 17 12:46:17 2011 for EMAN2 by  doxygen 1.3.9.1