def upload_boss_image(self, img, offset):
shape = Vec(*img.shape[:3])
offset = Vec(*offset)
bounds = Bbox(offset, shape + offset)
if bounds.volume() < 1:
raise EmptyRequestException('Requested less than one pixel of volume. {}'.format(bounds))
x_rng = [ bounds.minpt.x, bounds.maxpt.x ]
y_rng = [ bounds.minpt.y, bounds.maxpt.y ]
z_rng = [ bounds.minpt.z, bounds.maxpt.z ]
layer_type = 'image' if self.layer_type == 'unknown' else self.layer_type
chan = ChannelResource(
collection_name=self.path.bucket,
experiment_name=self.path.dataset,
name=self.path.layer, # Channel
type=layer_type,
datatype=self.dtype,
)
if img.shape[3] == 1:
img = img.reshape( img.shape[:3] )
rmt = BossRemote(boss_credentials)
img = img.T
img = np.ascontiguousarray(img.astype(self.dtype))
rmt.create_cutout(chan, self.mip, x_rng, y_rng, z_rng, img)
评论列表
文章目录