k-Wave Toolbox |
Create a binary map of a filled disc within a 2D grid
disc = makeDisc(Nx, Ny, cx, cy, radius) disc = makeDisc(Nx, Ny, cx, cy, radius, plot_disc)
makeDisc
creates a binary map of a filled disc within a two-dimensional grid (the disc position is denoted by 1's in the matrix with 0's elsewhere). A single grid point is taken as the disc centre thus the total diameter of the disc will always be an odd number of grid points. As the returned disc has a constant grid point radius, if used within a k-space grid where dx and dy are not equal, the disc will appear oval shaped. If part of the disc overlaps the grid edge, the rest of the disc will wrap to the grid edge on the opposite side. The plot that is displayed after calling makeDisc(60, 100, 30, 50, 20, true);
is given below.
|
size of the 2D grid [grid points] |
|
centre of the disc [grid points] |
|
disc radius [grid points] |
|
Boolean controlling whether the disc is plotted using |
|
2D binary map of a filled disc |
makeCircle
, makeBall
makeCircle | makeGrid |
© 2009-2014 Bradley Treeby and Ben Cox.