40 static void reconstruct(
char* filename,
int N,
int M,
int weight)
51 int flags = PRE_PHI_HUT| PRE_PSI |MALLOC_X| MALLOC_F_HAT|
52 MALLOC_F| FFTW_INIT| FFT_OUT_OF_PLACE|
53 FFTW_MEASURE| FFTW_DESTROY_INPUT;
56 my_N[0]=N; my_n[0]=ceil(N*1.2);
57 my_N[1]=N; my_n[1]=ceil(N*1.2);
58 nfft_init_guru(&my_plan, 2, my_N, M, my_n, 6,flags,
59 FFTW_MEASURE| FFTW_DESTROY_INPUT);
61 fin=fopen(filename,
"r");
63 fweight=fopen(
"weights.dat",
"r");
66 fscanf(fweight,
"%le ",&weights);
67 fscanf(fin,
"%le %le %le %le",&my_plan.
x[2*j+0],&my_plan.
x[2*j+1],&real,&imag);
68 my_plan.
f[j] = real + _Complex_I*imag;
70 my_plan.
f[j] = my_plan.
f[j] * weights;
76 nfft_precompute_psi(&my_plan);
80 nfft_precompute_full_psi(&my_plan);
84 nfft_adjoint(&my_plan);
86 fout_real=fopen(
"output_real.dat",
"w");
87 fout_imag=fopen(
"output_imag.dat",
"w");
90 fprintf(fout_real,
"%le ",creal(my_plan.
f_hat[j]));
91 fprintf(fout_imag,
"%le ",cimag(my_plan.
f_hat[j]));
98 nfft_finalize(&my_plan);
102 int main(
int argc,
char **argv)
105 printf(
"usage: ./reconstruct_data_gridding FILENAME N M ITER WEIGHTS\n");
108 reconstruct(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[5]));