30 """Convert a SpanSet into a numpy boolean array
34 shape : `tuple` of `int`
35 The final shape of the output array.
36 If `shape` is `
None` then the extent of the bounding box
is used.
38 The lower-left corner of the array that will contain the spans.
39 If `xy0`
is `
None` then the origin of the bounding box
is used.
43 result : `numpy.ndarray`
44 The array
with pixels contained
in `spans` marked
as `
True`.
49 if shape
is None and xy0
is None:
55 result = mask.getArray().astype(bool)
59 extent = self.getBBox().getDimensions()
60 shape = extent[1], extent[0]
63 xy0 = self.getBBox().getMin()
64 offset = (-xy0[0], -xy0[1])
66 result = np.zeros(shape, dtype=bool)
67 yidx, xidx = self.shiftedBy(*offset).indices()
68 result[yidx, xidx] = 1
def asArray(self, shape=None, xy0=None)