#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 529 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 546 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 534 of file processor.h.
References NAME.
00535 { 00536 return NAME; 00537 }
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 551 of file processor.h.
00552 { 00553 TypeDict d; 00554 return d; 00555 }
static Processor* EMAN::XGradientProcessor::NEW | ( | ) | [inline, static] |
Definition at line 541 of file processor.h.
References XGradientProcessor().
00542 { 00543 return new XGradientProcessor(); 00544 }
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 9315 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().
09316 { 09317 if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image"); 09318 09319 EMData* e = new EMData(); 09320 int nx = image->get_xsize(); 09321 int ny = image->get_ysize(); 09322 int nz = image->get_zsize(); 09323 09324 if ( nz == 1 && ny == 1 ) { 09325 if ( nx < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09326 09327 e->set_size(3,1,1); 09328 e->set_value_at(0,-1); 09329 e->set_value_at(2, 1); 09330 09331 Region r = Region(-nx/2+1,nx); 09332 e->clip_inplace(r); 09333 } else if ( nz == 1 ) { 09334 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09335 e->set_size(3,3,1); 09336 e->set_value_at(0,0,-1); 09337 e->set_value_at(0,1,-2); 09338 e->set_value_at(0,2,-1); 09339 09340 e->set_value_at(2,0,1); 09341 e->set_value_at(2,1,2); 09342 e->set_value_at(2,2,1); 09343 Region r = Region(-nx/2+1,-ny/2+1,nx,ny); 09344 e->clip_inplace(r); 09345 } else { 09346 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09347 e->set_size(3,3,3); 09348 e->set_value_at(0,0,0,-1); 09349 e->set_value_at(0,1,0,-1); 09350 e->set_value_at(0,2,0,-1); 09351 e->set_value_at(0,0,1,-1); 09352 e->set_value_at(0,1,1,-8); 09353 e->set_value_at(0,2,1,-1); 09354 e->set_value_at(0,0,2,-1); 09355 e->set_value_at(0,1,2,-1); 09356 e->set_value_at(0,2,2,-1); 09357 09358 e->set_value_at(2,0,0,1); 09359 e->set_value_at(2,1,0,1); 09360 e->set_value_at(2,2,0,1); 09361 e->set_value_at(2,0,1,1); 09362 e->set_value_at(2,1,1,8); 09363 e->set_value_at(2,2,1,1); 09364 e->set_value_at(2,0,2,1); 09365 e->set_value_at(2,1,2,1); 09366 e->set_value_at(2,2,2,1); 09367 09368 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz); 09369 e->clip_inplace(r); 09370 } 09371 09372 Dict conv_parms; 09373 conv_parms["with"] = e; 09374 image->process_inplace("math.convolution", conv_parms); 09375 image->process_inplace("xform.phaseorigin.tocenter"); 09376 09377 delete e; 09378 }
const string XGradientProcessor::NAME = "math.edge.xgradient" [static] |