⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bft_user_guide.tex.bak

📁 超声仿真软件
💻 BAK
📖 第 1 页 / 共 3 页
字号:
subplot(1,2,2)imagesc([-sector/2 sector/2]*180/pi,[0 Rmax]*1000,20*log10(env_bf + 0.001));title('Beamformed by BFT');xlabel('Angle [deg]');ylabel('Axial distance [mm]')axis('image')colorbarcolormap(gray)clcdisp([' ' 10 10 10 10 ]);disp([9 '*****************************************************']);disp([9 '*                                                   *']);disp([9 '* The image beamformed by Field II is in "env_line" *']);disp([9 '* The image beamformed by BFT is in "env_bf"        *']);disp([9 '*                                                   *'])disp([9 '*****************************************************']);disp([' ' 10 10 ]);\end{verbatim}}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\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\begin{verbatim}%PHASED_DYN_IMAGE Create a phased-array B-mode image, using the %    commands for setting a dynamic focusing%VERSION 1.0, 29 Feb 2000, Svetoslav Nikolovf0 = 4e6;              %  Central frequency                        [Hz]fs = 100e6;            %  Sampling frequency                       [Hz]c = 1540;              %  Speed of sound                           [m/s]B = .35;               %  Relative bandwith                        [fraction]no_elements = 64;      %  Number of elements in the transducer     lambda = c / f0;       % Wavelength                                [m]pitch = lambda / 2;    % Pitch - center-to-center                  [m]width = .95*pitch;     % Width of the element                      [m]kerf = pitch - width;  % Inter-element spacing                     [m]height = 10/1000;      % Size in the Y direction                   [m]  %  Define the impulse response of the transducerimpulse_response = sin(2*pi*f0*(0:1/fs:2/f0));impulse_response = impulse_response.*hanning(length(impulse_response))';excitation = impulse_response;%  Define the phantompht_pos = [0 0 20;           0 0 30;           0 0 40;           0 0 50;           0 0 60;           0 0 70;           0 0 80;           0 0 90;           ] / 1000;         %  The position of the phantompht_amp = 20*ones(8,1);      %  The amplitude of the back-scatter%  Define the focus focus_r = [20;30;40;50;60;70;80;90] / 1000;T = (focus_r-5/1000)/c *2;%  Initialize the programfield_init(0);bft_init;%  Set some paramtersset_field('c', c);bft_param('c', c);set_field('fs', fs);bft_param('fs', fs);% Create some apertures.xmt = xdc_linear_array(no_elements,width,height,kerf,1,1,[0 0 0]);rcv = xdc_linear_array(no_elements,width,height,kerf,1,1,[0 0 0]);xdc = bft_linear_array(no_elements, width, kerf);% Set the impulse responsesxdc_impulse(rcv, impulse_response);xdc_impulse(xmt, impulse_response);xdc_excitation(xmt, excitation);% Set the apodizationxdc_apodization(xmt, 0, ones(1,no_elements))xdc_apodization(rcv, 0, ones(1,no_elements))bft_apodization(xdc, 0 , ones(1,no_elements))%  Define and create the imagesector = 30 * pi / 180;no_lines = 32;d_theta = sector / (no_lines-1);theta = -(no_lines-1) / 2 * d_theta;Rmax = max(sqrt(pht_pos(:,1).^2 + pht_pos(:,2).^2  + pht_pos(:,3).^2)) + 15/1000;no_rf_samples = ceil(2*Rmax/c * fs);rf_line = zeros(no_rf_samples, 1);bf_line = zeros(no_rf_samples, 1);env_line = zeros(no_rf_samples, no_lines);env_bf =  zeros(no_rf_samples, no_lines);xmt_r = (max(focus_r) + min(focus_r) )/2;for i = 1 : no_lines  rf_line(:) = 0;    theta    xmt_f = [sin(theta)*xmt_r, zeros(length(xmt_r),1), cos(theta)*xmt_r];  xdc_center_focus(xmt,[0 0 0])  xdc_center_focus(rcv,[0 0 0])  bft_center_focus([0 0 0]);    xdc_focus(xmt, 0, xmt_f);  xdc_dynamic_focus(rcv, 0, theta, 0);    %  Beamform with Field II  [rf_temp, t(i)] = calc_scat(xmt,rcv, pht_pos, pht_amp);    %  Beamform with BFT  bft_dynamic_focus(xdc, theta,0)  xdc_focus_times(rcv, 0, zeros(1,no_elements));  [rf_data, start_t] = calc_scat_multi(xmt,rcv, pht_pos, pht_amp);    rf_data = [zeros(300,no_elements); rf_data; zeros(300,no_elements)];  start_t = start_t - 300  / fs;  bf_temp = bft_beamform(start_t, rf_data);    start_sample = t(i)*fs; no_temp_samples = length(rf_temp);    rf_line(start_sample:start_sample+no_temp_samples-1) = rf_temp(1:no_temp_samples);  env_line(:,i) = abs(hilbert(rf_line(:)));  start_sample = floor(start_t*fs); no_temp_samples = length(bf_temp);  bf_line(start_sample:start_sample+no_temp_samples-1) = bf_temp(1:no_temp_samples);  env_bf(:,i) = abs(hilbert(bf_line(:)));  theta = theta + d_theta;end%  Release the allocated memoryfield_endbft_endenv_line = env_line / max(max(abs(env_line)));env_bf = env_bf / max(max(abs(env_bf)));figure;subplot(1,2,1)imagesc([-sector/2 sector/2]*180/pi,[0 Rmax]*1000,20*log10(env_line + 0.001))axis('image')xlabel('Angle [deg]');ylabel('Axial distance [mm]')title('Beamformed by Field II ');subplot(1,2,2)imagesc([-sector/2 sector/2]*180/pi,[0 Rmax]*1000,20*log10(env_bf + 0.001));title('Beamformed by BFT');xlabel('Angle [deg]');ylabel('Axial distance [mm]')axis('image')colorbarcolormap(gray)clcdisp([' ' 10 10 10 10 ]);disp([9 '*****************************************************']);disp([9 '*                                                   *']);disp([9 '* The image beamformed by Field II is in "env_line" *']);disp([9 '* The image beamformed by BFT is in "env_bf"        *']);disp([9 '*                                                   *'])disp([9 '*****************************************************']);disp([' ' 10 10 ]);\end{verbatim}}\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\begin{verbatim}%SYNTHETIC Synthetic aperture beamforming with BFT% f0 = 4e6;              %  Central frequencyfs = 100e6;            %  Sampling frequencyc = 1540;              %  Speed of soundno_elements = 74;      %  Number of elements in the transducerlambda = c / f0;       % Wavelengthpitch = lambda / 2;    % Pitch - center-to-centerwidth = .95*pitch;     % Width of the elementkerf = pitch - width;  % Inter-element spacingheight = 10/1000;      % Size in the Y direction  %  Define the impulse response of the transducerimpulse_response = sin(3*pi*f0*(0:1/fs:2/f0));impulse_response = impulse_response.*hanning(length(impulse_response))';excitation = sin(2*pi*f0*(0:1/fs:3/f0));%  Define the phantompht_pos = [0 0 40] / 1000;   %  The position of the phantom[m n] = size(pht_pos);pht_amp = 20*ones(m,1);      %  The amplitude of the back-scatter%  Define the focus focus_r = [1:max(sqrt(pht_pos(:,1).^2 + pht_pos(:,2).^2 + pht_pos(:,3).^2))*1000]' / 1000;T = (focus_r-.5/1000)/c *2;%  Initialize the programfield_init(0);bft_init;%  Set some paramtersset_field('c', c);bft_param('c', c);set_field('fs', fs);bft_param('fs', fs);% Create some apertures.xmt = xdc_linear_array(no_elements,width,height,kerf,1,1,[0 0 0]);rcv = xdc_linear_array(no_elements,width,height,kerf,1,1,[0 0 0]);xdc = bft_linear_array(no_elements, width, kerf);% Set the impulse responsesxdc_impulse(rcv, impulse_response);xdc_impulse(xmt, impulse_response);xdc_excitation(xmt, excitation);%  Define and create the imagesector = 60 * pi / 180;no_lines = 64;d_theta = sector / (no_lines-1);theta = -(no_lines-1) / 2 * d_theta;%  Set the delays for one whole image%bft_no_lines(no_lines);for i = 1 : no_lines  bft_apodization(xdc,0,hanning(no_elements)',i);  bft_sum_apodization(xdc,0,ones(1,no_elements),i);  focus = [sin(theta)*focus_r, zeros(length(focus_r),1), cos(theta)*focus_r];  bft_center_focus([0 0 0],i);  bft_focus(xdc, T, focus,i);  theta = theta + d_theta;end%%  Allocate memory for the image%Rmax = max(sqrt(pht_pos(:,1).^2 + pht_pos(:,2).^2  + pht_pos(:,3).^2)) + 10/1000;Rmin = min(sqrt(pht_pos(:,1).^2 + pht_pos(:,2).^2  + pht_pos(:,3).^2)) - 10/1000;if (Rmin < 0) Rmin = 0; end;Tmin = 2*Rmin / c; Tmax = 2*Rmax / c;Smin = floor(Tmin * fs); Smax = ceil(Tmax * fs);no_rf_samples = Smax - Smin + 1;bf_image = zeros(no_rf_samples, no_lines);%% Make one low-resolution image at a time and sum them%xdc_focus_times(xmt,0,zeros(1,no_elements)); xdc_focus_times(rcv,0,zeros(1,no_elements));for emission_no = 1:no_elements  disp(['emission no: ' num2str(emission_no)]);    xdc_apodization(xmt,0,[zeros(1,emission_no-1) 1 zeros(1, no_elements - emission_no)]);  [scat, start_time] = calc_scat_multi (xmt, rcv, pht_pos, pht_amp);  start_sample = floor(start_time * fs + 0.5);  end_sample = start_sample + max(size(scat))-1;    scat = [zeros(start_sample - Smin, no_elements); scat; zeros(Smax - end_sample,no_elements)];   start_time = Tmin;  beamformed = bft_beamform(start_time,scat);  bf_image = bft_add_image(bf_image, beamformed, emission_no, start_time);  end%  Release the allocated memoryfield_endbft_end%%  Dispplay the image%bf_image = abs(hilbert(bf_image));                  % Envelope detectionbf_image = bf_image / max(max(bf_image));figure;imagesc([-sector/2 sector/2]*180/pi,[0 Rmax]*1000,20*log10(bf_image + 0.001))axis('image')xlabel('Angle [deg]');ylabel('Axial distance [mm]')title('Beamformed by Field II ');clcdisp([' ' 10 10 10 10 ]);disp([9 '*****************************************************']);disp([9 '*                                                   *']);disp([9 '* The image beamformed by BFT is in "bf_image"      *']);disp([9 '*                                                   *'])disp([9 '*****************************************************']);disp([' ' 10 10 ]);\end{verbatim}}\end{document}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -