prtools.boundary#

boundary(x, threshold=0)[source]#

Find bounding row and column indices of data within an array.

Parameters:
  • x (array_like) – Input array

  • threshold (float, optional) – Masking threshold to apply before boundary finding. Only values in x that are larger than threshold are considered in the boundary finding operation. Default is 0.

Returns:

rmin, rmax, cmin, cmax – Boundary indices

Return type:

ints

Examples

>>> circ = prtools.circle(shape=(200, 200), radius=50)
>>> plt.imshow(circ, cmap='gray')
>>> plt.grid('on')
../_images/prtools-boundary-1.png
>>> prtools.boundary(circ)
(50, 150, 50, 150)