To compare 'image' with another image passed in through its parameters.
An optional transformation may be used to transform the 2 images.
192 if (image->is_complex() || with->is_complex())
196 const float *
const d1 = image->get_const_data();
197 const float *
const d2 = with->get_const_data();
200 if (negative) negative=-1.0;
else negative=1.0;
202 double avg1 = 0.0, sig1 = 0.0, avg2 = 0.0, sig2 = 0.0, lod = 0.0;
204 size_t totsize = image->get_xsize()*image->get_ysize()*image->get_zsize();
207 bool has_mask =
false;
211 if(mask!=0) {has_mask=
true;}
216 normalize =
params[
"normalize"];
221 const float *
const dm = mask->get_const_data();
222 for (i = 0; i < totsize; ++i) {
224 avg1 += double(d1[i]);
225 avg2 += double(d2[i]);
230 for (i = 0; i < totsize; ++i) {
231 avg1 += double(d1[i]);
232 avg2 += double(d2[i]);
241 const float *
const dm = mask->get_const_data();
242 for (i = 0; i < totsize; ++i) {
244 sig1 += fabs(
double(d1[i])-avg1);
245 sig2 += fabs(
double(d2[i])-avg2);
249 for (i = 0; i < totsize; ++i) {
250 sig1 += fabs(
double(d1[i])-avg1);
251 sig2 += fabs(
double(d2[i])-avg2);
255 avg1 = 0.0; avg2 = 0.0;
256 sig1 = 1.0; sig2 = 1.0;
260 const float *
const dm = mask->get_const_data();
261 for (i = 0; i < totsize; ++i) {
263 lod += fabs((
double(d1[i])-avg1)/sig1 - (
double(d2[i])-avg2)/sig2);
267 for (i = 0; i < totsize; ++i) {
268 lod += fabs((
double(d1[i])-avg1)/sig1 - (
double(d2[i])-avg2)/sig2);
274 return static_cast<float>(lod);
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...
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
EMData stores an image's data and defines core image processing routines.
#define ImageFormatException(desc)