首页->【超声成像实验室】

6 1

%clear;
close all;
%cd('C:/Users/pc/Desktop/Busound/Usound/Field_II_example'),field_init(0)
%  The platform for Ultrasound Imaging of hand-held instruction  
%  Example of use of the new Field II program running under
%  Matlab.
%  This example shows how a linear array B-mode system scans an ima
%  pobe is produced by SZ transducer Inc
%  This script assumes that the field_init procedure has been called
%  Here the field simulation is performed and the data is stored
%  in rf-files; one for each rf-line done. The data must then
%  subsequently be processed to yield the image. The data for the
%  scatteres are read from the file pht_data.mat, so that the procedure
%  can be started again or run for a number of workstations.
%
%  Example by Joergen Arendt Jensen and Peter Munk,
%  Version 1.2, August 14, 1998, JAJ.

%  Ver. 1.1: 1/4-98: Procedure xdc_focus_center inserted to use the new
%                    focusing scheme for the Field II program
%  Ver. 2.0: 13/8 2007: Parallel version that checks whether the simulation
%                       of a line has been made before, which makes it possible
%                       to run the code in parallel on multiple workstations.
%  Second_Designer,Ver.2.1:     :Winyoo Shiy
%  At                  : Soochow University,Suzhou,China
%  release             : 17/08/15
%  Generate the transducer apertures for send and receive
%  About before the using you should initial the platform with the code
%  "field_init(0)"

% probe 基本参数设置
f0=6.6e6;                    % 换能器中心频率 [Hz]
fs=120e6;                    % 仿真使用的采样频率
c=1540;                      % 声速 [m/s]
lambda=c/f0;                 % 波长 [m] 0.644
width=0.46/1000;             % 阵元宽度[m]
element_height=5/1000;       % 阵元高度 [m]
d=0.04;                      % 阵元间距[mm]
kerf=0.04/1000;              % 阵元间隙宽度 [m]
Ne=80;                       % 探头阵元数量
N_element=Ne;
N_a=16;                      % 孔径大小

focus=[0 0 30]/1000;         % 固定焦点位置 [m]
focal_depth=focus(3);        % 焦点深度
array_size=(kerf+width)*Ne;  % 阵元总宽度
dz=1/(2*f0)*c/2;
ISTEP=(c*1e3)/(2*fs);        % the gap of every sample [mm]

set_field('c',c);            % set the Ultrasound Speed
set_field('fs',fs);          % the sample rate   
set_field('att_f0',f0);      % center frequency of attenuation
set_field('use_att',0);      % attenuation is disabled.
set_sampling(fs);            % set the sample rate.
% Generate aperture for emission and recieve
xmit_aperture=xdc_linear_array(Ne,width,element_height,kerf,1,1,focus);
%Set the impulse response and excitation of the emit aperture
impulse_response=cos(2*pi*f0*(0:1/fs:2/f0));
impulse_response=impulse_response.*hanning(max(size(impulse_response)))';
xdc_impulse(xmit_aperture, impulse_response);
excitation=cos(2*pi*f0*(0:1/fs:2/f0));

% Generate aperture for reception
receive_aperture=xdc_linear_array(Ne,width,element_height,kerf,1,1,focus);
xdc_impulse(receive_aperture,impulse_response);

dx=(width+kerf)*0.5;
imgWidth=array_size*1000;

%focus_times = zeros(1,Nf)';
channel_pos_tmp=xdc_get(xmit_aperture,'rect');% rect noly
channel_pos=channel_pos_tmp(8,:);
dx0=channel_pos(N_a/2);
t=1;
% xmit and receive

if img ==1   % phantom simulation
    focal_zones=(2:0.1:50)'/1000;
else
    focal_zones=(2:0.1:65)'/1000;  
end

focust=focal_zones/c;
Nf=max(size(focal_zones));
NOR=0;

for i=1:noline
    
    x=(i-1)*dx+dx0;   
    xdc_center_focus(receive_aperture,[x 0 0]);
    xdc_center_focus(xmit_aperture,[x 0 0]);
    
    delay_tx3=-1*(sqrt((channel_pos(1,t:N_a/2-1+t)-x).^2+focal_depth^2)-focal_depth)/c;
    [~,a]=size(delay_tx3);
    if mod(i,2)==1
       N_active=N_a-1;
       a=a-1;
       delay_t=zeros(1,N_a/2-1);    
    else
       N_active=N_a;delay_t=zeros(1,N_a/2);
    end
    %xdc_transmit  focus
    apo=[zeros(1, t-1) ones(1,N_active) zeros(1,N_element-N_active-t+1)];
    xdc_apodization(xmit_aperture,0,apo);
    xdc_excitation(xmit_aperture,excitation);    
    for cnt=0:a-1
        delay_t(cnt+1)=delay_tx3(a-cnt);
    end
    delay_tx=[delay_tx3,delay_t];
    
    toff_c=[zeros(1,t-1) delay_tx zeros(1,N_element-N_active-t+1)];
    xdc_focus(xmit_aperture,0,[x 0 focal_depth]);
    xdc_times_focus(xmit_aperture,0,(toff_c));  
   ui_field_measure(xmit_aperture);
end
xdc_free (xmit_aperture);
xdc_free (receive_aperture);

ui_field_measure(xmit_aperture);函数计算内容如下

function ui_field_measure( th )
%UI_FIELD_MEASURE 此处显示有关此函数的摘要
%   此处显示详细说明
r=1;
for x=-20:0.1:20
    c=1;
    for z=1:0.1:71
    [hp,~] = calc_hp(th,[x/1000, 0,(z+1)*1/1000]);
    fp(r,c)=max(hp(:,1));
    c=c+1;
    end
   r=r+1;
end
env=fp/max(max(fp));
env=log10(env+0.1);
env=env-min(min(env));
env=64*env/max(max(env));
axis('image')
x=-20:20;
z=1:71;
image(z,x,env);
colorbar;
title('N=16');
xlabel('Axial Depth [mm]');
ylabel('Lateral distance  [mm]');

end

发射第一条线发射声场如图所示

TIM截图20180509161619.png

楼主可见

  1. shwnyoo 1#

    欢迎做超声成像的算法同学们一起讨论