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)

## 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. A visualisation of the 3D grid returned by calling `makeBall(64, 64, 64, 32, 32, 32, 20)` 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]

## Outputs

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

## Examples

- Simulations In Three-Dimensions Example
- 3D FFT Reconstruction For A Planar Sensor Example
- 3D Time Reversal Reconstruction For A Planar Sensor Example
- 3D Time Reversal Reconstruction For A Spherical Sensor Example

## See Also

`makeCircle`, `makeDisc`, `makeSphere`

© 2009 Bradley Treeby and Ben Cox.