#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.
|
Definition at line 532 of file processor.h. Referenced by NEW().
|
|
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.
|
|
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 }
|
|
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 }
|
|
Definition at line 541 of file processor.h. References XGradientProcessor(). 00542 { 00543 return new XGradientProcessor(); 00544 }
|
|
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 9135 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(). 09136 { 09137 if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image"); 09138 09139 EMData* e = new EMData(); 09140 int nx = image->get_xsize(); 09141 int ny = image->get_ysize(); 09142 int nz = image->get_zsize(); 09143 09144 if ( nz == 1 && ny == 1 ) { 09145 if ( nx < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09146 09147 e->set_size(3,1,1); 09148 e->set_value_at(0,-1); 09149 e->set_value_at(2, 1); 09150 09151 Region r = Region(-nx/2+1,nx); 09152 e->clip_inplace(r); 09153 } else if ( nz == 1 ) { 09154 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09155 e->set_size(3,3,1); 09156 e->set_value_at(0,0,-1); 09157 e->set_value_at(0,1,-2); 09158 e->set_value_at(0,2,-1); 09159 09160 e->set_value_at(2,0,1); 09161 e->set_value_at(2,1,2); 09162 e->set_value_at(2,2,1); 09163 Region r = Region(-nx/2+1,-ny/2+1,nx,ny); 09164 e->clip_inplace(r); 09165 } else { 09166 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels"); 09167 e->set_size(3,3,3); 09168 e->set_value_at(0,0,0,-1); 09169 e->set_value_at(0,1,0,-1); 09170 e->set_value_at(0,2,0,-1); 09171 e->set_value_at(0,0,1,-1); 09172 e->set_value_at(0,1,1,-8); 09173 e->set_value_at(0,2,1,-1); 09174 e->set_value_at(0,0,2,-1); 09175 e->set_value_at(0,1,2,-1); 09176 e->set_value_at(0,2,2,-1); 09177 09178 e->set_value_at(2,0,0,1); 09179 e->set_value_at(2,1,0,1); 09180 e->set_value_at(2,2,0,1); 09181 e->set_value_at(2,0,1,1); 09182 e->set_value_at(2,1,1,8); 09183 e->set_value_at(2,2,1,1); 09184 e->set_value_at(2,0,2,1); 09185 e->set_value_at(2,1,2,1); 09186 e->set_value_at(2,2,2,1); 09187 09188 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz); 09189 e->clip_inplace(r); 09190 } 09191 09192 Dict conv_parms; 09193 conv_parms["with"] = e; 09194 image->process_inplace("math.convolution", conv_parms); 09195 image->process_inplace("xform.phaseorigin.tocenter"); 09196 09197 delete e; 09198 }
|
|
Definition at line 557 of file processor.h. Referenced by get_name(). |