#include <processor.h>
Inheritance diagram for EMAN::XGradientProcessor:
Public Member Functions | |
XGradientProcessor () | |
string | get_name () const |
Get the processor's name. | |
void | process_inplace (EMData *image) |
To process an image in-place. | |
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 = "math.edge.xgradient" |
Definition at line 554 of file processor.h.
|
Definition at line 557 of file processor.h. 00557 {}
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 571 of file processor.h. 00572 { 00573 return "Determines the image gradient in the x direction"; 00574 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 559 of file processor.h. 00560 {
00561 return NAME;
00562 }
|
|
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 576 of file processor.h. 00577 { 00578 TypeDict d; 00579 return d; 00580 }
|
|
Definition at line 566 of file processor.h. 00567 { 00568 return new XGradientProcessor(); 00569 }
|
|
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 9465 of file processor.cpp. References EMAN::EMData::clip_inplace(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, ImageFormatException, EMAN::EMData::is_complex(), nx, ny, EMAN::EMData::process_inplace(), EMAN::EMData::set_size(), and EMAN::EMData::set_value_at(). 09466 { 09467 if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image"); 09468 09469 EMData* e = new EMData(); 09470 int nx = image->get_xsize(); 09471 int ny = image->get_ysize(); 09472 int nz = image->get_zsize(); 09473 09474 if ( nz == 1 && ny == 1 ) { 09475 if ( nx < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09476 09477 e->set_size(3,1,1); 09478 e->set_value_at(0,-1); 09479 e->set_value_at(2, 1); 09480 09481 Region r = Region(-nx/2+1,nx); 09482 e->clip_inplace(r); 09483 } else if ( nz == 1 ) { 09484 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09485 e->set_size(3,3,1); 09486 e->set_value_at(0,0,-1); 09487 e->set_value_at(0,1,-2); 09488 e->set_value_at(0,2,-1); 09489 09490 e->set_value_at(2,0,1); 09491 e->set_value_at(2,1,2); 09492 e->set_value_at(2,2,1); 09493 Region r = Region(-nx/2+1,-ny/2+1,nx,ny); 09494 e->clip_inplace(r); 09495 } else { 09496 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09497 e->set_size(3,3,3); 09498 e->set_value_at(0,0,0,-1); 09499 e->set_value_at(0,1,0,-1); 09500 e->set_value_at(0,2,0,-1); 09501 e->set_value_at(0,0,1,-1); 09502 e->set_value_at(0,1,1,-8); 09503 e->set_value_at(0,2,1,-1); 09504 e->set_value_at(0,0,2,-1); 09505 e->set_value_at(0,1,2,-1); 09506 e->set_value_at(0,2,2,-1); 09507 09508 e->set_value_at(2,0,0,1); 09509 e->set_value_at(2,1,0,1); 09510 e->set_value_at(2,2,0,1); 09511 e->set_value_at(2,0,1,1); 09512 e->set_value_at(2,1,1,8); 09513 e->set_value_at(2,2,1,1); 09514 e->set_value_at(2,0,2,1); 09515 e->set_value_at(2,1,2,1); 09516 e->set_value_at(2,2,2,1); 09517 09518 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz); 09519 e->clip_inplace(r); 09520 } 09521 09522 Dict conv_parms; 09523 conv_parms["with"] = e; 09524 image->process_inplace("math.convolution", conv_parms); 09525 image->process_inplace("xform.phaseorigin.tocenter"); 09526 09527 delete e; 09528 }
|
|
Definition at line 63 of file processor.cpp. |