k-Wave
A MATLAB toolbox for the time-domain
simulation of acoustic wave fields
- Getting Started
- Examples
- Initial Value Problems
- Example: Homogenous Propagation Medium
- Example: Using A Binary Sensor Mask
- Example: Defining A Sensor Mask By Opposing Corners
- Example: Loading External Image Maps
- Example: Heterogeneous Propagation Medium
- Example: Saving Movie Files
- Example: Recording The Particle Velocity
- Example: Defining A Gaussian Sensor Frequency Response
- Example: Comparison Of Modelling Functions
- Example: Setting An Initial Pressure Gradient
- Example: Simulations In One Dimension
- Example: Simulations In Three Dimensions
- Example: Photoacoustic Waveforms in 1D, 2D and 3D
- Time Varying Source Problems
- Example: Monopole Point Source In A Homogeneous Propagation Medium
- Example: Dipole Point Source In A Homogeneous Propagation Medium
- Example: Simulating Transducer Field Patterns
- Example: Steering A Linear Array
- Example: Snell's Law And Critical Angle Reflection
- Example: The Doppler Effect
- Example: Diffraction Through A Slit
- Example: Simulations In Three-Dimensions
- Sensor Directivity
- Example: Focussed Detector in 2D
- Example: Focussed Detector in 3D
- Example: Modelling Sensor Directivity in 2D
- Example: Modelling Sensor Directivity in 3D
- Example: Sensor Element Directivity in 2D
- Example: Focussed 2D Array with Directional Elements
- Photoacoustic Image Reconstruction
- Example: 2D FFT Reconstruction For A Line Sensor
- Example: 3D FFT Reconstruction For A Planar Sensor
- Example: 2D Time Reversal For A Line Sensor
- Example: 2D Time Reversal For A Circular Sensor
- Example: 3D Time Reversal For A Planar Sensor
- Example: 3D Time Reversal For A Spherical Sensor
- Example: Image Reconstruction With Directional Sensors
- Example: Image Reconstruction With Bandlimited Sensors
- Example: Iterative Image Improvement Using Time Reversal
- Example: Attenuation Compensation Using Time Reversal
- Example: Attenuation Compensation Using Time Variant Filtering
- Example: Automatic Sound Speed Selection
- Diagnostic Ultrasound Simulation
- Example: Defining An Ultrasound Transducer
- Example: Simulating Ultrasound Beam Patterns
- Example: Using An Ultrasound Transducer As A Sensor
- Example: Simulating B-mode Ultrasound Images
- Example: Simulating B-mode Images Using A Phased Array
- Numerical Analysis
- Example: Controlling The Absorbing Boundary Layer
- Example: Source Smoothing
- Example: Filtering A Delta Function Input Signal
- Example: Modelling Power Law Absorption
- Example: Modelling Nonlinear Wave Propagation
- Example: Optimising k-Wave Performance
- Using The C++ Code
- Elastic Wave Propagation
- Example: Explosive Source In A Layered Medium
- Example: Plane Wave Absorption
- Example: Shear Waves And Critical Angle Reflection
- Example: Simulations In Three Dimensions
- Functions - By Category
- Functions - Alphabetical List
- Release Notes
- License
k-Wave Toolbox |
2D Time Reversal Reconstruction For A Line Sensor Example
On this page… |
---|
Overview
This example demonstrates the use of k-Wave for the time-reversal reconstruction of a two-dimensional photoacoustic wave-field recorded over a linear array of sensor elements. The sensor data is simulated and then time-reversed using kspaceFirstOrder2D
. It builds on the 2D FFT Reconstruction For A Line Sensor Example.
Performing the time-reversal reconstruction
The first-order k-Wave functions already described for the simulation of photoacoustic wave propagation can also be used for photoacoustic image reconstruction by assigning the time varying pressure recorded over the detector array to sensor.time_reversal_boundary_data
. This pressure is then enforced, in time reversed order, as a Dirichlet boundary condition over the given sensor mask. If the sensor mask is given as a set of Cartesian coordinates then the sensor data, indexed as sensor_data(sensor_position, time)
, must be given in the same order. An equivalent grid-based sensor mask computed using nearest neighbour interpolation is then used to enforce the boundary condition within the computational grid at each time step. If the sensor mask is instead given as a binary grid, the sensor data must be ordered using MATLAB's standard column-wise linear matrix indexing.
By passing the sensor data returned from a k-space forward simulation directly to sensor.time_reversal_boundary_data
and then calling kspaceFirstOrder2D
, it is straightforward to simulate the measurement and reconstruction process (note, in this simple example the 'inverse crime' is committed in which the same numerical parameters are used for both simulation and reconstruction). When using the simulation functions in time reversal mode, the array of time points kgrid.t_array
must be explicitly defined. This array is created here using the utility function makeTime
.
% run the simulation sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:}); % reset the initial pressure source.p0 = 0; % assign the time reversal data sensor.time_reversal_boundary_data = sensor_data; % run the time reversal reconstruction p0_recon = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});
The initial photoacoustic pressure distribution used in the simulation, and the reconstructed initial pressure distribution using time-reversal are shown below.
Comparison with the FFT reconstruction
It is useful to compare the performance of the time-reversal and FFT reconstruction algorithms. The command line output of the two functions are given below. It is clear that the time-reversal reconstruction takes significantly longer to compute; more than an order of magnitude for this example, even using the slower '*linear'
interpolation and a non 2^N grid size for the FFT comparison. However, in contrast to the one-step FFT reconstruction, time-reversal can account for a heterogeneous propagation medium, acoustic attenuation, and a sensor mask of arbitrary shape.
Running k-Wave simulation... start time: 26-Oct-2011 12:06:24 reference sound speed: 1500m/s time reversal mode dt: 20ns, t_end: 15.54us, time steps: 778 input grid size: 88 by 216 grid points (8.8 by 21.6mm) maximum supported frequency: 7.5MHz expanding computational grid... computational grid size: 128 by 256 grid points precomputation completed in 0.15912s starting time loop... estimated simulation time 6.0722s... simulation completed in 7.0374s total computation time 7.207s Running k-space line reconstruction... grid size: 216 by 778 grid points interpolation mode: *linear applying positivity condition... computation completed in 0.15868s
A profile through the larger disc, including a comparison with the analogous FFT reconstruction, is also given. The time-reversal reconstruction has a slightly improved signal to noise ratio, although, it is important to note that the inverse crime has been committed.
3D FFT Reconstruction For A Planar Sensor | 2D Time Reversal Reconstruction For A Circular Sensor |
© 2009-2014 Bradley Treeby and Ben Cox.