/* * RF Beamforming Simulation of Ultrasound Scanner based on Delta-Sigma A/D or Multi-Bit A/D or Raw Data * * Program Flow : Data Bank(N*N) => Given Parameters => * For each Beam,{ Delay Evaluation(Delay Controler/Delay Table) => * Apodization Coef. Evaluation => Received Signal Synthesis(N, tx delay ok) => * Quantization(Delta-Sigma A/D,Mult-Bit A/D,Raw Data) => * Received Delaying(N, rx delay ok) => Beamsum } * * Edited by JJH * Commented by mlLee 2001/2/5 */ #include #include #include #include #include #include #pragma hdrstop int main(int argc, char **argv) { /* * --------------------------- Given Parameters ---------------------------------- */ bool IsApodization=false; // Apodization Flag bool IsDelayControl=false; // Delay Control Flag enum {rf, multibit, delsig} a2d; // enumeration for the choice of A/Ds,raw data,mult-bit,delta-sigma a2d = rf; enum {rep, divide, zero, hold, alt} method; // enumeration for the choice method = divide; // of Delay Compensation with delta-sigma A/D const int Nbit=10; // Number of Bits for multi-bit A/D const int Napodiz=7; // Number of Apodization ,applied when IsApodization is true; const float normal=200000; // used to normalize data obtained from acuson17c.dat const float my_pi=3.14159265358979; // value definition of pi // Command Arguments Check if(argc!=3){ cout<<"You must give I/O file names!"< 0 } short ***datafile=new short**[Nchan]; // Raw Data in the format Nchan*Ncha*Nsample for(int i=0;i 0 } } int *tdelay=new int[Nchan]; // tx delay for one beam, Nchan for (int i=0;iindexon)?indexoffset:indexon; int k0=(int)(x*x*cost2*fad*fad*upsamp*upsamp/soundv/soundv/n0-x*sint*fad*upsamp/soundv+0.5); int r0=(int)(x*x*cost2*fad*fad*upsamp*upsamp/soundv/soundv/n0); int tau=1-r0; int A=n0+tau; int n=n0+1; int B=A+n+2; rdelay[i][n0-indexoffset]=k0; for(int j=n0-indexoffset;j=rangeon) rdelay[i][j]=floor(fad*upsamp*((x*x*cost2/2/range)-(x*sint))/soundv+0.5); else rdelay[i][j]=garbage; } } } //------------------------------------------------------------------------------------------ //------------------------------------apodization coeff------------------------------------- if(IsApodization){ cout<Nchan) Nopen=Nchan; for(int i=0;i=0 && n=0 && (index+1)big){ big=fabs(gotdata[i][j]); } } cout<=0)+(v2[j+1]<0)*-1; } for(int j=0;j0 && (rindex+1)