#include <cmp_template.h>
Inheritance diagram for EMAN::XYZCmp:


Public Member Functions | |
| float | cmp (EMData *image, EMData *with) const |
| To compare 'image' with another image passed in through its parameters. | |
| string | get_name () const |
| Get the Cmp's name. | |
| string | get_desc () const |
| TypeDict | get_param_types () const |
| Add your cmp parameter names and types in get_param_types(). | |
Static Public Member Functions | |
| Cmp * | NEW () |
Static Public Attributes | |
| const string | NAME = "middle" |
Please add your own code at the proper place.
1) Replace all 'XYZ' with your new cmp name. 2) Define the cmp parameter names and types in get_param_types(). 3) Implement the cmp in XYZCmp::cmp().
Definition at line 48 of file cmp_template.h.
|
||||||||||||
|
To compare 'image' with another image passed in through its parameters. An optional transformation may be used to transform the 2 images.
Implements EMAN::Cmp. Definition at line 40 of file cmp_template.cpp. References EMAN::EMData::get_value_at(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), nx, ny, and EMAN::Cmp::validate_input_args(). 00041 {
00042 validate_input_args(image, with);
00043
00044 #if 0
00045 int param1 = params["param1"];
00046 float param2 = params["param2"];
00047 // do something
00048 #endif
00049 int nx=image->get_xsize();
00050 int ny=image->get_ysize();
00051
00052 double ret=0;
00053 for (int i=nx/4; i<nx*3/4; i++) {
00054 for (int j=ny/4; j<ny*3/4; j++) {
00055 ret+=image->get_value_at(i,j)*with->get_value_at(i,j);
00056 }
00057 }
00058
00059 return (float) ret;
00060 }
|
|
|
Implements EMAN::Cmp. Definition at line 58 of file cmp_template.h. 00059 {
00060 return "dot product using the center of the image";
00061 }
|
|
|
Get the Cmp's name. Each Cmp is identified by a unique name.
Implements EMAN::Cmp. Definition at line 53 of file cmp_template.h. 00054 {
00055 return NAME;
00056 }
|
|
|
Add your cmp parameter names and types in get_param_types(). For available parameter types, please refer class EMObject. As an example, XYZCmp has 3 parameters: EMData *with; int param1; float param2; Implements EMAN::Cmp. Definition at line 77 of file cmp_template.h. References EMAN::TypeDict::put(). 00078 {
00079 TypeDict d;
00080 d.put("radius", EMObject::INT);
00081 d.put("param2", EMObject::FLOAT);
00082 return d;
00083 }
|
|
|
Definition at line 63 of file cmp_template.h. 00064 {
00065 return new XYZCmp();
00066 }
|
|
|
Definition at line 38 of file cmp_template.cpp. |
1.3.9.1