#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 | |
Processor * | NEW () |
Static Public Attributes | |
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 3736 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 3750 of file processor.h. 03751 { 03752 return "zero edges of image on top and bottom, and on left and right."; 03753 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3740 of file processor.h. 03741 {
03742 return NAME;
03743 }
|
|
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 3755 of file processor.h. References EMAN::TypeDict::put(). 03756 { 03757 TypeDict d; 03758 d.put("x0", EMObject::INT, "The number of columns to zero from left"); 03759 d.put("x1", EMObject::INT, "The number of columns to zero from right"); 03760 d.put("y0", EMObject::INT, "The number of rows to zero from the bottom"); 03761 d.put("y1", EMObject::INT, "The number of rows to zero from the top"); 03762 return d; 03763 }
|
|
Definition at line 3745 of file processor.h. 03746 { 03747 return new ZeroEdgeRowProcessor(); 03748 }
|
|
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.
Implements EMAN::Processor. Definition at line 3247 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(). 03248 { 03249 if (!image) { 03250 LOGWARN("NULL Image"); 03251 return; 03252 } 03253 03254 if (image->get_zsize() > 1) { 03255 LOGERR("ZeroEdgeRowProcessor is not supported in 3D models"); 03256 throw ImageDimensionException("3D model not supported"); 03257 } 03258 03259 int nx = image->get_xsize(); 03260 int ny = image->get_ysize(); 03261 03262 float *d = image->get_data(); 03263 int top_nrows = params["y0"]; 03264 int bottom_nrows = params["y1"]; 03265 03266 int left_ncols = params["x0"]; 03267 int right_ncols = params["x1"]; 03268 03269 size_t row_size = nx * sizeof(float); 03270 03271 memset(d, 0, top_nrows * row_size); 03272 memset(d + (ny - bottom_nrows) * nx, 0, bottom_nrows * row_size); 03273 03274 for (int i = top_nrows; i < ny - bottom_nrows; i++) { 03275 memset(d + i * nx, 0, left_ncols * sizeof(float)); 03276 memset(d + i * nx + nx - right_ncols, 0, right_ncols * sizeof(float)); 03277 } 03278 image->update(); 03279 }
|
|
Definition at line 134 of file processor.cpp. |