k-Wave Toolbox |

# makeBall

Create a binary map of filled ball within a 3D grid

## Syntax

    ball = makeBall(Nx, Ny, Nz, cx, cy, cz, radius)
    ball = makeBall(Nx, Ny, Nz, cx, cy, cz, radius, plot_ball)

## Description

`makeBall` creates a binary map of a filled ball within a three-dimensional grid (the ball position is denoted by 1's in the matrix with 0's elsewhere). A single pixel is taken as the disc centre thus the total diameter of the ball will always be an odd number of pixels. The plot that is displayed after calling `makeBall(64, 64, 64, 32, 32, 32, 20, true)` is given below.

## Inputs

`Nx, Ny, Nz` | size of the 3D grid [number of pixels]
`cx, cy, cz` | centre of the ball [pixel coordinates]
`radius` | ball radius [number of pixels]

## Optional Inputs

`plot_ball` | Boolean controlling whether the ball is plotted using `voxelPlot` (default = false)

## Outputs

`ball` | 3D binary map of a filled ball

## Examples

- Simulations In Three Dimensions
- Photoacoustic Waveforms in 1D, 2D and 3D
- 3D FFT Reconstruction For A Planar Sensor
- 3D Time Reversal For A Planar Sensor
- 3D Time Reversal For A Spherical Sensor

## See Also

`makeCircle`, `makeDisc`, `makeSphere`

© 2009, 2010, 2011 Bradley Treeby and Ben Cox.