37 static void reconstruct(
char* filename,
int N,
int M,
int Z,
int iteration,
int weight)
42 solver_plan_complex my_iplan;
47 double epsilon=0.0000003;
54 my_N[0]=Z; my_n[0]=ceil(Z*1.2);
55 my_N[1]=N; my_n[1]=ceil(N*1.2);
56 my_N[2]=N; my_n[2]=ceil(N*1.2);
57 nfft_init_guru(&my_plan, 3, my_N, M, my_n, 6,
64 nfft_precompute_lin_psi(&my_plan);
70 solver_init_advanced_complex(&my_iplan,(nfft_mv_plan_complex*)(&my_plan), infft_flags );
75 fin=fopen(
"weights.dat",
"r");
78 fscanf(fin,
"%le ",&my_iplan.w[j]);
92 double r=sqrt(j2*j2+k2*k2+z2*z2);
94 my_iplan.w_hat[z*N*N+j*N+k]=0.0;
96 my_iplan.w_hat[z*N*N+j*N+k]=1.0;
103 fin=fopen(filename,
"r");
106 fout_real=fopen(
"output_real.dat",
"w");
107 fout_imag=fopen(
"output_imag.dat",
"w");
112 fscanf(fin,
"%le %le %le %le %le ",&my_plan.x[3*j+1],&my_plan.x[3*j+2], &my_plan.x[3*j+0],
114 my_iplan.y[j] = real + _Complex_I*imag;
119 nfft_precompute_psi(&my_plan);
123 nfft_precompute_full_psi(&my_plan);
126 for(k=0;k<my_plan.N_total;k++)
127 my_iplan.f_hat_iter[k]=0.0;
130 solver_before_loop_complex(&my_iplan);
131 for(l=0;l<iteration;l++)
134 if(my_iplan.dot_r_iter<epsilon)
136 fprintf(stderr,
"%e, %i of %i\n",sqrt(my_iplan.dot_r_iter),
138 solver_loop_one_step_complex(&my_iplan);
146 fprintf(fout_real,
"%le ",creal(my_iplan.f_hat_iter[ k+N*N*l ]));
147 fprintf(fout_imag,
"%le ",cimag(my_iplan.f_hat_iter[ k+N*N*l ]));
149 fprintf(fout_real,
"\n");
150 fprintf(fout_imag,
"\n");
156 solver_finalize_complex(&my_iplan);
157 nfft_finalize(&my_plan);
160 int main(
int argc,
char **argv)
163 printf(
"usage: ./reconstruct3D FILENAME N M Z ITER WEIGHTS\n");
167 reconstruct(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]),atoi(argv[6]));
static void reconstruct(char *filename, int N, int M, int Z, int iteration, int weight)
reconstruct makes an inverse 3d-nfft
#define PRECOMPUTE_WEIGHT
Header file for the nfft3 library.