To compare 'image' with another image passed in through its parameters.
An optional transformation may be used to transform the 2 images.
1048 size_t size = (size_t)image->get_xsize() * image->get_ysize() * image->get_zsize();
1053 EMData *a = image->do_fft();
1054 EMData *b = with->do_fft();
1060 for (
size_t i=0; i<a->get_ysize()/2.0f; i++) {
1061 rfa[i]=(rfb[i]==0?0.0f:(rfa[i]/rfb[i]));
1065 avg/=a->get_ysize()/2.0f;
1066 for (
size_t i=0; i<a->get_ysize()/2.0f; i++) {
1067 if (rfa[i]>avg*10.0) rfa[i]=10.0;
1071 if (dbug) b->write_image(
"a.hdf",-1);
1076 if (dbug) b->write_image(
"a.hdf",-1);
1077 if (dbug) a->write_image(
"a.hdf",-1);
1094 with2->write_image(
"a.hdf",-1);
1095 image->write_image(
"a.hdf",-1);
1105 EMData *a = image->do_fft();
1106 EMData *b = with->do_fft();
1107 size_t size2 = (size_t)a->get_xsize() * a->get_ysize() * a->get_zsize();
1112 const float *
const ad=a->get_const_data();
1113 float * bd=b->get_data();
1115 for (
size_t i=0; i<size2; i+=2) bd[i]=ad[i];
1125 const float * x_data;
1126 if (with2) x_data=with2->get_const_data();
1127 else x_data = with->get_const_data();
1128 const float *
const y_data = image->get_const_data();
1130 size_t nx = image->get_xsize();
1137 FILE *out=fopen(
"dbug.optvar.txt",
"w");
1139 for (
size_t i=0; i<size; i++) {
1140 if ( !keepzero || (x_data[i] && y_data[i])) fprintf(out,
"%g\t%g\n",x_data[i],y_data[i]);
1167 for (
size_t i = 0,
y=0; i < size;
y++) {
1168 for (
size_t x=0;
x<nx; i++,
x++) {
1169 if (y_data[i] && x_data[i]) {
1170 if (invert) result +=
Util::square(x_data[i] - (y_data[i]-b)/m)*(hypot((
float)
x,(
float)
y)+nx/4.0);
1171 else result +=
Util::square((x_data[i] * m) + b - y_data[i])*(hypot((
float)
x,(
float)
y)+nx/4.0);
1179 for (
size_t i = 0,
y=0; i < size;
y++) {
1180 for (
size_t x=0;
x<nx; i++,
x++) {
1181 if (invert) result +=
Util::square(x_data[i] - (y_data[i]-b)/m)*(hypot((
float)
x,(
float)
y)+nx/4.0);
1182 else result +=
Util::square((x_data[i] * m) + b - y_data[i])*(hypot((
float)
x,(
float)
y)+nx/4.0);
1185 result = result / size;
1190 for (
size_t i = 0; i < size; i++) {
1191 if (y_data[i] && x_data[i]) {
1192 if (invert) result +=
Util::square(x_data[i] - (y_data[i]-b)/m);
1193 else result +=
Util::square((x_data[i] * m) + b - y_data[i]);
1200 for (
size_t i = 0; i < size; i++) {
1201 if (invert) result +=
Util::square(x_data[i] - (y_data[i]-b)/m);
1202 else result +=
Util::square((x_data[i] * m) + b - y_data[i]);
1204 result = result / size;
1210 image->set_attr(
"ovcmp_m",m);
1211 image->set_attr(
"ovcmp_b",b);
1212 if (with2)
delete with2;
1216 return (1 - result);
1219 return static_cast<float>(result);
void validate_input_args(const EMData *image, const EMData *with) const
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
EMData stores an image's data and defines core image processing routines.
void apply_radial_func(float x0, float dx, vector< float >array, bool interp=true)
multiplies by a radial function in fourier space.
vector< float > calc_radial_dist(int n, float x0, float dx, int inten)
calculates radial distribution.
static void calc_least_square_fit(size_t nitems, const float *data_x, const float *data_y, float *p_slope, float *p_intercept, bool ignore_zero, float absmax=0)
calculate the least square fit value.
static int square(int n)
Calculate a number's square.
#define ImageDimensionException(desc)