Field_II仿真学习笔记2

一:以下是三个简单的小例子。

example1:

点散射函数的计算是通过在换能器前面放置一个点,然后光束扫描过点。下面给出了成像系统的点扩展函数。这个例子计算的是一个半径为8mm几何中心为80mm的圆形凹面的换能器在中心频率为3MHz处的点散射函数。这样的换能器的扫描是通过相对于组织,移动换能器来完成的。FieldII没有移动光圈的能力,所以移动点。这个点在离孔径30mm深处,以0.2mm为单位从-10mm处横向移动到+10mm处。然后找到响应的包络线。它被压缩到60分贝的动态范围。

程序:

>> path(path,'D:\MATLAB\R2016a\Field_II_PC7');field_init 

%  Define a concave piston transducer,
%  set its impulse response and excitation
%  and calculate its point spread function
%
%  Note that the field_init routine must be
%  calculated before the routine is called
%
%  Version 1.0, June 29, 2001 by JAJ


%  Set initial parameters


R=8/1000;             %  Radius of transducer [m]
Rfocus=80/1000;       %  Geometric focus point [m]
ele_size=1/1000;      %  Size of mathematical elements [m]
f0=3e6;               %  Transducer center frequency [Hz]
fs=100e6;             %  Sampling frequency [Hz]


%  Define the transducer


Th = xdc_concave (R, Rfocus, ele_size);


%  Set the impulse response and excitation of the emit aperture


impulse_response=sin(2*pi*f0*(0:1/fs:2/f0));
impulse_response=impulse_response.*hanning(max(size(impulse_response)))';
xdc_impulse (Th, impulse_response);


excitation=sin(2*pi*f0*(0:1/fs:2/f0));
xdc_excitation (Th, excitation);


%  Calculate the pulse echo field and display it


