Skip to content

Commit 889ac9e

Browse files
authored
add as_slices to BoundingBox (#207)
1 parent 545f72e commit 889ac9e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

wkcuber/api/bounding_box.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,13 @@ def slice_array(self, array: np.ndarray) -> np.ndarray:
260260
self.topleft[2] : self.bottomright[2],
261261
]
262262

263+
def as_slices(self) -> Tuple[slice, slice, slice]:
264+
return np.index_exp[
265+
self.topleft[0] : self.bottomright[0],
266+
self.topleft[1] : self.bottomright[1],
267+
self.topleft[2] : self.bottomright[2],
268+
]
269+
263270
def copy(self) -> "BoundingBox":
264271

265272
return BoundingBox(self.topleft.copy(), self.bottomright.copy())

0 commit comments

Comments
 (0)