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 `makeSphere`.

    % create a concave sensor
    sphere_sz = Nx/2;
    sphere_radius = Nx/4-1;
    sphere = makeSphere(sphere_sz, sphere_sz, sphere_sz, sphere_radius);

    % carve most of the sphere off then add it to a mask of the correct size
    sphere(:, sphere_radius-4:end, :) = 0;
    sensor.mask = zeros(Nx, Ny, Nz);
    sphere_offset = 11;
    sensor.mask(Nx/4:Nx/4+sphere_sz-1, Ny/4:Ny/4+sphere_sz-1, sphere_offset:sphere_offset+sphere_sz-1) = sphere;

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(Nx/2, Ny/2, sphere_offset+sphere_radius) = 1;

    % place the second point source off axis
    source2 = zeros(Nx, Ny, Nz);
    source2(Nx/2-10, Ny/2, sphere_offset+sphere_radius) = 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-2012 Bradley Treeby and Ben Cox.