#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 529 of file processor.h.
|
|
Definition at line 532 of file processor.h. 00532 {}
|
|
|
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. 00547 {
00548 return "Determines the image gradient in the x direction";
00549 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 534 of file processor.h. 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. 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 9197 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(). 09198 {
09199 if (image->is_complex()) throw ImageFormatException("Cannot edge detect a complex image");
09200
09201 EMData* e = new EMData();
09202 int nx = image->get_xsize();
09203 int ny = image->get_ysize();
09204 int nz = image->get_zsize();
09205
09206 if ( nz == 1 && ny == 1 ) {
09207 if ( nx < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09208
09209 e->set_size(3,1,1);
09210 e->set_value_at(0,-1);
09211 e->set_value_at(2, 1);
09212
09213 Region r = Region(-nx/2+1,nx);
09214 e->clip_inplace(r);
09215 } else if ( nz == 1 ) {
09216 if ( nx < 3 || ny < 3 ) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09217 e->set_size(3,3,1);
09218 e->set_value_at(0,0,-1);
09219 e->set_value_at(0,1,-2);
09220 e->set_value_at(0,2,-1);
09221
09222 e->set_value_at(2,0,1);
09223 e->set_value_at(2,1,2);
09224 e->set_value_at(2,2,1);
09225 Region r = Region(-nx/2+1,-ny/2+1,nx,ny);
09226 e->clip_inplace(r);
09227 } else {
09228 if ( nx < 3 || ny < 3 || nz < 3) throw ImageDimensionException("Error - cannot edge detect an image with less than three pixels");
09229 e->set_size(3,3,3);
09230 e->set_value_at(0,0,0,-1);
09231 e->set_value_at(0,1,0,-1);
09232 e->set_value_at(0,2,0,-1);
09233 e->set_value_at(0,0,1,-1);
09234 e->set_value_at(0,1,1,-8);
09235 e->set_value_at(0,2,1,-1);
09236 e->set_value_at(0,0,2,-1);
09237 e->set_value_at(0,1,2,-1);
09238 e->set_value_at(0,2,2,-1);
09239
09240 e->set_value_at(2,0,0,1);
09241 e->set_value_at(2,1,0,1);
09242 e->set_value_at(2,2,0,1);
09243 e->set_value_at(2,0,1,1);
09244 e->set_value_at(2,1,1,8);
09245 e->set_value_at(2,2,1,1);
09246 e->set_value_at(2,0,2,1);
09247 e->set_value_at(2,1,2,1);
09248 e->set_value_at(2,2,2,1);
09249
09250 Region r = Region(-nx/2+1,-ny/2+1,-nz/2+1,nx,ny,nz);
09251 e->clip_inplace(r);
09252 }
09253
09254 Dict conv_parms;
09255 conv_parms["with"] = e;
09256 image->process_inplace("math.convolution", conv_parms);
09257 image->process_inplace("xform.phaseorigin.tocenter");
09258
09259 delete e;
09260 }
|
|
|
Definition at line 65 of file processor.cpp. |
1.3.9.1