30 #define MAX(a,b) (((a)>(b))?(a):(b)) 47 double time,min_time,max_time,min_inh,max_inh;
49 FILE *fp,*fout,*fi,*finh,*ftime;
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;
61 ftime=fopen(
"readout_time.dat",
"r");
62 finh=fopen(
"inh.dat",
"r");
64 min_time=INT_MAX; max_time=INT_MIN;
67 fscanf(ftime,
"%le ",&time);
76 Ts=(min_time+max_time)/2.0;
78 min_inh=INT_MAX; max_inh=INT_MIN;
81 fscanf(finh,
"%le ",&w);
90 N3=ceil((MAX(fabs(min_inh),fabs(max_inh))*(max_time-min_time)/2.0+m/(2*sigma))*4*sigma);
91 T=((max_time-min_time)/2.0)/(0.5-((double) m)/N3);
94 my_N[0]=N; my_n[0]=ceil(N*sigma);
95 my_N[1]=N; my_n[1]=ceil(N*sigma);
96 my_N[2]=N3; my_n[2]=N3;
99 mri_inh_2d1d_init_guru(&my_plan, my_N, M, my_n, m, sigma, flags,
100 FFTW_MEASURE| FFTW_DESTROY_INPUT);
102 ftime=fopen(
"readout_time.dat",
"r");
103 fp=fopen(
"knots.dat",
"r");
107 fscanf(fp,
"%le %le ",&my_plan.plan.
x[2*j+0],&my_plan.plan.
x[2*j+1]);
108 fscanf(ftime,
"%le ",&my_plan.t[j]);
109 my_plan.t[j] = (my_plan.t[j]-Ts)/T;
114 finh=fopen(
"inh.dat",
"r");
117 fscanf(finh,
"%le ",&my_plan.w[j]);
123 fi=fopen(
"input_f.dat",
"r");
126 fscanf(fi,
"%le ",&real);
127 my_plan.
f_hat[j] = real*cexp(2.0*_Complex_I*M_PI*Ts*my_plan.w[j]*W);
130 if(my_plan.plan.
flags & PRE_PSI)
131 nfft_precompute_psi(&my_plan.plan);
133 mri_inh_2d1d_trafo(&my_plan);
135 fout=fopen(file,
"w");
139 fprintf(fout,
"%le %le %le %le\n",my_plan.plan.
x[2*j+0],my_plan.plan.
x[2*j+1],creal(my_plan.
f[j]),cimag(my_plan.
f[j]));
144 mri_inh_2d1d_finalize(&my_plan);
147 int main(
int argc,
char **argv)
150 printf(
"usage: ./construct_data_inh_2d1d FILENAME N M\n");
154 construct(argv[1],atoi(argv[2]),atoi(argv[3]));
fftw_complex * f_hat
Fourier coefficients.
NFFT_INT M_total
Total number of samples.
static void construct(char *file, int N, int M)
construct
double * x
Nodes in time/spatial domain, size is doubles.
unsigned flags
Flags for precomputation, (de)allocation, and FFTW usage, default setting is PRE_PHI_HUT | PRE_PSI | ...