def get_shape_view(self, shape_obj, avoid_oob=True):
        x1, y1, x2, y2 = map(int, shape_obj.get_llur())

        if avoid_oob:
            # avoid out of bounds indexes
            wd, ht = self.get_size()
            x1, x2 = max(0, x1), min(x2, wd-1)
            y1, y2 = max(0, y1), min(y2, ht-1)

        # calculate pixel containment mask in bbox
        yi = numpy.mgrid[y1:y2+1].reshape(-1, 1)
        xi = numpy.mgrid[x1:x2+1].reshape(1, -1)
        contains = shape_obj.contains_arr(xi, yi)

        view = numpy.s_[y1:y2+1, x1:x2+1]
        return (view, contains)
Calculate a bounding box in the data enclosing `shape_obj` and
dataset/ETHPy150Open ejeschke/ginga/ginga/BaseImage.py/BaseImage.get_shape_view