# How to make an arbitrary scattering ball phantom in k-Wave ultrasound toolbox!

## About k-Wave ultrasound simulation toolbox

k-Wave is an open source acoustics toolbox for MATLAB and C++. It is a time-domain acoustic model, based on the *k*-space pseudo-spectral method, for complex and tissue-realistic medium.

## Something about computational efficiency

The simulation functions are both fast and easy to use. However, to simulation complex scenarios, especially for higher frequency propagation, even the `C`

functions are slow, e.g., almost 24 hours is needed to simulate a single medical B-mode image. So, a powerful single or double GPU, like `GeForce GTX TITAN Z`

is preferred.

### “makeBall.m” need to be modified

`makeBall.m`

creates a binary map of a filled ball within a 3D grid. It was found that it can only be used when `dx=dy=dz`

, so to create an arbetrary ball, the following codes can be used:

- Since the coordinate origin is in the center of the k-Wave grid matrix, but the locations of the scatters are relative to the upperleft corner of the grid. So, first, set the scatter position:

- Then construct a boolean array setting
`True`

at the voxels where the scatters are located:

- Other parameters refer to the k-Wave example code Ultrasound B-mode simulation.

One example phantom is as follows, here `dx = 0.1388mm`

, `dy=dz = 0.15mm`

: