def __setitem__(self, slices, img):
imgshape = list(img.shape)
if len(imgshape) == 3:
imgshape = imgshape + [ self.num_channels ]
maxsize = list(self.bounds.maxpt) + [ self.num_channels ]
minsize = list(self.bounds.minpt) + [ 0 ]
slices = generate_slices(slices, minsize, maxsize)
bbox = Bbox.from_slices(slices)
slice_shape = list(bbox.size3()) + [ slices[3].stop - slices[3].start ]
if not np.array_equal(imgshape, slice_shape):
raise ValueError("Illegal slicing, Image shape: {} != {} Slice Shape".format(imgshape, slice_shape))
if self.path.protocol == 'boss':
self.upload_boss_image(img, bbox.minpt)
else:
self.upload_image(img, bbox.minpt)
评论列表
文章目录