#include <processor.h>
Inheritance diagram for EMAN::ZeroEdgePlaneProcessor:
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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "mask.zeroedge3d" |
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 4033 of file processor.h.
string EMAN::ZeroEdgePlaneProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 4047 of file processor.h.
string EMAN::ZeroEdgePlaneProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 4037 of file processor.h.
References NAME.
04038 { 04039 return NAME; 04040 }
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.
Reimplemented from EMAN::Processor.
Definition at line 4052 of file processor.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
04053 { 04054 TypeDict d; 04055 d.put("x0", EMObject::INT, "The number of columns to zero from left"); 04056 d.put("x1", EMObject::INT, "The number of columns to zero from right"); 04057 d.put("y0", EMObject::INT, "The number of rows to zero from the bottom"); 04058 d.put("y1", EMObject::INT, "The number of rows to zero from the top"); 04059 d.put("z0", EMObject::INT, "The number of slices to zero from the bottom"); 04060 d.put("z1", EMObject::INT, "The number of slices to zero from the top"); 04061 return d; 04062 }
static Processor* EMAN::ZeroEdgePlaneProcessor::NEW | ( | ) | [inline, static] |
Definition at line 4042 of file processor.h.
04043 { 04044 return new ZeroEdgePlaneProcessor(); 04045 }
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 3498 of file processor.cpp.
References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, EMAN::Processor::params, and EMAN::EMData::update().
03499 { 03500 if (!image) { 03501 LOGWARN("NULL Image"); 03502 return; 03503 } 03504 03505 if (image->get_zsize() <= 1) { 03506 LOGERR("ZeroEdgePlaneProcessor only support 3D models"); 03507 throw ImageDimensionException("3D model only"); 03508 } 03509 03510 int nx = image->get_xsize(); 03511 int ny = image->get_ysize(); 03512 int nz = image->get_zsize(); 03513 03514 float *d = image->get_data(); 03515 03516 int x0=params["x0"]; 03517 int x1=params["x1"]; 03518 int y0=params["y0"]; 03519 int y1=params["y1"]; 03520 int z0=params["z0"]; 03521 int z1=params["z1"]; 03522 03523 size_t row_size = nx * sizeof(float); 03524 size_t nxy = nx * ny; 03525 size_t sec_size = nxy * sizeof(float); 03526 size_t y0row = y0 * row_size; 03527 size_t y1row = y1 * row_size; 03528 int max_y = ny-y1; 03529 size_t x0size = x0*sizeof(float); 03530 size_t x1size = x1*sizeof(float); 03531 03532 memset(d,0,z0*sec_size); // zero -z 03533 memset(d+(nxy*(nz-z1)),0,sec_size*z1); // zero +z 03534 03535 for (int z=z0; z<nz-z1; z++) { 03536 memset(d+z*nxy,0,y0row); // zero -y 03537 memset(d+z*nxy+(ny-y1)*nx,0,y1row); // zero +y 03538 03539 int znxy = z * nxy; 03540 int znxy2 = znxy + nx - x1; 03541 03542 for (int y=y0; y<max_y; y++) { 03543 memset(d+znxy+y*nx,0,x0size); // zero -x 03544 memset(d+znxy2+y*nx,0,x1size); // zero +x 03545 } 03546 } 03547 03548 image->update(); 03549 }
const string ZeroEdgePlaneProcessor::NAME = "mask.zeroedge3d" [static] |