k-Wave Toolbox Previous   Next

makeSphere

Create a binary map of a sphere within a 3D grid

Syntax

sphere = makeSphere(Nx, Ny, Nz, radius)

Description

makeSphere creates a binary map of a spherical shell (using an extension of the midpoint circle algorithm) within a three-dimensional grid (the sphere position is denoted by 1's in the matrix with 0's elsewhere). A visualisation of the 3D grid returned by calling makeSphere(64, 64, 64, 20) and a cut away showing the singel pixel width (for illustrative purposes only) are given below.

Inputs

Nx, Ny, Nz

size of the 3D grid [number of pixels]

radius

sphere radius [number of pixels]

Outputs

sphere

3D binary map of a sphere

Examples

See Also

makeBall, makeCartSphere, makeCircle


© 2009, 2010 Bradley Treeby and Ben Cox.