k-Wave Toolbox |
![]() ![]() |
Create a binary map of a filled disc within a 2D grid
disc = makeDisc(Nx, Nz, cx, cz, radius) disc = makeDisc(Nx, Nz, cx, cz, 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 pixel is taken as the disc centre thus the total diameter of the disc will always be an odd number of pixels. As the returned disc has a constant pixel radius, if used within a k-space grid where dx and dz 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(128, 128, 64, 64, 30, true)
is given below.
|
size of the 2D grid [number of pixels] |
|
centre of the disc [pixel coordinates] |
|
disc radius [number of pixels] |
|
Boolean controlling whether the disc is plotted using |
|
2D binary map of a filled disc |
makeCircle
, makeBall
![]() |
makeCircle | makeGrid | ![]() |
© 2009, 2010 Bradley Treeby and Ben Cox.