Field_II test 1

 

 

%===========每當打開matlab運行一下下面代碼,運行一次即可,然後後註釋掉。下次打開matlab再運行
%   path(path,'E:\MATLAB\kkk\Field_II\field_II_combined');    % 加field文件夾入搜索路徑
%   run field_init            % Initialize the Field II program system

clear;pause(0.1);
%------------------------基本參數--------------------
f0=3e6;                     % 中心頻率[Hz]
fs=100e6;                   % 採樣率 [Hz]
c=1540;                     % 聲速 [m/s]
ele_width =c/f0;            % 陣元寬度 x方向 使等於波長 0.51/1000
ele_height=5/1000;          % 陣元高度 y方向
ele_kerf  =ele_width/20;    % 陣元間隙 (當width+kerf大於波長一半時,陣元間的相互作用可忽略不計。萬明習(上)P228)
ele_num=64;                 % 陣元個數
focus=[0 0 50]/1000;        % 焦點 [m]

%------------------------系統配置---------------------
set_sampling(fs);                                                       % 設置採樣率

impulse_response=sin(2*pi*f0*(0:1/fs:2/f0));
impulse_response=impulse_response.*hanning(length(impulse_response))';   % 衝擊響應

excitation=sin(2*pi*f0*(0:1/fs:2/f0));                                  % 激勵,不是單脈衝信號

emit_aperture   = xdc_linear_array (ele_num, ele_width, ele_height, ele_kerf, 1, 5, focus);     % 發射探頭
receive_aperture= xdc_linear_array (ele_num, ele_width, ele_height, ele_kerf, 1, 5, focus);     % 接收探頭

xdc_impulse (emit_aperture,    impulse_response);                       % 設置發射探頭衝擊響應
xdc_excitation (emit_aperture, excitation);                             % 設置發射探頭激勵
xdc_impulse (receive_aperture, impulse_response);                       % 設置接收探頭衝擊響應

%[phantom_positions, phantom_amplitudes] = cyst_phantom(100000);      % 創建人工體膜,查看體膜的擺放的位置及尺寸
phantom_positions=focus;
phantom_amplitudes=1;
[RF_data, start_time]=calc_scat(emit_aperture, receive_aperture, phantom_positions, phantom_amplitudes);
plot((0:length(RF_data)-1)/fs+start_time,RF_data);


 

 

 

 構建人工體膜,將體膜緊貼探頭中心,採集RF信號

function [positions, amp] = cyst_phantom (N)        % N=100000 合適
x_size = 100/1000;       % Width of phantom [m]
y_size = 100/1000;       % Transverse width of phantom [m]
z_size = 100/1000;       % Height of phantom [m]
z_start = 0/1000;      % Start of phantom surface [m];
% Create the general scatterers
x = (rand (N,1)-0.5)*x_size;                    % N個散射點x軸座標均勻分佈在[-25,25]
y = (rand (N,1)-0.5)*y_size;                    % N個散射點y軸座標均勻分佈在[-25,25]
z = rand (N,1)*z_size + z_start;                % N個散射點z軸座標均勻分佈在[-25,25]+z_start

amp=rand(N,1);                                   % N個散射點均勻分佈散射強度[0,1]之間

pht_num=2;                  % 放置2個球
pht_r  =8/1000;             % 半徑
dz=z_size/(pht_num+1);      % 間隔
inside=zeros(N,1);
for i=1:pht_num
    temp=(((x-0).^2+(y-0).^2+(z-z_start-i*dz).^2)<pht_r^2);
    inside=inside|temp;
end
amp(find(inside==1))=10;          % 球內的散射係數設爲2

% Return the variables
positions=[x y z];

% 只繪製球內的散點
figure;
for i=1:N
    if inside(i)
        plot3(x(i),y(i),z(i),'o');hold on;
    end
end
axis([-50/1000 50/1000 -50/1000 50/1000 0 100/1000]);
grid on;xlabel('x');ylabel('y');zlabel('z');

end


體膜中,周圍的組織散射係數服從(0,1)間的均勻分佈。體膜大小100*100*100 mm,緊貼探頭中心(0,0,0),體膜內有兩個球,球內的散射係數爲10,球半徑爲8mm。

探頭焦點爲(0,0,50)mm

 

%=============================獲取組織中的RF信號==========================

[phantom_positions, phantom_amplitudes] = cyst_phantom(100000);      % 創建人工體膜,查看體膜的擺放的位置及尺寸
                                              % calculating the received signal from a collection of scatterers
[RF_data, start_time]=calc_scat(emit_aperture, receive_aperture, phantom_positions, phantom_amplitudes);
plot((0:length(RF_data)-1)/fs+start_time,RF_data);


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章