EMAN2
cmp_template.cpp
Go to the documentation of this file.
1/*
2 * Author: Steven Ludtke, 04/10/2003 (sludtke@bcm.edu)
3 * Copyright (c) 2000-2006 Baylor College of Medicine
4 *
5 * This software is issued under a joint BSD/GNU license. You may use the
6 * source code in this file under either license. However, note that the
7 * complete EMAN2 and SPARX software packages have some GPL dependencies,
8 * so you are responsible for compliance with the licenses of these packages
9 * if you opt to use BSD licensing. The warranty disclaimer below holds
10 * in either instance.
11 *
12 * This complete copyright notice must be included in any revised version of the
13 * source code. Additional authorship citations may be added, but existing
14 * author citations must be preserved.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 * */
31
32#include "cmp_template.h"
33#include "transform.h"
34
35
36using namespace EMAN;
37
38const string XYZCmp::NAME = "middle";
39
40float XYZCmp::cmp(EMData * image, EMData * with) const
41{
42 validate_input_args(image, with);
43
44#if 0
45 int param1 = params["param1"];
46 float param2 = params["param2"];
47 // do something
48#endif
49 int nx=image->get_xsize();
50 int ny=image->get_ysize();
51
52 double ret=0;
53 for (int i=nx/4; i<nx*3/4; i++) {
54 for (int j=ny/4; j<ny*3/4; j++) {
55 ret+=image->get_value_at(i,j)*with->get_value_at(i,j);
56 }
57 }
58
59 return (float) ret;
60}
void validate_input_args(const EMData *image, const EMData *with) const
Definition: cmp.cpp:81
Dict params
Definition: cmp.h:132
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
float cmp(const string &cmpname, EMData *with, const Dict &params=Dict())
Compare this image with another image.
E2Exception class.
Definition: aligner.h:40