#include <processor.h>
Inheritance diagram for EMAN::YGradientProcessor:
Public Member Functions | |
YGradientProcessor () | |
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.ygradient" |
Definition at line 560 of file processor.h.
EMAN::YGradientProcessor::YGradientProcessor | ( | ) | [inline] |
string EMAN::YGradientProcessor::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 577 of file processor.h.
string EMAN::YGradientProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 565 of file processor.h.
References NAME.
00566 { 00567 return NAME; 00568 }
TypeDict EMAN::YGradientProcessor::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 583 of file processor.h.
00584 { 00585 TypeDict d; 00586 return d; 00587 }
static Processor* EMAN::YGradientProcessor::NEW | ( | ) | [inline, static] |
Definition at line 572 of file processor.h.
References YGradientProcessor().
00573 { 00574 return new YGradientProcessor(); 00575 }
void YGradientProcessor::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 9423 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().
09424 { 09425 if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image"); 09426 09427 EMData* e = new EMData(); 09428 int nx = image->get_xsize(); 09429 int ny = image->get_ysize(); 09430 int nz = image->get_zsize(); 09431 09432 if ( nz == 1 && ny == 1 ) { 09433 throw ImageDimensionException("Error - cannot detect Y edges for an image that that is 1D!"); 09434 } else if ( nz == 1 ) { 09435 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09436 e->set_size(3,3,1); 09437 e->set_value_at(0,0,-1); 09438 e->set_value_at(1,0,-2); 09439 e->set_value_at(2,0,-1); 09440 09441 e->set_value_at(0,2,1); 09442 e->set_value_at(1,2,2); 09443 e->set_value_at(2,2,1); 09444 Region r = Region(-nx/2+1,-ny/2+1,nx,ny); 09445 e->clip_inplace(r); 09446 } else { 09447 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09448 e->set_size(3,3,3); 09449 e->set_value_at(0,0,0,-1); 09450 e->set_value_at(1,0,0,-1); 09451 e->set_value_at(2,0,0,-1); 09452 e->set_value_at(0,0,1,-1); 09453 e->set_value_at(1,0,1,-8); 09454 e->set_value_at(2,0,1,-1); 09455 e->set_value_at(0,0,2,-1); 09456 e->set_value_at(1,0,2,-1); 09457 e->set_value_at(2,0,2,-1); 09458 09459 e->set_value_at(0,2,0,1); 09460 e->set_value_at(1,2,0,1); 09461 e->set_value_at(2,2,0,1); 09462 e->set_value_at(0,2,1,1); 09463 e->set_value_at(1,2,1,8); 09464 e->set_value_at(2,2,1,1); 09465 e->set_value_at(0,2,2,1); 09466 e->set_value_at(1,2,2,1); 09467 e->set_value_at(2,2,2,1); 09468 09469 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz); 09470 e->clip_inplace(r); 09471 } 09472 09473 Dict conv_parms; 09474 conv_parms["with"] = e; 09475 image->process_inplace("math.convolution", conv_parms); 09476 09477 delete e; 09478 }
const string YGradientProcessor::NAME = "math.edge.ygradient" [static] |