#include <processor.h>
Inheritance diagram for EMAN::ToMassCenterProcessor:
Public Member Functions | |
virtual void | process_inplace (EMData *image) |
To process an image in-place. | |
virtual string | get_name () const |
Get the processor's name. | |
virtual string | get_desc () const |
Get the descrition of this specific processor. | |
virtual 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 = "xform.centerofmass" |
int_shift_only | set to 1 only shift by integer, no interpolation |
Definition at line 5085 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 5100 of file processor.h. 05101 { 05102 return "ToMassCenterProcessor centers image at center of mass. Note: includes only values > mean+0.75*sigma"; 05103 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5090 of file processor.h. References NAME. 05091 { 05092 return NAME; 05093 }
|
|
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 5105 of file processor.h. References EMAN::EMObject::INT, and EMAN::TypeDict::put(). 05106 { 05107 TypeDict d; 05108 d.put("int_shift_only", EMObject::INT, "set to 1 only shift by integer, no interpolation"); 05109 // d.put("positive", EMObject::INT, "uses only densities >0 for the calculatton"); 05110 return d; 05111 }
|
|
Definition at line 5095 of file processor.h. 05096 { 05097 return new ToMassCenterProcessor(); 05098 }
|
|
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 5514 of file processor.cpp. References EMAN::EMData::calc_center_of_mass(), EMAN::EMObject::f, EMAN::EMData::get_attr(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), LOGWARN, EMAN::Processor::params, EMAN::EMData::set_attr(), EMAN::Dict::set_default(), EMAN::Transform::set_trans(), t, and EMAN::EMData::translate(). 05515 { 05516 if (!image) { 05517 LOGWARN("NULL Image"); 05518 return; 05519 } 05520 05521 int int_shift_only = params.set_default("int_shift_only",1); 05522 // int positive = params.set_default("positive",0); 05523 05524 if ((float)image->get_attr("sigma")==0.0f) return; // Can't center a constant valued image 05525 05526 FloatPoint com = image->calc_center_of_mass(); 05527 05528 int nx = image->get_xsize(); 05529 int ny = image->get_ysize(); 05530 int nz = image->get_zsize(); 05531 05532 if (int_shift_only) { 05533 int dx = -(int)(floor(com[0] + 0.5f) - nx / 2); 05534 int dy = -(int)(floor(com[1] + 0.5f) - ny / 2); 05535 int dz = 0; 05536 if (nz > 1) { 05537 dz = -(int)(floor(com[2] + 0.5f) - nz / 2); 05538 } 05539 image->translate(dx, dy, dz); 05540 05541 Transform t; 05542 t.set_trans((float)dx,(float)dy,(float)dz); 05543 05544 if (nz > 1) { 05545 image->set_attr("xform.align3d",&t); 05546 } else { 05547 image->set_attr("xform.align2d",&t); 05548 } 05549 } 05550 else { 05551 float dx = -(com[0] - nx / 2); 05552 float dy = -(com[1] - ny / 2); 05553 float dz = 0; 05554 if (nz > 1) { 05555 dz = -(com[2] - nz / 2); 05556 } 05557 image->translate(dx, dy, dz); 05558 05559 Transform t; 05560 t.set_trans(dx,dy,dz); 05561 05562 if (nz > 1) { 05563 image->set_attr("xform.align3d",&t); 05564 } else { 05565 image->set_attr("xform.align2d",&t); 05566 } 05567 } 05568 }
|
|
Definition at line 5113 of file processor.h. Referenced by get_name(). |