k-Wave Toolbox |
Create a binary map of a sphere within a 3D grid
sphere = makeSphere(Nx, Ny, Nz, radius) sphere = makeSphere(Nx, Ny, Nz, radius, plot_sphere) sphere = makeSphere(Nx, Ny, Nz, radius, plot_sphere, binary) sphere = makeSphere(Nx, Ny, Nz, radius, [], binary)
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. If the Boolean input parameter binary
is set to false
(the default), the sphere map is returned as a double precision matrix. If it is set to true
, the map is returned as a logical matrix. A visualisation of the 3D grid returned by calling makeSphere(64, 64, 64, 20, true);
and a cut away showing the singel grid point thickness (for illustrative purposes only) are given below.
|
size of the 3D grid [grid points] |
|
sphere radius [grid points] |
|
Boolean controlling whether the sphere is plotted using |
|
Boolean controlling whether the sphere map is returned as a double precision matrix ( |
|
3D binary map of a sphere |
makeBall
, makeCartSphere
, makeCircle
, makeSphericalSection
makeLine | makeSphericalSection |
© 2009-2014 Bradley Treeby and Ben Cox.