34 double &shift_X,
double &shift_Y,
35 double const max_step,
46 auto max_step_int = (int)
ROUND(max_step);
52 T temp_max = -100000000;
57 if (temp_max < mat_temp(
i,
j))
59 temp_max = mat_temp(
i,
j);
65 #ifdef DEBUG_calculate_and_find_correlation_max_mat 66 std::cout <<
"\n imax, jmax: " << imax <<
" " << jmax << std::endl;
74 int i,
j, i_actual, j_actual;
81 radius = n_max * n_max;
82 for (i = -n_max; i <= n_max; i++)
83 for (j = -n_max; j <= n_max; j++)
87 if ((i*i + j*j) > radius)
89 if (!mat_temp.
outside(i_actual, j_actual))
91 if (temp_max / 1.414 > mat_temp(i_actual, j_actual))
97 std::cout <<
"\nWarning(calculate_and_find_correlation_max_mat)" 98 <<
"\n some points neede to determine the maxima" 99 <<
"\n are not available" << std::endl;
105 #ifdef DEBUG_calculate_and_find_correlation_max_mat 106 std::cout <<
"\n n_max, temp_max: " << n_max <<
" " << temp_max << std::endl;
116 jj_max = ii_max = sum_corr = 0.;
117 for (i = -n_max; i <= n_max; i++)
118 for (j = -n_max; j <= n_max; j++)
122 if ((i*i + j*j) > radius)
124 if (!mat_temp.
outside(i_actual, j_actual))
126 ii_max += i_actual * mat_temp(i_actual, j_actual);
127 jj_max += j_actual * mat_temp(i_actual, j_actual);
128 sum_corr += mat_temp(i_actual, j_actual);
131 shift_X = jj_max / sum_corr;
132 shift_Y = ii_max / sum_corr;
135 #ifdef DEBUG_calculate_and_find_correlation_max_mat 136 std::cout <<
"\n shift_XX " << shift_X << std::endl;
137 std::cout <<
"\n shift_Y " << shift_Y << std::endl;
138 std::cout <<
"\n jj_max " << jj_max << std::endl;
139 std::cout <<
"\n ii_max " << ii_max << std::endl;
140 std::cout <<
"\n sum_corr " << sum_corr << std::endl;
145 #undef DEBUG_calculate_and_find_correlation_max_mat 154 double &shift_X,
double &shift_Y,
155 double const max_step,
156 int ref_trans_after,
int imagen_no,
160 #ifdef DEBUG_calculate_and_find_correlation_max_proj 161 std::cout <<
"\n (cal_find_corr_proj) imagen_no: " << imagen_no << std::endl;
165 proj_temp().resize(proj1());
169 shift_X, shift_Y, max_step,
173 #undef DEBUG_calculate_and_find_correlation_max_proj
void calculate_and_find_correlation_max_proj(Projection const &proj1, Projection const &proj2, Projection &proj_temp, double &shift_X, double &shift_Y, double const max_step, int ref_trans_after, int imagen_no, CorrelationAux &aux)
void calculate_and_find_correlation_max_mat(MultidimArray< T > const &mat1, MultidimArray< T > const &mat2, MultidimArray< T > &mat_temp, double &shift_X, double &shift_Y, double const max_step, CorrelationAux &aux)
void correlation_matrix(const MultidimArray< double > &m1, const MultidimArray< double > &m2, MultidimArray< double > &R, CorrelationAux &aux, bool center)
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
bool outside(int k, int i, int j) const