37 static void reconstruct(
char* filename,
int N,
int M,
int Z,
int weight ,fftw_complex *mem)
49 my_N[0]=N; my_n[0]=ceil(N*1.2);
50 my_N[1]=N; my_n[1]=ceil(N*1.2);
58 nfft_precompute_lin_psi(&my_plan);
60 fin=fopen(filename,
"r");
63 fweight=fopen(
"weights.dat",
"r");
64 for(j=0;j<my_plan.M_total;j++)
66 fscanf(fweight,
"%le ",&weights);
67 fscanf(fin,
"%le %le %le %le %le",
68 &my_plan.x[2*j+0],&my_plan.x[2*j+1],&tmp,&real,&imag);
69 my_plan.f[j] = real + _Complex_I*imag;
71 my_plan.f[j] = my_plan.f[j] * weights;
76 if(z==0 && my_plan.flags &
PRE_PSI)
77 nfft_precompute_psi(&my_plan);
81 nfft_precompute_full_psi(&my_plan);
84 nfft_adjoint(&my_plan);
86 for(k=0;k<my_plan.N_total;k++) {
89 mem[(Z*N*N/2+z*N*N+ k)%(Z*N*N)] = my_plan.f_hat[k];
94 nfft_finalize(&my_plan);
101 static void print(
int N,
int M,
int Z, fftw_complex *mem)
106 fout_real=fopen(
"output_real.dat",
"w");
107 fout_imag=fopen(
"output_imag.dat",
"w");
110 for (j=0;j<N*N;j++) {
111 fprintf(fout_real,
"%le ",creal(mem[(Z*N*N/2+i*N*N+ j)%(Z*N*N)]) /Z);
112 fprintf(fout_imag,
"%le ",cimag(mem[(Z*N*N/2+i*N*N+ j)%(Z*N*N)]) /Z);
114 fprintf(fout_real,
"\n");
115 fprintf(fout_imag,
"\n");
123 int main(
int argc,
char **argv)
130 printf(
"usage: ./reconstruct_data_gridding FILENAME N M Z ITER WEIGHTS\n");
140 mem = (fftw_complex*) nfft_malloc(
sizeof(fftw_complex) * atoi(argv[2]) * atoi(argv[2]) * atoi(argv[4]));
143 plan = fftw_plan_many_dft(1, &Z, N*N,
148 FFTW_BACKWARD, FFTW_MEASURE);
151 reconstruct(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[6]),mem);
static void reconstruct(char *filename, int N, int M, int Z, int weight, fftw_complex *mem)
reconstruct makes an 2d-adjoint-nfft for every slice
static void print(int N, int M, int Z, fftw_complex *mem)
print writes the memory back in a file output_real.dat for the real part and output_imag....
Header file for the nfft3 library.