xpoints=(-10:0.2:10);
[RF_data, start_time] = calc_hhp (Th, Th, [xpoints; zeros(1,101); 30*ones(1,101)]'/1000);


%  Make a display of the envelope


figure(1)
env=abs(hilbert(RF_data(1:5:600,:)));
env=20*log10(env/max(max(env)));
[N,M]=size(env);
env=(env+60).*(env>-60) - 60;
mesh(xpoints, ((0:N-1)/fs + start_time)*1e6, env)
ylabel('Time [\mus]')
xlabel('Lateral distance [mm]')
title('Pulse-echo field from 8 mm concave transducer at 30 mm')
axis([-10 10 38.41 39.6 -60 0])
view([-14 80])


%  Create a smaller image for the thumbnail


figure(2)
imagesc(env)
colormap(hot)
axis off


%  Free the aperture after use


xdc_free (Th)

figure1:


EXAMPLE2:

点散射函数的计算是通过在换能器前面放置一个点,然后光束扫描过点。下面给出了成像系统的点扩展函数。这个例子计算的是一个半径为8mm几何中心为80mm的圆形凹面的换能器在中心频率为3MHz处的点散射函数。Field II可以同时对多个点进行计算,从而揭示成像系统的动态聚焦特性。 出于此目的定义了一个幻象的点。它包含了大量的点目标, It consists of a number of point targets placed with a distance of 5 mm starting at 15 mm from the transducer surface。

的线性扫描图像,然后由点和所得的图像被压缩,以显示一个60 dB的动态范围。这个模型是适合用于显示一个特定的传感器,点扩散函数的空间变化,聚焦,和切趾方案

一个线性扫描图像便由这些点组成的。形成的图像之后被压缩以只显示60dB的动态范围。这个模型是为特定的换能器,聚焦和切趾方案显示其点散射函数相应的空间变化。

128个换能器元件,额定频率nominal frequency为3Mhz。元件高度为5mm、宽度为一个波宽。kerf为0.1mm.换能器的激励包含一个周期为2的3Mhz的正弦的汉宁加权。发射和接收孔径的脉冲响应也为2周期的汉宁加权脉冲。

Graph A uses only a single focal point at 60 mm for both emission and reception. B also uses reception focusing at every 20 mm starting from 30 mm. Graph C further adds emission focusing at 10, 20, 40, and 80 mm. D applies the same focal zones as C, but uses 128 elements in the active aperture.

图A仅在60mm处,为发送和接受孔径使用了一个单一的焦点。图B从30mm处开始每20m采用  接收聚焦。图C进一步在10mm,20mm,40mm和80mm处增加了发射聚焦。D使用了和C相同的聚焦区,不同的是在活动孔径处采用了128个元件。用于E和F的聚焦方案适用于每2毫米的一个新的接收配置文件。对于模拟波束形成器来说,这是一个小的区域大小。对于数字波束形成器来说这是一个大的区域大小。数字波束形成器可以为每一个样例编程。由此得到一个连续的追踪器( and thus a "continuous" beam tracking can be obtained),在成像系统中,聚焦被用来获取所有深度上的高细节分辨率和更好的高对比率。这是不可能的,所以必须作出妥协。例如,图F显示了多个传输区域和接收区域的结果,但现在,如图E,一个限制出现在活动孔径上。光圈的大小是控制有一个恒定的光圈(孔径宽度除以组织的焦点深度),通过动态变迹,实现4发送2接收,这在整个深度上给出了一个更均匀的点扩散函数。 Especially for the apodized version,混合发射可以为了避免增加比如在40mm和60mm处的点散射函数的宽度。

 %  Make differene images for showing the effect of
%  focusing and apodization
%
%  This script assumes that the field_init procedure has been called
%
%  Example by Joergen Arendt Jensen, March 25, 1997.
%  constant F# added by Peter Munk, April 8, 1997
%  Version 1.2, August 13, 2007, JAJ: Printout changed
%
%  Generate the transducer apertures for send and receive


f0=3e6;                  %  Transducer center frequency [Hz]
fs=100e6;                %  Sampling frequency [Hz]
c=1540;                  %  Speed of sound [m/s]
lambda=c/f0;             %  Wavelength [m]
width=lambda;            %  Width of element
element_height=5/1000;   %  Height of element [m]
kerf=0.1/1000;           %  Kerf [m]
focus=[0 0 70]/1000;     %  Fixed focal point [m]
N_elements=128;          %  Number of physical elements
N_active=64;             %  Number of active elements
xmit_N_active=128;       %  Number of active transmit elements for constant F#
rec_N_active=128; %  Number of active receive elements for constant F#


%  Set the sampling frequency 


set_sampling(fs);


%  Generate aperture for emission


emit_aperture = xdc_linear_array (N_elements, width, element_height, kerf, 1, 1,focus);


%  Set the impulse response and excitation of the emit aperture


impulse_response=sin(2*pi*f0*(0:1/fs:2/f0));
impulse_response=impulse_response.*hanning(max(size(impulse_response)))';
xdc_impulse (emit_aperture, impulse_response);


excitation=sin(2*pi*f0*(0:1/fs:2/f0));
xdc_excitation (emit_aperture, excitation);


%  Generate aperture for reception


receive_aperture = xdc_linear_array (N_elements, width, element_height, kerf, 1, 1,focus);


%  Set the impulse response for the receive aperture


xdc_impulse (receive_aperture, impulse_response);


%   Load the computer phantom


[phantom_positions, phantom_amplitudes] = pts_pha;


%   Do linear array imaging


no_lines=20;                         %  Number of lines in image
image_width=20/1000;                 %  Size of image sector
d_x=image_width/no_lines;            %  Increment for image


%  Make the different simulations


%  Single focus for emission and reception, no apodization


figure(1)
disp('Making images without apodization (figure 1)')
subplot(161)
disp('Single transmit and receive focus')
sesr
mk_img
title('A')
axis on
ylabel('Axial distance [mm]')
text(40,135,'Lateral distance [mm]')


%  Introduce a number of receive focus zones


subplot(162)
disp('Single transmit and multiple receive foci')
semr
mk_img
title('B')


%  Multiple focusing in both transmit and receive


subplot(163)
disp('Multiple transmit and multiple receive foci')
memr
mk_img
title('C')
xlabel('Lateral distance [mm]')


%  Use 128 elements instead


subplot(164)
disp('Multiple transmit and multiple receive foci (128 elements)')
memr128
mk_img
title('D')


%  Use 128 elements with continous receive focus


subplot(165)
disp('Multiple transmit and continuous receive foci (128 elements)')
mecr128
mk_img
title('E')


%  Use 128 elements instead with no apodization
%  constant F# rec=2 and xmit=4


subplot(166)
disp('Constant F# number focusing')
fnumna
mk_img
title('F')




%  Perform the simulations again using apodization


%  Single focus for emission and reception with apodization


figure(2)
disp('Making images with apodization (figure 2)')
subplot(161)
disp('Single transmit and receive focus')
sesra
mk_img
axis on
title('A')
ylabel('Axial distance [mm]')
text(40,135,'Lateral distance [mm]')


%  Introduce a number of receive focus zones with apodization


subplot(162)
disp('Single transmit and multiple receive foci')
semra
mk_img
title('B')


%  Multiple focusing in both transmit and receive with apodization


subplot(163)
disp('Multiple transmit and multiple receive foci')
memra
mk_img
title('C')
xlabel('Lateral distance [mm]')


%  Use 128 elements instead with apodization


subplot(164)
disp('Multiple transmit and multiple receive foci (128 elements)')
memr128a
mk_img
title('D')


%  Use 128 elements with 2 mm between receive focuses


subplot(165)
disp('Multiple transmit and continuous receive foci (128 elements)')
mecr128a
mk_img
title('E')


%  Use 128 elements instead with apodization
%  constant F# rec=2 and xmit=4


subplot(166)
disp('Constant F# number focusing')
fnumwa
mk_img
title('F')
Warning:  Remember to set all pulses in apertures for the new sampling frequency
Making images without apodization (figure 1)
Single transmit and receive focus
Making display of image
Single transmit and multiple receive foci
Making display of image
Multiple transmit and multiple receive foci
Making display of image
Multiple transmit and multiple receive foci (128 elements)
Making display of image
Multiple transmit and continuous receive foci (128 elements)
Making display of image
Constant F# number focusing
Making display of image
Making images with apodization (figure 2)
Single transmit and receive focus
Making display of image
Single transmit and multiple receive foci
Making display of image
Multiple transmit and multiple receive foci
Making display of image
Multiple transmit and multiple receive foci (128 elements)
Making display of image
Multiple transmit and continuous receive foci (128 elements)
Making display of image
Constant F# number focusing
Making display of image



Examples:      Calculation of intensities and peak pressure

空间峰值时间平均强度用于缩放换能器的脉冲响应,从而获得正确的强度和压力.

 A 65 elements elevation focused linear array with a width of lambda/2 and a height of 5 mm is used in the simulation。中心频率和强度取决于扫描的情况下,它可以是胎儿或心脏成像。强度分布的一个例子如下所示:

%  Simulate an array using Field II 
%  Calculate the intensity profile along the acoustical axis for
%  the transducer 
% 
%  Version 1.0, 27/6-1997, JAJ 
%  Version 1.1, 27/3-2000, JAJ: Transducer impulse response added
%  Version 1.1, 13/8-2007, JAJ: Change of display during calculation
 
% 
%  Array: 65 elements, width: lambda/2, Height: 5 mm, 
%  Type:  Elevation focused, linear array 

fetal=1;                 %  Whether to use cardiac or fetal intensities

%  Set values for the intensity 

if (fetal==1)

  %  For fetal 
  
  f0=5e6;                  %  Transducer center frequency [Hz] 
  M=2;                     %  Number of cycles in pulse 
  Ispta=0.170*100^2;       %  Fetal intensity: Ispta [w/m^2] 
  %Ispta=0.046*100^2;      %  Fetal intensity In Situ: Ispta [w/m^2] 
  Itype='Fetal';           %  Intensity type used 
else
 
 %  For cardiac 
 
  f0=3e6;                  %  Transducer center frequency [Hz] 
  M=8;                     %  Number of cycles in pulse 
  Ispta=0.730*100^2;       %  Cardiac intensity: Ispta [w/m^2] 
  Itype='Cardiac';         %  Intensity type used 
  end

%  Generate the transducer apertures for send and receive 
 
fs=250e6;                %  Sampling frequency [Hz] 
c=1540;                  %  Speed of sound [m/s] 
lambda=c/f0;             %  Wavelength 
width=lambda/2;          %  Width of element 
element_height=5/1000;   %  Height of element [m] 
kerf=lambda/10;          %  Kerf [m] 
focus=[0 0 60]/1000;     %  Fixed focal point [m] 
elefocus=1;              %  Whether to use elevation focus 
Rfocus=40/1000;          %  Elevation focus [m] 
N_elements=65;           %  Number of physical elements 

  
Z=1.480e6;          %  Characteristic acoustic impedance [kg/(m^2 s)] 
Tprf=1/5e3;         %  Pulse repetition frequency [s] 
Tp=M/f0;            %  Pulse duration [s] 
 
P0=sqrt(Ispta*2*Z*Tprf/Tp);   %  Calculate the peak pressure 
 
%  Set the attenuation to 5*0.5 dB/cm, 0.5 dB/[MHz cm] around 
%  f0 and use this: 
 
set_field ('att',2.5*100); 
set_field ('Freq_att',0.5*100/1e6); 
set_field ('att_f0',f0); 
set_field ('use_att',0);          %  Set this flag to one when including attenuation
 
%  Set the sampling frequency 
 
set_sampling(fs); 
 
%  Make the aperture for the rectangles 
 
if (elefocus == 0) 
  ape = xdc_linear_array (N_elements, width, element_height, kerf, 10, 10, focus); 
else 
  ape = xdc_focused_array (N_elements, width, element_height, kerf, Rfocus, 10, 10, focus); 
  end 
 
%  Set the excitation of the aperture 
 
excitation=sin(2*pi*f0*(0:1/fs:M/f0)); 
excitation=excitation.*hanning(length(excitation))'; 
xdc_excitation (ape, excitation); 
 
%  Set the impulse response of the aperture 
 
impulse=sin(2*pi*f0*(0:1/fs:1/f0)); 
impulse=impulse.*hanning(length(impulse))'; 
xdc_impulse (ape, excitation); 
 
%  Find the scaling factor from the peak value 
 
point=[0 0 0]/1000; 
zvalues=(2:2:100)/1000; 
index=1; 
I=0; 
disp('Finding calibration...') 
for z=zvalues 
  point(3)=z; 
  [y,t] = calc_hp(ape,point); 
  I(index)=sum(y.*y)/(2*Z)/fs/Tprf; 
  index=index+1; 
  end 
I_factor=Ispta/max(I); 
 
%  Set the correct scale factor 
 
scale_factor=sqrt(I_factor); 
excitation=scale_factor*excitation; 
xdc_excitation (ape, excitation); 
 
%  Make the calculation in elevation 
 
disp('Finding pressure and intensity.. ') 
point=[0 0 0]/1000; 
zvalues=(1:1:100)/1000; 
index=1; 
I=0; 
Ppeak=0; 
for z=zvalues 
  if rem(z*1000,10)==0
    disp(['Calculating at distance ',num2str(z*1000),' mm'])
    end
  point(3)=z; 
  [y,t] = calc_hp(ape,point); 
  I(index)=sum(y.*y)/(2*Z)/fs/Tprf; 
  Ppeak(index)=max(y); 
  index=index+1; 
  end 
Pmean=sqrt(I*2*Z*Tprf/Tp); 
 
%  Plot the calculated response 
 
figure(1)
subplot(211) 
plot(zvalues*1000,I*1000/(100^2)) 
xlabel('Axial distance [mm]') 
ylabel('Intensity: Ispta  [mW/cm^2]') 
if (elefocus == 0) 
  title(['Focus at ',num2str(focus(3)*1000),' mm, No elevation focus (',Itype,')']) 
else 
  title(['Focus at ',num2str(focus(3)*1000),' mm, elevation focus at ',num2str(Rfocus*1000),' mm (',Itype,')']) 
end 
subplot(212) 
plot(zvalues*1000,Ppeak/1e6) 
xlabel('Axial distance [mm]') 
ylabel('Peak pressure [MPa]') 
 
%  Do the calculation for a single element 
 
figure(2)
xdc_apodization (ape, 0, [zeros(1,floor(N_elements/2)) 1 zeros(1,floor(N_elements/2))]);  
Ppeak_single=0; 
Isingle=0; 
index=1; 
zvalues=0; 
z=0.001/1000; 
factor=(10/1000/z)^(1/200); 
for index=1:200 
  point(3)=z; 
  zvalues(index)=z; 
  [y,t] = calc_hp(ape,point); 
  z=z*factor; 
  Isingle(index)=sum(y.*y)/(2*Z)/fs/Tprf; 
  Ppeak_single(index)=max(y); 
  index=index+1; 
  end 
Pmean=sqrt(I*2*Z*Tprf/Tp); 
clf 
plot(zvalues*1000,Ppeak_single/1e3) 
axis([-0.1 max(zvalues)*1000 0 1.2*max(Ppeak_single)/1e3]) 
xlabel('Axial distance [mm]') 
ylabel('Peak pressure [kPa]') 
if (elefocus == 0) 
  title(['Single element. Focus at ',num2str(focus(3)*1000),' mm, No elevation focus (',Itype,')']) 
else 
  title(['Single element. Focus at ',num2str(focus(3)*1000),' mm, elevation focus at ',num2str(Rfocus*1000),' mm (',Itype,')']) 
end 
 %  Release the aperture 
 xdc_free(ape) 
 
 
 
 

用于胎儿成像的65元件聚焦阵列的强度和峰值压力分布图如上。


二、B-Mode image example

  1、人工仿体的成像是通过模拟和从点散射体的集合求取场。在一个图像中的一条RF线可以通过从一个点的集合求出响应来计算,其中的散射强度是由组织中的声音扰动的密度和速度来计算响应。因此,均匀的组织,是由随机放置的点的集合来组成的。它具有高斯分布的散射强度,其中的分布的方差是由特定组织的后向散射截面确定。仿体通常由100000个或更多的散射体,而且模拟50至128条RF线可能需要几天,这取决于所使用的计算机。It is therefore beneficial to split the simulation into concurrently run sessions。

. This can easily be done by first generating the scatterer's position and amplitude and then storing them in a file. This file can then the be used by a number of workstations to find the RF signal for different imaging directions, which are then stored in separate files; one for each RF line. These files are then used to assemble an image

这可以很容易地被完成的。首先生成散射体的位置和振幅,然后将它们存储在一个文件。然后,该文件可以由一些工作站使用以为不同的成像方向找到RF信号,然后将它们存储在单独的文件中,one for each RF line。然后使用这些文件来组装图像 。

这里的代码在模拟行之前写一个虚拟文件,这样其他计算机就可以看到这条线在被模拟中。这使得可以同时运行多台计算机上的脚本,并且它们会自动同步模拟。这是用于这里所示的仿真方法。在一个2.8 GHz的CPU上模拟上线约5分钟,用32个电脑的集群,因此,产生的图像约10分钟,而用一台电脑要超过4小时。 It is also possible to restart the simulation if something goes wrong without having to perform the whole simulation again。通过删除损坏的文件,然后重新开始。囊肿仿体是一个点目标的集合,五个囊肿区域,五个高散射区域。这个可以用于表征造影病变检测能力的成像系统。 由一个集合的点目标,五囊肿区域,和五个高度散射区域,在仿体中的散射体是通过在60×40×15毫米的立方体内找到它们的随机位置而产生的,然后将高斯分布振幅归因于每个散射体。如果散射体驻留在囊肿区域,振幅被设置为零。在高散射区域的振幅乘以10。与高斯分布的标准偏差1相比,点目标有一个固定的幅度为100。

对仿体的线性扫描是由一个192元件的换能器使用64个在发送和接收端具有 a Hanning apodization active elements The element height was 5 mm, the width was a wavelength and the kerf 0.05 mm. The pulses where the same as used for the point phantom mentioned above.一个单一的发射焦点被放置在60毫米处,接收焦点位于从换能器表面30毫米开始每20mm一个间隔处。( A single transmit focus was placed at 60 mm, and receive focusing was done at 20 mm intervals from 30 mm from the transducer surface.)由此为100000个散射体所产生的图像如下所示。 A homogeneous speckle pattern is seen along with all the features of the phantom.。

2、Artificial kidney.


Calculation of B-mode image of synthetic kidney

The phantom was scanned with a 7 MHz 128 element phased array transducer with lambda/2 spacing and Hanning apodization。 A single transmit focus 60 mm from the transducer was used, and focusing during reception is at 5 to 150 mm in 1 mm increments. The images consists of 128 lines with 0.7 degrees between lines.

程序:

%  Make the image interpolation for the polar scan
%
%  Version 1.0, 17/2-99 JAJ
%  Version 1.1, 16/8-2007 JAJ
%    Small changes in compression


%  Set initial parameters


D=10;       %  Sampling frequency decimation factor
fs=100e6/D; %  Sampling frequency  [Hz]
c=1540;     %  Speed of sound [m]
no_lines=128;                  %  Number of lines in image
image_width=90/180*pi;         %  Size of image sector [rad]
dtheta=image_width/no_lines;   %  Increment for image


%  Read the data and adjust it in time 


min_sample=0;
for i=1:no_lines


  %  Load the result


  cmd=['load rf_data/rf_ln',num2str(i),'.mat']
  eval(cmd)
  
  %  Find the envelope
  
  rf_env=abs(hilbert([zeros(round(tstart*fs-min_sample),1); rf_data]));
  env(1:max(size(rf_env)),i)=rf_env;
  end


%  Do logarithmic compression to 40 dB


dB_Range=50;
env=env-min(min(env));
log_env=20*log10(env(1:D:max(size(env)),:)/max(max(env)));
log_env=255/dB_Range*(log_env+dB_Range);


%  Get the data into the proper format


start_depth=0.02;   % Depth for start of image in meters
image_size=0.105;   % Size of image in meters
skipped_samples=0;
samples=max(size(log_env));


start_of_data=(skipped_samples+1)/fs*c/2;           % Depth for start of data in meters
end_of_data=(skipped_samples+samples+1)/fs*c/2;     % Depth for end of data in meters
delta_r=c/2*1/fs;                                   % Sampling interval for data in meters


theta_start= -no_lines/2*dtheta;     % Angle for first line in image


Nz=512;                         % Size of image in pixels
Nx=512;                         % Size of image in pixels
scaling=1;                      % Scaling factor form envelope to image


[N,M]=size(log_env);
D=floor(N/1024);
env_disp=uint8(255*log_env(1:D:N,:)/max(max(log_env)));


%  Make the tables for the interpolation


make_tables (start_depth, image_size,          ...
             start_of_data, delta_r*D, round(samples/D),  ...
    -theta_start, -dtheta, no_lines,       ...
    scaling, Nz, Nx);


%  Perform the interpolation


img_data=make_interpolation (env_disp);


%  Display the image 


image(((1:Nz)/Nz-0.5)*image_size*1000, ((1:Nx)/Nx*image_size+start_depth)*1000, img_data)
axis('image')
set(gca,'FontSize',14)
colormap(gray(256))
xlabel('Lateral distance [mm]')
ylabel('Axial distance [mm]')
axis([-50 50 20 105])


3.

A phantom for a 3 month old fetus has been made. 200,000 scatterers were randomly distributed within the phantom, and with a Gaussian distributed scatter amplitude with a standard deviation determined by the scatter map. The phantom was scanned with a 5 MHz 64 element phased array transducer with lambda/2 spacing and Hanning apodization. A single transmit focus 70 mm from the transducer was used, and focusing during reception is at 40 to 140 mm in 10 mm increments. The images consists of 128 lines with 0.7 degrees between lines.【暂时没仿真出来~~|||】


猜你喜欢

转载自blog.csdn.net/qq_34018578/article/details/73027207