lentil.window#
- lentil.window(img, shape=None, slice=None)[source]#
- Extract an appropriately sized, potentially windowed array - Parameters:
- img (array_like) – Data to window 
- shape (array_like or None, optional) – Output shape given as (nrows, ncols). If - None(default), an uncropped array is returned.
- slice (array_like or None, optional) – Indices of - imgarray to return given as (r_start, r_end, c_start, c_end). This definition follows standard numpy indexing.
 
- Returns:
- data – Trimmed and windowed - imgarray
- Return type:
- ndarray 
 - Notes - If - imgis a single value (img.size == 1), self.data is returned regardless of what- shapeand- sliceare.
- If - shapeis given but- sliceis- None, the returned ndarray is trimmed about the center of the array using- lentil.pad().
- If - sliceis given but- shapeis- None, the returned ndarray is extracted from- imgaccording to the indices in- slice
- If both - shapeand- sliceare given, the returned ndarray is extracted from- imgaccording to the indices in- sliceand the following expressions must also be true:
 - shape[0] = (slice[1] - slice[0]) = (r_end - r_start) shape[1] = (slice[3] - slice[2]) = (c_end - c_start)