code: def _getshapes_2d(center, max_radius, shape):
      
      index_mean = shape * center
      index_radius = max_radius / 2.0 * np.array(shape)
  
      # Avoid negative indices
      min_idx = np.maximum(np.floor(index_mean - index_radius), 0).astype(int)
      max_idx = np.ceil(index_mean + index_radius).astype(int)
      idx = [slice(minx, maxx) for minx, maxx in zip(min_idx, max_idx)]
      shapes = [(idx[0], slice(None)),
                (slice(None), idx[1])]
      return tuple(idx), tuple(shapes)
docs: Calculate indices and slices for the bounding box of a disk.