#include <processor.h>
Inheritance diagram for EMAN::ZeroEdgeRowProcessor:
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.zeroedge2d" |
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 3993 of file processor.h.
string EMAN::ZeroEdgeRowProcessor::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 4007 of file processor.h.
string EMAN::ZeroEdgeRowProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 3997 of file processor.h.
References NAME.
03998 { 03999 return NAME; 04000 }
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.
Reimplemented from EMAN::Processor.
Definition at line 4012 of file processor.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
04013 { 04014 TypeDict d; 04015 d.put("x0", EMObject::INT, "The number of columns to zero from left"); 04016 d.put("x1", EMObject::INT, "The number of columns to zero from right"); 04017 d.put("y0", EMObject::INT, "The number of rows to zero from the bottom"); 04018 d.put("y1", EMObject::INT, "The number of rows to zero from the top"); 04019 return d; 04020 }
static Processor* EMAN::ZeroEdgeRowProcessor::NEW | ( | ) | [inline, static] |
Definition at line 4002 of file processor.h.
04003 { 04004 return new ZeroEdgeRowProcessor(); 04005 }
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 3464 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().
03465 { 03466 if (!image) { 03467 LOGWARN("NULL Image"); 03468 return; 03469 } 03470 03471 if (image->get_zsize() > 1) { 03472 LOGERR("ZeroEdgeRowProcessor is not supported in 3D models"); 03473 throw ImageDimensionException("3D model not supported"); 03474 } 03475 03476 int nx = image->get_xsize(); 03477 int ny = image->get_ysize(); 03478 03479 float *d = image->get_data(); 03480 int top_nrows = params["y0"]; 03481 int bottom_nrows = params["y1"]; 03482 03483 int left_ncols = params["x0"]; 03484 int right_ncols = params["x1"]; 03485 03486 size_t row_size = nx * sizeof(float); 03487 03488 memset(d, 0, top_nrows * row_size); 03489 memset(d + (ny - bottom_nrows) * nx, 0, bottom_nrows * row_size); 03490 03491 for (int i = top_nrows; i < ny - bottom_nrows; i++) { 03492 memset(d + i * nx, 0, left_ncols * sizeof(float)); 03493 memset(d + i * nx + nx - right_ncols, 0, right_ncols * sizeof(float)); 03494 } 03495 image->update(); 03496 }
const string ZeroEdgeRowProcessor::NAME = "mask.zeroedge2d" [static] |