slmsuite.holography.toolbox.window_slice
- window_slice(window, shape=None, centered=False, circular=False)[source]
Get the slices that describe the window’s view into the larger array.
- Parameters
window ((int, int, int, int) OR (array_like, array_like) OR array_like) –
A number of formats are accepted: - List in
(x, w, y, h)
format, wherew
andh
are the width and height ofthe region and
(x,y)
is the upper-left coordinate. Ifcentered
, then(x,y)
is instead the center of the region to imprint. Ifcircular
, then an elliptical region circumscribed by the rectangular region is returned.Tuple containing arrays of identical length corresponding to y and x indices.
centered
andcircular
are ignored.Boolean array of same
shape
asmatrix
; the window is defined whereTrue
pixels are.centered
andcircular
are ignored.
shape ((int, int) OR None) – The (height, width) of the array that the window is a view into. If not
None
, indices beyond those allowed byshape
will be clipped.centered (bool) – See
window
.circular (bool) – See
window
.
- Returns
slice_ – The slice for the window.
- Return type
(slice, slice) OR (array_like, array_like) OR (array_like)