|
|
@ -128,7 +128,7 @@ inline double RefocusMatrix::c_mat_elt (const CMat * const mat, const int col, c
|
|
|
|
|
|
|
|
|
|
|
|
void RefocusMatrix::convolve_mat (CMat * result, const CMat * const mata, const CMat * const matb)
|
|
|
|
void RefocusMatrix::convolve_mat (CMat * result, const CMat * const mata, const CMat * const matb)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register int xr, yr, xa, ya;
|
|
|
|
int xr, yr, xa, ya;
|
|
|
|
|
|
|
|
|
|
|
|
for (yr = -result->radius; yr <= result->radius; yr++)
|
|
|
|
for (yr = -result->radius; yr <= result->radius; yr++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -138,7 +138,7 @@ void RefocusMatrix::convolve_mat (CMat * result, const CMat * const mata, const
|
|
|
|
const int ya_high = TQMIN (mata->radius, yr + matb->radius);
|
|
|
|
const int ya_high = TQMIN (mata->radius, yr + matb->radius);
|
|
|
|
const int xa_low = TQMAX (-mata->radius, xr - matb->radius);
|
|
|
|
const int xa_low = TQMAX (-mata->radius, xr - matb->radius);
|
|
|
|
const int xa_high = TQMIN (mata->radius, xr + matb->radius);
|
|
|
|
const int xa_high = TQMIN (mata->radius, xr + matb->radius);
|
|
|
|
register double val = 0.0;
|
|
|
|
double val = 0.0;
|
|
|
|
|
|
|
|
|
|
|
|
for (ya = ya_low; ya <= ya_high; ya++)
|
|
|
|
for (ya = ya_low; ya <= ya_high; ya++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -156,7 +156,7 @@ void RefocusMatrix::convolve_mat (CMat * result, const CMat * const mata, const
|
|
|
|
|
|
|
|
|
|
|
|
void RefocusMatrix::convolve_star_mat (CMat * result, const CMat * const mata, const CMat * const matb)
|
|
|
|
void RefocusMatrix::convolve_star_mat (CMat * result, const CMat * const mata, const CMat * const matb)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register int xr, yr, xa, ya;
|
|
|
|
int xr, yr, xa, ya;
|
|
|
|
|
|
|
|
|
|
|
|
for (yr = -result->radius; yr <= result->radius; yr++)
|
|
|
|
for (yr = -result->radius; yr <= result->radius; yr++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -166,7 +166,7 @@ void RefocusMatrix::convolve_star_mat (CMat * result, const CMat * const mata, c
|
|
|
|
const int ya_high = TQMIN (mata->radius, matb->radius - yr);
|
|
|
|
const int ya_high = TQMIN (mata->radius, matb->radius - yr);
|
|
|
|
const int xa_low = TQMAX (-mata->radius, -matb->radius - xr);
|
|
|
|
const int xa_low = TQMAX (-mata->radius, -matb->radius - xr);
|
|
|
|
const int xa_high = TQMIN (mata->radius, matb->radius - xr);
|
|
|
|
const int xa_high = TQMIN (mata->radius, matb->radius - xr);
|
|
|
|
register double val = 0.0;
|
|
|
|
double val = 0.0;
|
|
|
|
|
|
|
|
|
|
|
|
for (ya = ya_low; ya <= ya_high; ya++)
|
|
|
|
for (ya = ya_low; ya <= ya_high; ya++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -184,13 +184,13 @@ void RefocusMatrix::convolve_star_mat (CMat * result, const CMat * const mata, c
|
|
|
|
|
|
|
|
|
|
|
|
void RefocusMatrix::convolve_mat_fun (CMat * result, const CMat * const mata, double (f) (int, int))
|
|
|
|
void RefocusMatrix::convolve_mat_fun (CMat * result, const CMat * const mata, double (f) (int, int))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register int xr, yr, xa, ya;
|
|
|
|
int xr, yr, xa, ya;
|
|
|
|
|
|
|
|
|
|
|
|
for (yr = -result->radius; yr <= result->radius; yr++)
|
|
|
|
for (yr = -result->radius; yr <= result->radius; yr++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (xr = -result->radius; xr <= result->radius; xr++)
|
|
|
|
for (xr = -result->radius; xr <= result->radius; xr++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register double val = 0.0;
|
|
|
|
double val = 0.0;
|
|
|
|
|
|
|
|
|
|
|
|
for (ya = -mata->radius; ya <= mata->radius; ya++)
|
|
|
|
for (ya = -mata->radius; ya <= mata->radius; ya++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -219,7 +219,7 @@ int RefocusMatrix::as_cidx (const int k, const int l)
|
|
|
|
|
|
|
|
|
|
|
|
void RefocusMatrix::print_c_mat (const CMat * const mat)
|
|
|
|
void RefocusMatrix::print_c_mat (const CMat * const mat)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register int x, y;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
|
|
|
|
for (y = -mat->radius; y <= mat->radius; y++)
|
|
|
|
for (y = -mat->radius; y <= mat->radius; y++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -255,7 +255,7 @@ Mat *RefocusMatrix::make_s_matrix (CMat * mat, int m, double noise_factor)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const int mat_size = SQR (2 * m + 1);
|
|
|
|
const int mat_size = SQR (2 * m + 1);
|
|
|
|
Mat *result = allocate_matrix (mat_size, mat_size);
|
|
|
|
Mat *result = allocate_matrix (mat_size, mat_size);
|
|
|
|
register int yr, yc, xr, xc;
|
|
|
|
int yr, yc, xr, xc;
|
|
|
|
|
|
|
|
|
|
|
|
for (yr = -m; yr <= m; yr++)
|
|
|
|
for (yr = -m; yr <= m; yr++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -285,7 +285,7 @@ Mat *RefocusMatrix::make_s_cmatrix (CMat * mat, int m, double noise_factor)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const int mat_size = as_cidx (m + 1, 0);
|
|
|
|
const int mat_size = as_cidx (m + 1, 0);
|
|
|
|
Mat *result = allocate_matrix (mat_size, mat_size);
|
|
|
|
Mat *result = allocate_matrix (mat_size, mat_size);
|
|
|
|
register int yr, yc, xr, xc;
|
|
|
|
int yr, yc, xr, xc;
|
|
|
|
|
|
|
|
|
|
|
|
for (yr = 0; yr <= m; yr++)
|
|
|
|
for (yr = 0; yr <= m; yr++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -318,7 +318,7 @@ double RefocusMatrix::correlation (const int x, const int y, const double gamma,
|
|
|
|
Mat *RefocusMatrix::copy_vec (const CMat * const mat, const int m)
|
|
|
|
Mat *RefocusMatrix::copy_vec (const CMat * const mat, const int m)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mat *result = allocate_matrix (SQR (2 * m + 1), 1);
|
|
|
|
Mat *result = allocate_matrix (SQR (2 * m + 1), 1);
|
|
|
|
register int x, y, index = 0;
|
|
|
|
int x, y, index = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -336,7 +336,7 @@ Mat *RefocusMatrix::copy_vec (const CMat * const mat, const int m)
|
|
|
|
Mat *RefocusMatrix::copy_cvec (const CMat * const mat, const int m)
|
|
|
|
Mat *RefocusMatrix::copy_cvec (const CMat * const mat, const int m)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mat *result = allocate_matrix (as_cidx (m + 1, 0), 1);
|
|
|
|
Mat *result = allocate_matrix (as_cidx (m + 1, 0), 1);
|
|
|
|
register int x, y, index = 0;
|
|
|
|
int x, y, index = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (y = 0; y <= m; y++)
|
|
|
|
for (y = 0; y <= m; y++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -354,7 +354,7 @@ Mat *RefocusMatrix::copy_cvec (const CMat * const mat, const int m)
|
|
|
|
CMat *RefocusMatrix::copy_cvec2mat (const Mat * const cvec, const int m)
|
|
|
|
CMat *RefocusMatrix::copy_cvec2mat (const Mat * const cvec, const int m)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMat *result = allocate_c_mat (m);
|
|
|
|
CMat *result = allocate_c_mat (m);
|
|
|
|
register int x, y;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -370,7 +370,7 @@ CMat *RefocusMatrix::copy_cvec2mat (const Mat * const cvec, const int m)
|
|
|
|
CMat *RefocusMatrix::copy_vec2mat (const Mat * const cvec, const int m)
|
|
|
|
CMat *RefocusMatrix::copy_vec2mat (const Mat * const cvec, const int m)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMat *result = allocate_c_mat (m);
|
|
|
|
CMat *result = allocate_c_mat (m);
|
|
|
|
register int x, y;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -482,7 +482,7 @@ void RefocusMatrix::fill_matrix (CMat * matrix, const int m,
|
|
|
|
double f (const int, const int, const double),
|
|
|
|
double f (const int, const int, const double),
|
|
|
|
const double fun_arg)
|
|
|
|
const double fun_arg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register int x, y;
|
|
|
|
int x, y;
|
|
|
|
init_c_mat (matrix, m);
|
|
|
|
init_c_mat (matrix, m);
|
|
|
|
|
|
|
|
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
@ -498,7 +498,7 @@ void RefocusMatrix::fill_matrix2 (CMat * matrix, const int m,
|
|
|
|
double f (const int, const int, const double, const double),
|
|
|
|
double f (const int, const int, const double, const double),
|
|
|
|
const double fun_arg1, const double fun_arg2)
|
|
|
|
const double fun_arg1, const double fun_arg2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register int x, y;
|
|
|
|
int x, y;
|
|
|
|
init_c_mat (matrix, m);
|
|
|
|
init_c_mat (matrix, m);
|
|
|
|
|
|
|
|
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
|
for (y = -m; y <= m; y++)
|
|
|
@ -512,7 +512,7 @@ void RefocusMatrix::fill_matrix2 (CMat * matrix, const int m,
|
|
|
|
|
|
|
|
|
|
|
|
void RefocusMatrix::make_gaussian_convolution (const double gradius, CMat * convolution, const int m)
|
|
|
|
void RefocusMatrix::make_gaussian_convolution (const double gradius, CMat * convolution, const int m)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register int x, y;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef RF_DEBUG
|
|
|
|
#ifdef RF_DEBUG
|
|
|
|
DDebug() << "gauss: " << gradius << endl;
|
|
|
|
DDebug() << "gauss: " << gradius << endl;
|
|
|
@ -589,9 +589,9 @@ double RefocusMatrix::circle_intensity (const int x, const int y, const double r
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
register double xlo = TQABS (x) - 0.5, xhi = TQABS (x) + 0.5,
|
|
|
|
double xlo = TQABS (x) - 0.5, xhi = TQABS (x) + 0.5,
|
|
|
|
ylo = TQABS (y) - 0.5, yhi = TQABS (y) + 0.5;
|
|
|
|
ylo = TQABS (y) - 0.5, yhi = TQABS (y) + 0.5;
|
|
|
|
register double symmetry_factor = 1, xc1, xc2;
|
|
|
|
double symmetry_factor = 1, xc1, xc2;
|
|
|
|
|
|
|
|
|
|
|
|
if (xlo < 0)
|
|
|
|
if (xlo < 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|