1. 引言
医用超声图像模拟系统是医学影像仿真领域的重要工具,用于教学、算法验证和设备研发。探头作为超声系统的核心部件,其建模的准确性直接决定了模拟图像的真实性和可靠性。本文将深入探讨医用超声图像模拟系统中探头建模的详细设计,涵盖物理模型、数学建模、软件实现及验证方法。
2. 探头建模的核心要素
2.1 探头物理结构
- 换能器阵列:线性阵列、凸阵、相控阵等不同类型探头的几何排布
- 阵元特性:阵元尺寸、间距、中心频率、带宽
- 声学透镜:聚焦特性、声场分布
- 匹配层:声阻抗匹配,影响能量传输效率
2.2 声场模型
- 脉冲发射模型:激励脉冲的时域和频域特性
- 声场传播模型:基于波动方程的声场计算
- 指向性函数:描述阵元在不同方向上的灵敏度
3. 数学建模方法
3.1 线性系统模型
探头建模可视为线性时不变系统,输出信号可表示为:
s_out(t) = h_tx(t) * s_in(t) * h_rx(t)
其中:
s_in(t):输入电信号h_tx(t):发射脉冲响应h_rx(t):接收脉冲响应*:卷积运算
3.2 空间脉冲响应法
基于空间脉冲响应(Spatial Impulse Response, SIR)计算声场:
p(r,t) = ρ * ∂/∂t [v(t) * h(r,t)]
其中:
p(r,t):空间点r处的声压ρ:介质密度v(t):阵元表面速度h(r,t):空间脉冲响应
3.3 角谱法
在频域计算声场传播:
P(k_x,k_y,z) = P(k_x,k_y,0) * exp(jk_z z)
其中:
P(k_x,k_y,z):z平面处的角谱k_z = sqrt(k^2 - k_x^2 - k_y^2):纵向波数
4. 软件实现架构
4.1 类设计
python
class UltrasoundProbe:
def __init__(self, probe_type, frequency, num_elements, pitch):
self.probe_type = probe_type # 'linear', 'convex', 'phased'
self.center_frequency = frequency # MHz
self.num_elements = num_elements
self.pitch = pitch # 阵元间距,mm
self.element_width = pitch * 0.8 # 阵元宽度
self.bandwidth = 0.7 # 相对带宽
def get_impulse_response(self, t):
"""获取阵元脉冲响应"""
# 高斯调制正弦脉冲
sigma = 1 / (self.center_frequency * 1e6 * np.pi * self.bandwidth)
envelope = np.exp(-(t**2) / (2 * sigma**2))
carrier = np.sin(2 * np.pi * self.center_frequency * 1e6 * t)
return envelope * carrier
def calculate_sound_field(self, points, excitation):
"""计算指定点的声场分布"""
# 实现空间脉冲响应或角谱法
pass
class LinearArrayProbe(UltrasoundProbe):
def __init__(self, frequency, num_elements, pitch, aperture_length):
super().__init__('linear', frequency, num_elements, pitch)
self.aperture_length = aperture_length
self.positions = np.linspace(
-aperture_length/2,
aperture_length/2,
num_elements
)
4.2 声场计算模块
python
class SoundFieldCalculator:
@staticmethod
def spatial_impulse_response(probe, point, t):
"""计算单阵元对空间点的脉冲响应"""
# 基于阵元几何和传播时间计算
distances = np.linalg.norm(probe.element_positions - point, axis=1)
delays = distances / probe.sound_speed
responses = probe.get_impulse_response(t - delays)
return np.sum(responses) / distances
@staticmethod
def angular_spectrum(probe, field_plane, distance):
"""使用角谱法计算声场传播"""
# 计算初始平面的角谱
kx, ky = np.meshgrid(
np.fft.fftfreq(field_plane.shape[0], probe.wavelength),
np.fft.fftfreq(field_plane.shape[1], probe.wavelength)
)
kz = np.sqrt(probe.k**2 - kx**2 - ky**2)
# 传播算子
propagator = np.exp(1j * kz * distance)
# 频域传播
field_spectrum = np.fft.fft2(field_plane)
propagated_spectrum = field_spectrum * propagator
return np.fft.ifft2(propagated_spectrum)
5. 聚焦与波束形成
5.1 发射聚焦
通过延迟激励不同阵元实现发射聚焦:
python
def calculate_transmit_delays(probe, focus_point):
"""计算发射聚焦延迟"""
delays = np.zeros(probe.num_elements)
for i in range(probe.num_elements):
distance = np.linalg.norm(probe.positions[i] - focus_point)
delays[i] = distance / probe.sound_speed
# 归一化,使最远阵元延迟为0
delays = delays.max() - delays
return delays
5.2 接收波束形成
动态接收聚焦提高图像分辨率:
python
class Beamformer:
def __init__(self, probe, sampling_freq):
self.probe = probe
self.fs = sampling_freq
self.delay_lines = []
def dynamic_receive_focus(self, rf_data, depth_points):
"""动态接收聚焦"""
beamformed = np.zeros(len(depth_points))
for j, depth in enumerate(depth_points):
# 计算每个深度点的最佳延迟
delays = self.calculate_receive_delays(depth)
# 对齐并求和通道数据
aligned_data = self.delay_and_sum(rf_data, delays)
beamformed[j] = np.sum(aligned_data)
return beamformed
def delay_and_sum(self, data, delays):
"""延迟求和波束形成"""
# 将延迟转换为采样点
delay_samples = (delays * self.fs).astype(int)
aligned = np.zeros_like(data)
for ch in range(data.shape[0]):
aligned[ch] = np.roll(data[ch], -delay_samples[ch])
return np.mean(aligned, axis=0)
6. 仿真验证与性能评估
6.1 验证指标
- 声场分布验证:与理论解或测量数据对比
- 点扩散函数(PSF):评估系统分辨率
- 对比度分辨率:检测低对比度目标的能力
- 计算效率:运行时间与内存使用
6.2 测试用例
python
def test_probe_modeling():
"""探头建模验证测试"""
# 创建线性阵列探头模型
probe = LinearArrayProbe(
frequency=5.0, # 5 MHz
num_elements=128,
pitch=0.3, # 0.3 mm
aperture_length=38.4 # mm
)
# 测试脉冲响应
t = np.linspace(-1e-6, 1e-6, 1000)
impulse = probe.get_impulse_response(t)
# 验证中心频率
spectrum = np.fft.fft(impulse)
freq = np.fft.fftfreq(len(t), t[1]-t[0])
peak_freq = freq[np.argmax(np.abs(spectrum))]
assert abs(peak_freq - 5e6) / 5e6 < 0.1 # 误差小于10%
print("探头脉冲响应测试通过")
# 声场计算测试
calculator = SoundFieldCalculator()
points = np.array([[0, 0, 50], [5, 0, 50]]) # 两个测试点,单位mm
field = calculator.spatial_impulse_response(probe, points, t)
assert field.shape == (2, len(t))
print("声场计算测试通过")
7. 优化与扩展
7.1 计算优化
- GPU加速:使用CUDA或OpenCL并行计算声场
- 频域计算:利用FFT加速卷积运算
- 稀疏采样:在非关键区域降低采样率
7.2 高级功能扩展
- 谐波成像:模拟非线性传播效应
- 复合成像:多角度发射合成
- 弹性成像:模拟组织弹性特性
- 三维探头:扩展至三维阵列建模
8. 总结
医用超声图像模拟系统的探头建模是一个多学科交叉的复杂问题,涉及声学、信号处理和数值计算。本文详细介绍了探头建模的物理基础、数学方法、软件实现及验证策略。准确的探头模型是生成逼真超声图像的前提,也是后续组织散射模拟和图像重建的基础。
随着计算能力的提升和算法的优化,探头建模将更加精细和高效,为超声成像研究、设备开发和临床培训提供更强大的仿真工具。