#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 | |
Processor * | NEW () |
Static Public Attributes | |
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 3776 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 3790 of file processor.h. 03791 { 03792 return "zero edges of volume on all sides"; 03793 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3780 of file processor.h. 03781 {
03782 return NAME;
03783 }
|
|
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 3795 of file processor.h. References EMAN::TypeDict::put(). 03796 { 03797 TypeDict d; 03798 d.put("x0", EMObject::INT, "The number of columns to zero from left"); 03799 d.put("x1", EMObject::INT, "The number of columns to zero from right"); 03800 d.put("y0", EMObject::INT, "The number of rows to zero from the bottom"); 03801 d.put("y1", EMObject::INT, "The number of rows to zero from the top"); 03802 d.put("z0", EMObject::INT, "The number of slices to zero from the bottom"); 03803 d.put("z1", EMObject::INT, "The number of slices to zero from the top"); 03804 return d; 03805 }
|
|
Definition at line 3785 of file processor.h. 03786 { 03787 return new ZeroEdgePlaneProcessor(); 03788 }
|
|
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 3281 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. 03282 { 03283 if (!image) { 03284 LOGWARN("NULL Image"); 03285 return; 03286 } 03287 03288 if (image->get_zsize() <= 1) { 03289 LOGERR("ZeroEdgePlaneProcessor only support 3D models"); 03290 throw ImageDimensionException("3D model only"); 03291 } 03292 03293 int nx = image->get_xsize(); 03294 int ny = image->get_ysize(); 03295 int nz = image->get_zsize(); 03296 03297 float *d = image->get_data(); 03298 03299 int x0=params["x0"]; 03300 int x1=params["x1"]; 03301 int y0=params["y0"]; 03302 int y1=params["y1"]; 03303 int z0=params["z0"]; 03304 int z1=params["z1"]; 03305 03306 size_t row_size = nx * sizeof(float); 03307 size_t nxy = nx * ny; 03308 size_t sec_size = nxy * sizeof(float); 03309 size_t y0row = y0 * row_size; 03310 size_t y1row = y1 * row_size; 03311 int max_y = ny-y1; 03312 size_t x0size = x0*sizeof(float); 03313 size_t x1size = x1*sizeof(float); 03314 03315 memset(d,0,z0*sec_size); // zero -z 03316 memset(d+(nxy*(nz-z1)),0,sec_size*z1); // zero +z 03317 03318 for (int z=z0; z<nz-z1; z++) { 03319 memset(d+z*nxy,0,y0row); // zero -y 03320 memset(d+z*nxy+(ny-y1)*nx,0,y1row); // zero +y 03321 03322 int znxy = z * nxy; 03323 int znxy2 = znxy + nx - x1; 03324 03325 for (int y=y0; y<max_y; y++) { 03326 memset(d+znxy+y*nx,0,x0size); // zero -x 03327 memset(d+znxy2+y*nx,0,x1size); // zero +x 03328 } 03329 } 03330 03331 image->update(); 03332 }
|
|
Definition at line 135 of file processor.cpp. |