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, where w and h are the width and height of

    the region and (x,y) is the upper-left coordinate. If centered, then (x,y) is instead the center of the region to imprint. If circular, then an elliptical region circumscribed by the rectangular region is returned.

    • Tuple containing arrays of identical length corresponding to y and x indices. centered and circular are ignored.

    • Boolean array of same shape as matrix; the window is defined where True pixels are. centered and circular 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 by shape 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)