#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "math.edge.xgradient" |
Definition at line 554 of file processor.h.
EMAN::XGradientProcessor::XGradientProcessor | ( | ) | [inline] |
string EMAN::XGradientProcessor::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 571 of file processor.h.
string EMAN::XGradientProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 559 of file processor.h.
References NAME.
00560 { 00561 return NAME; 00562 }
TypeDict EMAN::XGradientProcessor::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 576 of file processor.h.
00577 { 00578 TypeDict d; 00579 return d; 00580 }
static Processor* EMAN::XGradientProcessor::NEW | ( | ) | [inline, static] |
Definition at line 566 of file processor.h.
References XGradientProcessor().
00567 { 00568 return new XGradientProcessor(); 00569 }
void XGradientProcessor::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 9402 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(), EMAN::EMData::process_inplace(), EMAN::EMData::set_size(), and EMAN::EMData::set_value_at().
09403 { 09404 if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image"); 09405 09406 EMData* e = new EMData(); 09407 int nx = image->get_xsize(); 09408 int ny = image->get_ysize(); 09409 int nz = image->get_zsize(); 09410 09411 if ( nz == 1 && ny == 1 ) { 09412 if ( nx < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09413 09414 e->set_size(3,1,1); 09415 e->set_value_at(0,-1); 09416 e->set_value_at(2, 1); 09417 09418 Region r = Region(-nx/2+1,nx); 09419 e->clip_inplace(r); 09420 } else if ( nz == 1 ) { 09421 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09422 e->set_size(3,3,1); 09423 e->set_value_at(0,0,-1); 09424 e->set_value_at(0,1,-2); 09425 e->set_value_at(0,2,-1); 09426 09427 e->set_value_at(2,0,1); 09428 e->set_value_at(2,1,2); 09429 e->set_value_at(2,2,1); 09430 Region r = Region(-nx/2+1,-ny/2+1,nx,ny); 09431 e->clip_inplace(r); 09432 } else { 09433 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09434 e->set_size(3,3,3); 09435 e->set_value_at(0,0,0,-1); 09436 e->set_value_at(0,1,0,-1); 09437 e->set_value_at(0,2,0,-1); 09438 e->set_value_at(0,0,1,-1); 09439 e->set_value_at(0,1,1,-8); 09440 e->set_value_at(0,2,1,-1); 09441 e->set_value_at(0,0,2,-1); 09442 e->set_value_at(0,1,2,-1); 09443 e->set_value_at(0,2,2,-1); 09444 09445 e->set_value_at(2,0,0,1); 09446 e->set_value_at(2,1,0,1); 09447 e->set_value_at(2,2,0,1); 09448 e->set_value_at(2,0,1,1); 09449 e->set_value_at(2,1,1,8); 09450 e->set_value_at(2,2,1,1); 09451 e->set_value_at(2,0,2,1); 09452 e->set_value_at(2,1,2,1); 09453 e->set_value_at(2,2,2,1); 09454 09455 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz); 09456 e->clip_inplace(r); 09457 } 09458 09459 Dict conv_parms; 09460 conv_parms["with"] = e; 09461 image->process_inplace("math.convolution", conv_parms); 09462 image->process_inplace("xform.phaseorigin.tocenter"); 09463 09464 delete e; 09465 }
const string XGradientProcessor::NAME = "math.edge.xgradient" [static] |