parse_array_slices_Nd#

parse_array_slices_Nd(key: tuple | slice, extent: Box, dims: int = 3, h_dim: int = -3, w_dim: int = -2) tuple[rastervision.core.box.Box, list[Any | None]][source]#

Parse multi-dim array-indexing inputs into a Box and slices.

Parameters:
  • key (tuple | slice) – Input to __getitem__.

  • extent (Box) – Extent of the raster/label source being indexed.

  • dims (int) – Total available indexable dims. Defaults to 3.

  • h_dim (int) – Index of height dim. Defaults to -3.

  • w_dim (int) – Index of width dim. Defaults to -2.

Raises:
Returns:

A Box representing the h and w slices and a list

containing slices/index-values for all the dims.

Return type:

tuple[Box, list]