📄 bft_user_guide.tex
字号:
\end{tabular} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\headline{bft\_free\_xdc}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html}%%tth:\subsection*{bft\_free\_xdc}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_free_xdc}Free the memory allocated for a transducer definition\begin{tabular}[t]{lp{14cm}} USAGE:& {\tt bft\_free\_xdc(xdc)}\\ INPUT:& {\sl xdc} Pointer to the memory location returned by the function \hyperlink{bft_transducer}{bft\_transducer}\\ OUTPUT:& Nothing\end{tabular}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5\headline{bft\_init}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html}%%tth:\subsection*{bft\_init}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_init}Initialize the BeamForming Toolbox. This command must be executed first in order to set some parameters and allocate the the necessary memory \begin{tabular}[t]{lp{14cm}} USAGE:& {\tt bft\_init}\\INPUT:& None \\OUTPUT:& None\end{tabular}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5\headline{bft\_linear\_array}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html}%%tth:\subsection*{bft\_linear\_array}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_linear_array} Create a linear array aperture. \begin{tabular}[t]{lp{14cm}} USAGE: & {\tt xdc = bft\_linear\_array(no\_elements, width, kerf)} \\ & {\tt xdc = bft\_linear\_array(no\_elements, pitch)} \\ INPUT:& \begin{tabular}[t]{lp{11cm}} {\sl no\_elements} & Number of elelements in the array \\ {\sl pitch} & Distance between the centers of two elements [m] \\ {\sl width} & Width in x-direction [m]\\ {\sl kerf} & Distance between two elements [m] \end{tabular} \\ & The function assumes that {\sl kerf + width = pitch} \\ OUTPUT:& {\sl xdc} - Pointer to the allocated aperture.\end{tabular}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5\headline{bft\_no\_lines}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html}%%tth:\subsection*{bft\_no\_lines}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_no_lines}Set the number of lines that will be beamformed in parallel. After calling \hyperlink{bft_init}{bft\_init}, the number of lines that are beamformed in parallel is 1. If the user wants to beamforma whole image in one command, he/she must set the number of lines,and then specify the focal zones for each of the lines.\begin{tabular}[t]{lp{14cm}} USAGE: & {\tt bft\_no\_lines(no\_lines)}\\ INPUT:& {\sl no\_lines} ~~Number of lines beamformed in parallel \\ OUTPUT: & None\end{tabular}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5\headline{bft\_param}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html} %%tth:\subsection*{bft\_param}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_param}Set a parameter of the BeamForming Toolbox\begin{tabular}[t]{lp{14cm}} USAGE: & {\tt bft\_param(name, value)}\\ INPUT: & \begin{tabular}[t]{lp{11cm}} {\sl name} & Name of the parameter (string). Currently supported:\\ & \begin{tabular}[t]{c|c|c|c} \hline name & Meaning & Default value & Unit \\ \hline 'c' & Speed of sound. & 1540 & m/s \\ 'fs'& Sampling frequency & 40,000,000 & Hz \\ \hline \end{tabular} \\\\ {\sl value} & New value for the parameter. Must be scalar. \end{tabular} \\ OUTPUT: & None\end{tabular}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5\headline{bft\_sub\_image}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html} %%tth:\subsection*{bft\_sub\_image}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_sub_image}Subtract one low-res image from high-res one.\begin{tabular}[t]{lp{14cm}} USAGE: & {\tt [hi\_res] = bft\_sub\_image(hi\_res, lo\_res, element, start\_time)} \\ INPUT:& \begin{tabular}[t]{lp{11cm}} {\sl hi\_res} & High resolution RF image. One column per scan line.\\ {\sl lo\_res} & Low resolution RF image. One column per scan line.\\ {\sl element} & Number of element, used to acquire the low resolution image. \\ {\sl start\_time} & Arrival time of the first sample of the RF lines. \end{tabular} \\ OUTPUT:& hi\_res - The high resolution image.\end{tabular}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5\headline{bft\_sum\_apodization}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html} %%tth:\subsection*{bft\_sum\_apodization}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_sum_apodization}Create a summation apodization time line. This function is used in the case that the individual low resolution images must be weighted during the summation\begin{tabular}[t]{lp{14cm}} USAGE: & {\tt bft\_sum\_apodization(xdc, times, values, line\_no)} \\ INPUT: & \begin{tabular}[t]{lp{14cm}} {\sl xdc} & Pointer to a transducer aperture.\\ {\sl times} & Time after which the associated apodization is valid.\\ {\sl values} & Apodization values. Matrix with one row for each time value and a number of columns equal to the number of physical elements in the aperture. \\ {\sl line\_no} & Number of line. If skipped, {\sl line\_no} is assumed to be equal to '1'. \end{tabular}\\ OUTPUT: & None \end{tabular}\headline{bft\_sum\_images}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html} %%tth:\subsection*{bft\_sum\_images}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_sum_images} Sum 2 low resolution images in 1 high resolution.\begin{tabular}[t]{lp{14cm}} USAGE : {\tt [hi\_res] = bft\_sum\_images(image1, ele1, image2, ele2, time) }\\ INPUT : \begin{tabular}[t]{lp{141cm}} {\sl image1} & Matrix with the RF data for the image. The number of columns corresponds to the number of lines \\ {\sl ele1} & Number of emitting element used to obtain the image.\\ {\sl image2} & Matrix with the RF data for the image. The number of columns corresponding to the number of lines \\ {\sl ele2} & Number of emitting element used to obtain the image.\\ {\sl time} & The arrival time of the first samples. The two images must be aligned in time \end{tabular} OUTPUT : hi\_res - Higher resolution image\end{tabular}\headline{bft\_transducer}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html} %%tth:\subsection*{bft\_transducer}%%tth:\begin{html}<hr>\end{html}\funlnk{bft_transducer} Create a new transducer definition. The transducer definition is necessary for the calculation of the delays.\begin{tabular}[t]{lp{14cm}} USAGE: & {\tt xdc = bft\_transducer(centers)}\\ INPUT: & \begin{tabular}[t]{lp{11cm}} {\sl centers} & Matrix with the coordinates of the centers of the elements. It has 3 columns (x,y,z) and a number of rows equal to the number of elements. The coordinates are specified in [m] \end{tabular}\\ OUTPUT: & \begin{tabular}[t]{lp{11cm}} xdc & Pointer to the memory location with the transducer definition. Do not alter this value !!! \end{tabular}\end{tabular}%%tth:\begin{html}<hr>\end{html}\chapter{Examples}\label{chap_examples}%%tth:\begin{html}<hr>\end{html}\section{Using Field II simulations}\headline{Phased array B-mode image}%%tth:\vspace{2cm}%%tth:\begin{html}<hr>\end{html} %%tth:\subsection*{phased array B-mode image}%%tth:\begin{html}<hr>\end{html}\funlnk{phased_bmode}{\footnotesize\noindent1{\tt~~~~}{\tt {\sl \%PHASED\_IMAGE~Create~phased~array~B-mode~image~with~BFT.}}\\2{\tt~~~~}{\tt {\sl \%~~~~This~script~creates~a~B-mode~PSF~line~by~line.~Each~line~is~}}\\3{\tt~~~~}{\tt {\sl \%~~~~calculated~using~CALC\_SCAT~and~CALC\_SCAT\_MULTY.~The~rf\_data}}\\4{\tt~~~~}{\tt {\sl \%~~~~from~CALC\_SCAT\_MULTI~is~passed~to~~the~beamforming~toolbox,}}\\5{\tt~~~~}{\tt {\sl \%~~~~and~in~the~end~the~results~are~compared.}}\\6{\tt~~~~}{\tt {\sl \%}}\\7{\tt~~~~}{\tt {\sl \%~~~~The~function~calls~XDC\_FOCUS,~and~BFT\_FOCUS~in~order~to~set~the}}\\8{\tt~~~~}{\tt {\sl \%~~~~the~delays.~}}\\9{\tt~~~~}{\tt }\\10{\tt~~~}{\tt {\sl \%~VERSION~1.0,~29~Feb.~2000,~Svetoslav~Nikolov}}\\11{\tt~~~}{\tt }\\12{\tt~~~}{\tt f0~=~4e6;~~~~~~~~~~~~~~{\sl \%~~Central~frequency~~~~~~~~~~~~~~~~~~~~~~~[Hz]}}\\13{\tt~~~}{\tt fs~=~100e6;~~~~~~~~~~~~{\sl \%~~Sampling~frequency~~~~~~~~~~~~~~~~~~~~~~[Hz]}}\\14{\tt~~~}{\tt c~=~1540;~~~~~~~~~~~~~~{\sl \%~~Speed~of~sound~~~~~~~~~~~~~~~~~~~~~~~~~~[m/s]}}\\15{\tt~~~}{\tt no\_elements~=~64;~~~~~~{\sl \%~~Number~of~elements~in~the~transducer}}\\16{\tt~~~}{\tt }\\17{\tt~~~}{\tt lambda~=~c~/~f0;~~~~~~~{\sl \%~Wavelength~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m]}}\\18{\tt~~~}{\tt pitch~=~lambda~/~2;~~~~{\sl \%~Pitch~-~center-to-center~~~~~~~~~~~~~~~~~[m]}}\\19{\tt~~~}{\tt width~=~.95*pitch;~~~~~{\sl \%~Width~of~the~element~~~~~~~~~~~~~~~~~~~~~[m]}}\\20{\tt~~~}{\tt kerf~=~pitch~-~width;~~{\sl \%~Inter-element~spacing~~~~~~~~~~~~~~~~~~~~[m]}}\\21{\tt~~~}{\tt height~=~10/1000;~~~~~~{\sl \%~Size~in~the~Y~direction~~~~~~~~~~~~~~~~~~[m]}}\\22{\tt~~~}{\tt ~}\\23{\tt~~~}{\tt ~}\\24{\tt~~~}{\tt {\sl \%~~Define~the~impulse~response~of~the~transducer}}\\25{\tt~~~}{\tt impulse\_response~=~sin(2*pi*f0*(0:1/fs:2/f0));}\\26{\tt~~~}{\tt impulse\_response~=~impulse\_response.*hanning(length(impulse\_response))';}\\27{\tt~~~}{\tt excitation~=~impulse\_response;}\\28{\tt~~~}{\tt }\\29{\tt~~~}{\tt {\sl \%~~Define~the~phantom}}\\30{\tt~~~}{\tt }\\31{\tt~~~}{\tt pht\_pos~=~[0~0~20;}\\32{\tt~~~}{\tt ~~~~~~~~~~~0~0~30;}\\33{\tt~~~}{\tt ~~~~~~~~~~~0~0~40;}\\34{\tt~~~}{\tt ~~~~~~~~~~~0~0~50;}\\35{\tt~~~}{\tt ~~~~~~~~~~~0~0~60;}\\36{\tt~~~}{\tt ~~~~~~~~~~~0~0~70;}\\37{\tt~~~}{\tt ~~~~~~~~~~~0~0~80;}\\38{\tt~~~}{\tt ~~~~~~~~~~~0~0~90;}\\39{\tt~~~}{\tt ~~~~~~~~~~~]~/~1000;~~~~~~~~~{\sl \%~~The~position~of~the~phantom}}\\40{\tt~~~}{\tt pht\_amp~=~20*ones(8,1);~~~~~~{\sl \%~~The~amplitude~of~the~back-scatter}}\\41{\tt~~~}{\tt }\\42{\tt~~~}{\tt }\\43{\tt~~~}{\tt }\\44{\tt~~~}{\tt {\sl \%~~Define~the~focus~}}\\45{\tt~~~}{\tt focus\_r~=~[20;30;40;50;60;70;80;90]~/~1000;}\\46{\tt~~~}{\tt T~=~(focus\_r-5/1000)/c~*2;}\\47{\tt~~~}{\tt }\\48{\tt~~~}{\tt }\\49{\tt~~~}{\tt {\sl \%~~Initialize~the~program}}\\50{\tt~~~}{\tt field\_init(0);}\\51{\tt~~~}{\tt bft\_init;}\\52{\tt~~~}{\tt }\\53{\tt~~~}{\tt }\\54{\tt~~~}{\tt {\sl \%~~Set~some~paramters}}\\55{\tt~~~}{\tt set\_field('c',~c);}\\56{\tt~~~}{\tt bft\_param('c',~c);}\\57{\tt~~~}{\tt }\\58{\tt~~~}{\tt set\_field('fs',~fs);}\\59{\tt~~~}{\tt bft\_param('fs',~fs);}\\60{\tt~~~}{\tt }\\61{\tt~~~}{\tt }\\62{\tt~~~}{\tt }\\63{\tt~~~}{\tt {\sl \%~Create~some~apertures.}}\\64{\tt~~~}{\tt }\\65{\tt~~~}{\tt xmt~=~xdc\_linear\_array(no\_elements,width,height,kerf,1,1,[0~0~0]);}\\66{\tt~~~}{\tt rcv~=~xdc\_linear\_array(no\_elements,width,height,kerf,1,1,[0~0~0]);}\\67{\tt~~~}{\tt }\\68{\tt~~~}{\tt xdc~=~bft\_linear\_array(no\_elements,~width,~kerf);}\\69{\tt~~~}{\tt }\\70{\tt~~~}{\tt }\\71{\tt~~~}{\tt {\sl \%~Set~the~impulse~responses}}\\72{\tt~~~}{\tt xdc\_impulse(rcv,~impulse\_response);}\\73{\tt~~~}{\tt xdc\_impulse(xmt,~impulse\_response);}\\74{\tt~~~}{\tt }\\75{\tt~~~}{\tt xdc\_excitation(xmt,~excitation);}\\76{\tt~~~}{\tt }\\77{\tt~~~}{\tt }\\78{\tt~~~}{\tt }\\79{\tt~~~}{\tt {\sl \%~~Define~and~create~the~image}}\\80{\tt~~~}{\tt sector~=~30~*~pi~/~180;}\\81{\tt~~~}{\tt no\_lines~=~32;}\\82{\tt~~~}{\tt d\_theta~=~sector~/~(no\_lines-1);}\\83{\tt~~~}{\tt theta~=~-(no\_lines-1)~/~2~*~d\_theta;}\\84{\tt~~~}{\tt }\\85{\tt~~~}{\tt Rmax~=~max(sqrt(pht\_pos(:,1).\^~2~+~pht\_pos(:,2).\^~2~~+~pht\_pos(:,3).\^~2))~+~15/1000;}\\86{\tt~~~}{\tt }\\87{\tt~~~}{\tt no\_rf\_samples~=~ceil(2*Rmax/c~*~fs);}\\88{\tt~~~}{\tt rf\_line~=~zeros(no\_rf\_samples,~1);}\\89{\tt~~~}{\tt bf\_line~=~zeros(no\_rf\_samples,~1);}\\90{\tt~~~}{\tt }\\91{\tt~~~}{\tt env\_line~=~zeros(no\_rf\_samples,~no\_lines);}\\92{\tt~~~}{\tt env\_bf~=~~zeros(no\_rf\_samples,~no\_lines);}\\93{\tt~~~}{\tt }\\94{\tt~~~}{\tt }\\95{\tt~~~}{\tt xmt\_r~=~(max(focus\_r)~+~min(focus\_r)~)/2;}\\96{\tt~~~}{\tt }\\97{\tt~~~}{\tt for~i~=~1~:~no\_lines}\\98{\tt~~~}{\tt ~~rf\_line(:)~=~0;~~}\\99{\tt~~~}{\tt ~~disp(['Line~no~'~num2str(i)])}\\100{\tt~~}{\tt ~~}\\101{\tt~~}{\tt ~~focus~=~[sin(theta)*focus\_r,~zeros(length(focus\_r),1),~cos(theta)*focus\_r];}\\102{\tt~~}{\tt ~~xmt\_f~=~[sin(theta)*xmt\_r,~zeros(length(xmt\_r),1),~cos(theta)*xmt\_r];}\\103{\tt~~}{\tt ~~xdc\_center\_focus(xmt,[0~0~0])}\\104{\tt~~}{\tt ~~xdc\_center\_focus(rcv,[0~0~0])}\\105{\tt~~}{\tt ~~bft\_center\_focus([0~0~0]);}\\106{\tt~~}{\tt ~~}\\107{\tt~~}{\tt ~~xdc\_focus(xmt,~0,~xmt\_f);}\\108{\tt~~}{\tt ~~xdc\_focus(rcv,~T,~focus);}\\109{\tt~~}{\tt ~~bft\_focus(xdc,~T,~focus);}\\110{\tt~~}{\tt ~~}\\111{\tt~~}{\tt ~~{\sl \%~~Beamform~with~Field~II}}\\112{\tt~~}{\tt ~~[rf\_temp,~t(i)]~=~calc\_scat(xmt,rcv,~pht\_pos,~pht\_amp);}\\113{\tt~~}{\tt ~~}\\114{\tt~~}{\tt ~~{\sl \%~~Beamform~with~BFT}}\\115{\tt~~}{\tt ~~xdc\_focus\_times(rcv,~0,~zeros(1,no\_elements));}\\116{\tt~~}{\tt ~~[rf\_data,~start\_t]~=~calc\_scat\_multi(xmt,rcv,~pht\_pos,~pht\_amp);}\\117{\tt~~}{\tt ~~rf\_data~=~[zeros(300,no\_elements);~rf\_data;~zeros(300,no\_elements)];}\\118{\tt~~}{\tt }\\119{\tt~~}{\tt ~~start\_t~=~start\_t~-~300~~/~fs;}\\120{\tt~~}{\tt ~~bf\_temp~=~bft\_beamform(start\_t,~rf\_data);}\\121{\tt~~}{\tt ~~}\\122{\tt~~}{\tt ~~start\_sample~=~t(i)*fs;~no\_temp\_samples~=~length(rf\_temp);}\\123{\tt~~}{\tt ~~}\\124{\tt~~}{\tt ~~rf\_line(start\_sample:start\_sample+no\_temp\_samples-1)~=~rf\_temp(1:no\_temp\_samples);}\\125{\tt~~}{\tt ~~env\_line(:,i)~=~abs(hilbert(rf\_line(:)));}\\126{\tt~~}{\tt }\\127{\tt~~}{\tt ~~start\_sample~=~floor(start\_t*fs);~no\_temp\_samples~=~length(bf\_temp);}\\128{\tt~~}{\tt ~~bf\_line(start\_sample:start\_sample+no\_temp\_samples-1)~=~bf\_temp(1:no\_temp\_samples);}\\129{\tt~~}{\tt ~~env\_bf(:,i)~=~abs(hilbert(bf\_line(:)));}\\130{\tt~~}{\tt ~~theta~=~theta~+~d\_theta;}\\131{\tt~~}{\tt }\\132{\tt~~}{\tt end}\\133{\tt~~}{\tt }\\134{\tt~~}{\tt {\sl \%~~Release~the~allocated~memory}}\\135{\tt~~}{\tt }\\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -