k-Wave Toolbox |

## Focussed Detector in 3D Example

On this page…
Overview Defining the sensor geometry Defining on and off-axis point sources Running the simulations

### Overview

This example shows how k-Wave can be used to model the output of a focussed bowl detector where the directionality arises from spatially averaging across the detector surface. It builds on the Focussed Detector in 2D example.

- open the file in the MATLAB Editor
- run the file in MATLAB

Back to Top

### Defining the sensor geometry

For large single element detectors, the directionality arises because the output is spatially averaged across the pressure field on the transducer surface. Here this effect is simulated using a focussed bowl detector (defined using a binary sensor mask) created with the help of `makeSphericalSection`.

    % create a concave sensor
    radius = Nx/4-1;
    height = 10;
    ss = makeSphericalSection(radius, height);

    % add it to a mask of the correct size
    sensor.mask = zeros(Nx, Ny, Nz);
    [a,b,c] = size(ss);
    sphere_offset = 10;
    sensor.mask(sphere_offset+(1:a),(Ny-b+1)/2+(1:b),(Nz-c+1)/2+(1:c)) = ss;

Back to Top

### Defining on and off-axis point sources

To see the focussing effect of the bowl detector, two points sources are defined, one on-axis and one off-axis.

    % place the first point source near the focus of the detector
    source1 = zeros(Nx, Ny, Nz);
    source1(sphere_offset+radius, Ny/2+1, Nz/2+1) = 1;

    % place the second point source off axis
    source2 = zeros(Nx, Ny, Nz);
    source2(sphere_offset+radius, Ny/2+6, Nz/2+6) = 1;

Back to Top

### Running the simulations

Following the simulations, the recorded time series (one per detector grid point) are averaged to model the output of a single element focussed sensor. The resulting time series for both on and off axis source positions are shown below. The detector clearly produces a larger output for the source nearer its focus.

    % run the first simulation
    source.p_mask = source1;
    input_args = {'PMLSize', 10, 'DataCast', 'single', 'PlotSim', false};
    sensor_data1 = kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:});

    % average the data recorded at each grid point to simulate the measured
    % signal from a single element focussed detector
    sensor_data1 = sum(sensor_data1, 1);

    % run the second simulation
    source.p_mask = source2;
    sensor_data2 = kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:});

    % average the data recorded at each grid point to simulate the measured
    % signal from a single element focussed detector
    sensor_data2 = sum(sensor_data2, 1);

Back to Top

© 2009-2014 Bradley Treeby and Ben Cox.