📄 bft_user_guide.tex
字号:
136{\tt~~}{\tt field\_end}\\137{\tt~~}{\tt bft\_end}\\138{\tt~~}{\tt }\\139{\tt~~}{\tt env\_line~=~env\_line~/~max(max(abs(env\_line)));}\\140{\tt~~}{\tt env\_bf~=~env\_bf~/~max(max(abs(env\_bf)));}\\141{\tt~~}{\tt }\\142{\tt~~}{\tt figure;}\\143{\tt~~}{\tt subplot(1,2,1)}\\144{\tt~~}{\tt imagesc([-sector/2~sector/2]*180/pi,[0~Rmax]*1000,20*log10(env\_line~+~0.001))}\\145{\tt~~}{\tt axis('image')}\\146{\tt~~}{\tt xlabel('Angle~[deg]');}\\147{\tt~~}{\tt ylabel('Axial~distance~[mm]')}\\148{\tt~~}{\tt title('Beamformed~by~Field~II~');}\\149{\tt~~}{\tt }\\150{\tt~~}{\tt subplot(1,2,2)}\\151{\tt~~}{\tt imagesc([-sector/2~sector/2]*180/pi,[0~Rmax]*1000,20*log10(env\_bf~+~0.001));}\\152{\tt~~}{\tt title('Beamformed~by~BFT');}\\153{\tt~~}{\tt xlabel('Angle~[deg]');}\\154{\tt~~}{\tt ylabel('Axial~distance~[mm]')}\\155{\tt~~}{\tt axis('image')}\\156{\tt~~}{\tt }\\157{\tt~~}{\tt colorbar}\\158{\tt~~}{\tt colormap(gray)}\\159{\tt~~}{\tt }\\160{\tt~~}{\tt clc}\\161{\tt~~}{\tt disp(['~'~10~10~10~10~]);}\\162{\tt~~}{\tt disp([9~'*****************************************************']);}\\163{\tt~~}{\tt disp([9~'*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*']);}\\164{\tt~~}{\tt disp([9~'*~The~image~beamformed~by~Field~II~is~in~"env\_line"~*']);}\\165{\tt~~}{\tt disp([9~'*~The~image~beamformed~by~BFT~is~in~"env\_bf"~~~~~~~~*']);}\\166{\tt~~}{\tt disp([9~'*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*'])}\\167{\tt~~}{\tt disp([9~'*****************************************************']);}\\168{\tt~~}{\tt disp(['~'~10~10~]);}\\169{\tt~~}{\tt }\\170{\tt~~}{\tt }\\}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\headline{Dynamic focusing}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html} %%tth:\subsection*{Dynamic focusing}%%tth:\begin{html}<hr>\end{html}\funlnk{dynamic_focusing}{\footnotesize\noindent1{\tt~~~~}{\tt {\sl \%PHASED\_DYN\_IMAGE~Create~a~phased-array~B-mode~image,~using~the~}}\\2{\tt~~~~}{\tt {\sl \%~~~~commands~for~setting~a~dynamic~focusing}}\\3{\tt~~~~}{\tt }\\4{\tt~~~~}{\tt {\sl \%VERSION~1.0,~29~Feb~2000,~Svetoslav~Nikolov}}\\5{\tt~~~~}{\tt }\\6{\tt~~~~}{\tt f0~=~4e6;~~~~~~~~~~~~~~{\sl \%~~Central~frequency~~~~~~~~~~~~~~~~~~~~~~~~[Hz]}}\\7{\tt~~~~}{\tt fs~=~100e6;~~~~~~~~~~~~{\sl \%~~Sampling~frequency~~~~~~~~~~~~~~~~~~~~~~~[Hz]}}\\8{\tt~~~~}{\tt c~=~1540;~~~~~~~~~~~~~~{\sl \%~~Speed~of~sound~~~~~~~~~~~~~~~~~~~~~~~~~~~[m/s]}}\\9{\tt~~~~}{\tt B~=~.35;~~~~~~~~~~~~~~~{\sl \%~~Relative~bandwith~~~~~~~~~~~~~~~~~~~~~~~~[fraction]}}\\10{\tt~~~}{\tt no\_elements~=~64;~~~~~~{\sl \%~~Number~of~elements~in~the~transducer~~~~~}}\\11{\tt~~~}{\tt }\\12{\tt~~~}{\tt lambda~=~c~/~f0;~~~~~~~{\sl \%~Wavelength~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m]}}\\13{\tt~~~}{\tt pitch~=~lambda~/~2;~~~~{\sl \%~Pitch~-~center-to-center~~~~~~~~~~~~~~~~~~[m]}}\\14{\tt~~~}{\tt width~=~.95*pitch;~~~~~{\sl \%~Width~of~the~element~~~~~~~~~~~~~~~~~~~~~~[m]}}\\15{\tt~~~}{\tt kerf~=~pitch~-~width;~~{\sl \%~Inter-element~spacing~~~~~~~~~~~~~~~~~~~~~[m]}}\\16{\tt~~~}{\tt height~=~10/1000;~~~~~~{\sl \%~Size~in~the~Y~direction~~~~~~~~~~~~~~~~~~~[m]}}\\17{\tt~~~}{\tt ~}\\18{\tt~~~}{\tt ~}\\19{\tt~~~}{\tt {\sl \%~~Define~the~impulse~response~of~the~transducer}}\\20{\tt~~~}{\tt impulse\_response~=~sin(2*pi*f0*(0:1/fs:2/f0));}\\21{\tt~~~}{\tt impulse\_response~=~impulse\_response.*hanning(length(impulse\_response))';}\\22{\tt~~~}{\tt excitation~=~impulse\_response;}\\23{\tt~~~}{\tt }\\24{\tt~~~}{\tt {\sl \%~~Define~the~phantom}}\\25{\tt~~~}{\tt }\\26{\tt~~~}{\tt pht\_pos~=~[0~0~20;}\\27{\tt~~~}{\tt ~~~~~~~~~~~0~0~30;}\\28{\tt~~~}{\tt ~~~~~~~~~~~0~0~40;}\\29{\tt~~~}{\tt ~~~~~~~~~~~0~0~50;}\\30{\tt~~~}{\tt ~~~~~~~~~~~0~0~60;}\\31{\tt~~~}{\tt ~~~~~~~~~~~0~0~70;}\\32{\tt~~~}{\tt ~~~~~~~~~~~0~0~80;]~/~1000;~~~~~~~~~{\sl \%~~The~position~of~the~phantom}}\\33{\tt~~~}{\tt pht\_amp~=~20*ones(7,1);~~~~~~{\sl \%~~The~amplitude~of~the~back-scatter}}\\34{\tt~~~}{\tt }\\35{\tt~~~}{\tt {\sl \%~~Define~the~focus~}}\\36{\tt~~~}{\tt focus\_r~=~[20;30;40;50;60;70;80;90]~/~1000;}\\37{\tt~~~}{\tt T~=~(focus\_r-5/1000)/c~*2;}\\38{\tt~~~}{\tt }\\39{\tt~~~}{\tt {\sl \%~~Initialize~the~program}}\\40{\tt~~~}{\tt field\_init(0);}\\41{\tt~~~}{\tt bft\_init;}\\42{\tt~~~}{\tt }\\43{\tt~~~}{\tt {\sl \%~~Set~some~paramters}}\\44{\tt~~~}{\tt set\_field('c',~c);}\\45{\tt~~~}{\tt bft\_param('c',~c);}\\46{\tt~~~}{\tt }\\47{\tt~~~}{\tt set\_field('fs',~fs);}\\48{\tt~~~}{\tt bft\_param('fs',~fs);}\\49{\tt~~~}{\tt }\\50{\tt~~~}{\tt }\\51{\tt~~~}{\tt {\sl \%~Create~some~apertures.}}\\52{\tt~~~}{\tt }\\53{\tt~~~}{\tt xmt~=~xdc\_linear\_array(no\_elements,width,height,kerf,1,1,[0~0~0]);}\\54{\tt~~~}{\tt rcv~=~xdc\_linear\_array(no\_elements,width,height,kerf,1,1,[0~0~0]);}\\55{\tt~~~}{\tt }\\56{\tt~~~}{\tt xdc~=~bft\_linear\_array(no\_elements,~width,~kerf);}\\57{\tt~~~}{\tt }\\58{\tt~~~}{\tt }\\59{\tt~~~}{\tt {\sl \%~Set~the~impulse~responses}}\\60{\tt~~~}{\tt xdc\_impulse(rcv,~impulse\_response);}\\61{\tt~~~}{\tt xdc\_impulse(xmt,~impulse\_response);}\\62{\tt~~~}{\tt }\\63{\tt~~~}{\tt xdc\_excitation(xmt,~excitation);}\\64{\tt~~~}{\tt }\\65{\tt~~~}{\tt }\\66{\tt~~~}{\tt {\sl \%~Set~the~apodization}}\\67{\tt~~~}{\tt }\\68{\tt~~~}{\tt xdc\_apodization(xmt,~0,~ones(1,no\_elements))}\\69{\tt~~~}{\tt xdc\_apodization(rcv,~0,~ones(1,no\_elements))}\\70{\tt~~~}{\tt bft\_apodization(xdc,~0~,~ones(1,no\_elements))}\\71{\tt~~~}{\tt }\\72{\tt~~~}{\tt {\sl \%~~Define~and~create~the~image}}\\73{\tt~~~}{\tt sector~=~30~*~pi~/~180;}\\74{\tt~~~}{\tt no\_lines~=~32;}\\75{\tt~~~}{\tt d\_theta~=~sector~/~(no\_lines-1);}\\76{\tt~~~}{\tt theta~=~-(no\_lines-1)~/~2~*~d\_theta;}\\77{\tt~~~}{\tt }\\78{\tt~~~}{\tt Rmax~=~max(sqrt(pht\_pos(:,1).\^~2~+~pht\_pos(:,2).\^~2~~+~pht\_pos(:,3).\^~2))~+~15/1000;}\\79{\tt~~~}{\tt }\\80{\tt~~~}{\tt no\_rf\_samples~=~ceil(2*Rmax/c~*~fs);}\\81{\tt~~~}{\tt rf\_line~=~zeros(no\_rf\_samples,~1);}\\82{\tt~~~}{\tt bf\_line~=~zeros(no\_rf\_samples,~1);}\\83{\tt~~~}{\tt }\\84{\tt~~~}{\tt env\_line~=~zeros(no\_rf\_samples,~no\_lines);}\\85{\tt~~~}{\tt env\_bf~=~~zeros(no\_rf\_samples,~no\_lines);}\\86{\tt~~~}{\tt }\\87{\tt~~~}{\tt }\\88{\tt~~~}{\tt xmt\_r~=~(max(focus\_r)~+~min(focus\_r)~)/2;}\\89{\tt~~~}{\tt bf~=~cell(no\_lines,1);}\\90{\tt~~~}{\tt for~i~=~1~:~no\_lines}\\91{\tt~~~}{\tt ~~rf\_line(:)~=~0;~~}\\92{\tt~~~}{\tt ~~theta}\\93{\tt~~~}{\tt ~~}\\94{\tt~~~}{\tt ~~xmt\_f~=~[sin(theta)*xmt\_r,~zeros(length(xmt\_r),1),~cos(theta)*xmt\_r];}\\95{\tt~~~}{\tt ~~xdc\_center\_focus(xmt,[0~0~0])}\\96{\tt~~~}{\tt ~~xdc\_center\_focus(rcv,[0~0~0])}\\97{\tt~~~}{\tt ~~bft\_center\_focus([0~0~0]);}\\98{\tt~~~}{\tt ~~}\\99{\tt~~~}{\tt ~~xdc\_focus(xmt,~0,~xmt\_f);}\\100{\tt~~}{\tt ~~xdc\_dynamic\_focus(rcv,~0,~theta,~0);}\\101{\tt~~}{\tt ~~}\\102{\tt~~}{\tt ~~{\sl \%~~Beamform~with~Field~II}}\\103{\tt~~}{\tt ~~[rf\_temp,~t(i)]~=~calc\_scat(xmt,rcv,~pht\_pos,~pht\_amp);}\\104{\tt~~}{\tt ~~}\\105{\tt~~}{\tt ~~{\sl \%~~Beamform~with~BFT}}\\106{\tt~~}{\tt ~~bft\_dynamic\_focus(xdc,~theta,~0)}\\107{\tt~~}{\tt ~~xdc\_focus\_times(rcv,~0,~zeros(1,no\_elements));}\\108{\tt~~}{\tt ~~[rf\_data,~start\_t]~=~calc\_scat\_multi(xmt,rcv,~pht\_pos,~pht\_amp);}\\109{\tt~~}{\tt ~~}\\110{\tt~~}{\tt ~~rf\_data~=~[zeros(300,no\_elements);~rf\_data;~zeros(300,no\_elements)];}\\111{\tt~~}{\tt }\\112{\tt~~}{\tt ~~start\_t~=~start\_t~-~300~~/~fs;}\\113{\tt~~}{\tt ~~bf\_temp~=~bft\_beamform(start\_t,~rf\_data);}\\114{\tt~~}{\tt ~~}\\115{\tt~~}{\tt ~~start\_sample~=~t(i)*fs;~no\_temp\_samples~=~length(rf\_temp);}\\116{\tt~~}{\tt ~~}\\117{\tt~~}{\tt ~~rf\_line(start\_sample:start\_sample+no\_temp\_samples-1)~=~rf\_temp(1:no\_temp\_samples);}\\118{\tt~~}{\tt ~~env\_line(:,i)~=~abs(hilbert(rf\_line(:)));}\\119{\tt~~}{\tt }\\120{\tt~~}{\tt ~~start\_sample~=~floor(start\_t*fs);~no\_temp\_samples~=~length(bf\_temp);}\\121{\tt~~}{\tt ~~bf{i}~=~bf\_temp;}\\122{\tt~~}{\tt ~~}\\123{\tt~~}{\tt ~~bf\_line(start\_sample:start\_sample+no\_temp\_samples-1)~=~bf\_temp(1:no\_temp\_samples);}\\124{\tt~~}{\tt ~~env\_bf(:,i)~=~abs(hilbert(bf\_line(:)));}\\125{\tt~~}{\tt ~~theta~=~theta~+~d\_theta;}\\126{\tt~~}{\tt }\\127{\tt~~}{\tt end}\\128{\tt~~}{\tt }\\129{\tt~~}{\tt {\sl \%~~Release~the~allocated~memory}}\\130{\tt~~}{\tt }\\131{\tt~~}{\tt field\_end}\\132{\tt~~}{\tt bft\_end}\\133{\tt~~}{\tt env\_line~=~env\_line~/~max(max(abs(env\_line)));}\\134{\tt~~}{\tt env\_bf~=~env\_bf~/~max(max(abs(env\_bf)));}\\135{\tt~~}{\tt }\\136{\tt~~}{\tt figure;}\\137{\tt~~}{\tt subplot(1,2,1)}\\138{\tt~~}{\tt imagesc([-sector/2~sector/2]*180/pi,[0~Rmax]*1000,20*log10(env\_line~+~0.001))}\\139{\tt~~}{\tt axis('image')}\\140{\tt~~}{\tt xlabel('Angle~[deg]');}\\141{\tt~~}{\tt ylabel('Axial~distance~[mm]')}\\142{\tt~~}{\tt title('Beamformed~by~Field~II~');}\\143{\tt~~}{\tt }\\144{\tt~~}{\tt subplot(1,2,2)}\\145{\tt~~}{\tt imagesc([-sector/2~sector/2]*180/pi,[0~Rmax]*1000,20*log10(env\_bf~+~0.001));}\\146{\tt~~}{\tt title('Beamformed~by~BFT');}\\147{\tt~~}{\tt xlabel('Angle~[deg]');}\\148{\tt~~}{\tt ylabel('Axial~distance~[mm]')}\\149{\tt~~}{\tt axis('image')}\\150{\tt~~}{\tt }\\151{\tt~~}{\tt colorbar}\\152{\tt~~}{\tt colormap(gray)}\\153{\tt~~}{\tt }\\154{\tt~~}{\tt clc}\\155{\tt~~}{\tt disp(['~'~10~10~10~10~]);}\\156{\tt~~}{\tt disp([9~'*****************************************************']);}\\157{\tt~~}{\tt disp([9~'*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*']);}\\158{\tt~~}{\tt disp([9~'*~The~image~beamformed~by~Field~II~is~in~"env\_line"~*']);}\\159{\tt~~}{\tt disp([9~'*~The~image~beamformed~by~BFT~is~in~"env\_bf"~~~~~~~~*']);}\\160{\tt~~}{\tt disp([9~'*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*'])}\\161{\tt~~}{\tt disp([9~'*****************************************************']);}\\162{\tt~~}{\tt disp(['~'~10~10~]);}\\163{\tt~~}{\tt }\\164{\tt~~}{\tt }\\}\headline{Synthetic Aperture Focusing}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html} %%tth:\subsection*{Synthetic Aperture Focusing}%%tth:\begin{html}<hr>\end{html}\funlnk{sar_focusing}{\footnotesize\noindent1{\tt~~~~}{\tt {\sl \%SYNTHETIC~Synthetic~aperture~beamforming~with~BFT}}\\2{\tt~~~~}{\tt {\sl \%~}}\\3{\tt~~~~}{\tt }\\4{\tt~~~~}{\tt }\\5{\tt~~~~}{\tt f0~=~4e6;~~~~~~~~~~~~~~{\sl \%~~Central~frequency}}\\6{\tt~~~~}{\tt fs~=~100e6;~~~~~~~~~~~~{\sl \%~~Sampling~frequency}}\\7{\tt~~~~}{\tt c~=~1540;~~~~~~~~~~~~~~{\sl \%~~Speed~of~sound}}\\8{\tt~~~~}{\tt no\_elements~=~64;~~~~~~{\sl \%~~Number~of~elements~in~the~transducer}}\\9{\tt~~~~}{\tt }\\10{\tt~~~}{\tt lambda~=~c~/~f0;~~~~~~~{\sl \%~Wavelength}}\\11{\tt~~~}{\tt pitch~=~lambda~/~2;~~~~{\sl \%~Pitch~-~center-to-center}}\\12{\tt~~~}{\tt width~=~.95*pitch;~~~~~{\sl \%~Width~of~the~element}}\\13{\tt~~~}{\tt kerf~=~pitch~-~width;~~{\sl \%~Inter-element~spacing}}\\14{\tt~~~}{\tt height~=~10/1000;~~~~~~{\sl \%~Size~in~the~Y~direction}}\\15{\tt~~~}{\tt ~}\\16{\tt~~~}{\tt ~}\\17{\tt~~~}{\tt {\sl \%~~Define~the~impulse~response~of~the~transducer}}\\18{\tt~~~}{\tt impulse\_response~=~sin(3*pi*f0*(0:1/fs:2/f0));}\\19{\tt~~~}{\tt impulse\_response~=~impulse\_response.*hanning(length(impulse\_response))';}\\20{\tt~~~}{\tt excitation~=~sin(2*pi*f0*(0:1/fs:3/f0));}\\21{\tt~~~}{\tt }\\22{\tt~~~}{\tt {\sl \%~~Define~the~phantom}}\\23{\tt~~~}{\tt }\\24{\tt~~~}{\tt pht\_pos~=~[0~0~40]~/~1000;~~~{\sl \%~~The~position~of~the~phantom}}\\25{\tt~~~}{\tt }\\26{\tt~~~}{\tt [m~n]~=~size(pht\_pos);}\\27{\tt~~~}{\tt pht\_amp~=~20*ones(m,1);~~~~~~{\sl \%~~The~amplitude~of~the~back-scatter}}\\28{\tt~~~}{\tt }\\29{\tt~~~}{\tt }\\30{\tt~~~}{\tt {\sl \%~~Define~the~focus~}}\\31{\tt~~~}{\tt }\\32{\tt~~~}{\tt focus\_r~=~[1:max(sqrt(pht\_pos(:,1).\^~2~+~pht\_pos(:,2).\^~2~+~pht\_pos(:,3).\^~2))*1000]'~/~1000;}\\33{\tt~~~}{\tt T~=~(focus\_r-.5/1000)/c~*2;}\\34{\tt~~~}{\tt }\\35{\tt~~~}{\tt }\\36{\tt~~~}{\tt }\\37{\tt~~~}{\tt {\sl \%~~Initialize~the~program}}\\38{\tt~~~}{\tt field\_init(0);}\\39{\tt~~~}{\tt bft\_init;}\\40{\tt~~~}{\tt }\\41{\tt~~~}{\tt {\sl \%~~Set~some~paramters}}\\42{\tt~~~}{\tt set\_field('c',~c);}\\43{\tt~~~}{\tt bft\_param('c',~c);}\\44{\tt~~~}{\tt }\\45{\tt~~~}{\tt set\_field('fs',~fs);}\\46{\tt~~~}{\tt bft\_param('fs',~fs);}\\47{\tt~~~}{\tt }\\48{\tt~~~}{\tt }\\49{\tt~~~}{\tt {\sl \%~Create~some~apertures.}}\\50{\tt~~~}{\tt }\\51{\tt~~~}{\tt xmt~=~xdc\_linear\_array(no\_elements,width,height,kerf,1,1,[0~0~0]);}\\52{\tt~~~}{\tt rcv~=~xdc\_linear\_array(no\_elements,width,height,kerf,1,1,[0~0~0]);}\\53{\tt~~~}{\tt }\\54{\tt~~~}{\tt xdc~=~bft\_linear\_array(no\_elements,~width,~kerf);}\\55{\tt~~~}{\tt }\\56{\tt~~~}{\tt }\\57{\tt~~~}{\tt {\sl \%~Set~the~impulse~responses}}\\58{\tt~~~}{\tt xdc\_impulse(rcv,~impulse\_response);}\\59{\tt~~~}{\tt xdc\_impulse(xmt,~impulse\_response);}\\60{\tt~~~}{\tt }\\61{\tt~~~}{\tt xdc\_excitation(xmt,~excitation);}\\62{\tt~~~}{\tt }\\63{\tt~~~}{\tt }\\64{\tt~~~}{\tt {\sl \%~~Define~and~create~the~image}}\\65{\tt~~~}{\tt sector~=~60~*~pi~/~180;}\\66{\tt~~~}{\tt no\_lines~=~64;}\\67{\tt~~~}{\tt d\_theta~=~sector~/~(no\_lines-1);}\\68{\tt~~~}{\tt theta~=~-(no\_lines-1)~/~2~*~d\_theta;}\\69{\tt~~~}{\tt }\\70{\tt~~~}{\tt {\sl \%~~Set~the~delays~for~one~whole~image}}\\71{\tt~~~}{\tt {\sl \%}}\\72{\tt~~~}{\tt bft\_no\_lines(no\_lines);}\\73{\tt~~~}{\tt for~i~=~1~:~no\_lines}\\74{\tt~~~}{\tt ~~bft\_apodization(xdc,0,hanning(no\_elements)',i);}\\75{\tt~~~}{\tt {\sl \%~~bft\_sum\_apodization(xdc,0,ones(1,no\_elements),i);}}\\76{\tt~~~}{\tt ~~focus~=~[sin(theta)*focus\_r,~zeros(length(focus\_r),1),~cos(theta)*focus\_r];}\\77{\tt~~~}{\tt ~~bft\_center\_focus([0~0~0],i);}\\78{\tt~~~}{\tt ~~bft\_focus(xdc,~T,~focus,i);}\\79{\tt~~~}{\tt ~~theta~=~theta~+~d\_theta;}\\80{\tt~~~}{\tt end}\\81{\tt~~~}{\tt }\\82{\tt~~~}{\tt }\\83{\tt~~~}{\tt {\sl \%}}\\84{\tt~~~}{\tt {\sl \%~~Allocate~memory~for~the~image}}\\85{\tt~~~}{\tt {\sl \%}}\\86{\tt~~~}{\tt Rmax~=~max(sqrt(pht\_pos(:,1).\^~2~+~pht\_pos(:,2).\^~2~~+~pht\_pos(:,3).\^~2))~+~10/1000;}\\87{\tt~~~}{\tt Rmin~=~min(sqrt(pht\_pos(:,1).\^~2~+~pht\_pos(:,2).\^~2~~+~pht\_pos(:,3).\^~2))~-~10/1000;}\\88{\tt~~~}{\tt if~(Rmin~<~0)~Rmin~=~0;~end;}\\89{\tt~~~}{\tt Tmin~=~2*Rmin~/~c;~Tmax~=~2*Rmax~/~c;}\\90{\tt~~~}{\tt Smin~=~floor(Tmin~*~fs);~Smax~=~ceil(Tmax~*~fs);}\\91{\tt~~~}{\tt }\\92{\tt~~~}{\tt no\_rf\_samples~=~Smax~-~Smin~+~1;}\\93{\tt~~~}{\tt }\\94{\tt~~~}{\tt bf\_image~=~zeros(no\_rf\_samples,~no\_lines);}\\95{\tt~~~}{\tt }\\96{\tt~~~}{\tt {\sl \%}}\\97{\tt~~~}{\tt {\sl \%~Make~one~low-resolution~image~at~a~time~and~sum~them}}\\98{\tt~~~}{\tt {\sl \%}}\\99{\tt~~~}{\tt }\\100{\tt~~}{\tt xdc\_focus\_times(xmt,0,zeros(1,no\_elements));~}\\101{\tt~~}{\tt xdc\_focus\_times(rcv,0,zeros(1,no\_elements));}\\102{\tt~~}{\tt for~emission\_no~=~1:no\_elements}\\103{\tt~~}{\tt ~~disp(['emission~no:~'~num2str(emission\_no)]);~~}\\104{\tt~~}{\tt ~~xdc\_apodization(xmt,0,[zeros(1,emission\_no-1)~1~zeros(1,~no\_elements~-~emission\_no)]);}\\105{\tt~~}{\tt }\\106{\tt~~}{\tt ~~[scat,~start\_time]~=~calc\_scat\_multi~(xmt,~rcv,~pht\_pos,~pht\_amp);}\\107{\tt~~}{\tt }\\108{\tt~~}{\tt ~~start\_sample~=~floor(start\_time~*~fs~+~0.5);}\\109{\tt~~}{\tt ~~end\_sample~=~start\_sample~+~max(size(scat))-1;}\\110{\tt~~}{\tt ~~}\\111{\tt~~}{\tt ~~scat~=~[zeros(start\_sample~-~Smin,~no\_elements);~scat;~zeros(Smax~-~end\_sample,no\_elements)];}\\112{\tt~~}{\tt ~}\\113{\tt~~}{\tt ~~start\_time~=~Tmin;}\\114{\tt~~}{\tt ~~beamformed~=~bft\_beamform(start\_time,scat);}\\115{\tt~~}{\tt ~~bf\_image~=~bft\_add\_image(bf\_image,~beamformed,~emission\_no,~start\_time);}\\116{\tt~~}{\tt end}\\117{\tt~~}{\tt }\\118{\tt~~}{\tt }\\119{\tt~~}{\tt }\\120{\tt~~}{\tt {\sl \%~~Release~the~allocated~memory}}\\121{\tt~~}{\tt }\\122{\tt~~}{\tt field\_end}\\123{\tt~~}{\tt bft\_end}\\124{\tt~~}{\tt }\\125{\tt~~}{\tt }\\126{\tt~~}{\tt }\\127{\tt~~}{\tt {\sl \%}}\\128{\tt~~}{\tt {\sl \%~~Dispplay~the~image}}\\129{\tt~~}{\tt {\sl \%}}\\130{\tt~~}{\tt }\\131{\tt~~}{\tt bf\_image~=~abs(hilbert(bf\_image));~~~~~~~~~~~~~~~~~~{\sl \%~Envelope~detection}}\\132{\tt~~}{\tt bf\_image~=~bf\_image~/~max(max(bf\_image));}\\133{\tt~~}{\tt }\\134{\tt~~}{\tt figure;}\\135{\tt~~}{\tt imagesc([-sector/2~sector/2]*180/pi,[Rmin~Rmax]*1000,20*log10(bf\_image~+~0.001))}\\136{\tt~~}{\tt axis('image')}\\137{\tt~~}{\tt xlabel('Angle~[deg]');}\\138{\tt~~}{\tt ylabel('Axial~distance~[mm]')}\\139{\tt~~}{\tt title('Beamformed~by~BFT~');}\\140{\tt~~}{\tt clc}\\141{\tt~~}{\tt disp(['~'~10~10~10~10~]);}\\142{\tt~~}{\tt disp([9~'*****************************************************']);}\\143{\tt~~}{\tt disp([9~'*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*']);}\\144{\tt~~}{\tt disp([9~'*~The~image~beamformed~by~BFT~is~in~"bf\_image"~~~~~~*']);}\\145{\tt~~}{\tt disp([9~'*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*'])}\\146{\tt~~}{\tt disp([9~'*****************************************************']);}\\147{\tt~~}{\tt disp(['~'~10~10~]);}\\148{\tt~~}{\tt }\\}\end{document}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -