def _atlas_single_channel(self, channel, dims):
scale = (float(dims.tile_width) / float(self.aics_image.size_x), float(dims.tile_height) / float(self.aics_image.size_y))
channel_data = self.aics_image.get_image_data("XYZ", C=channel)
# renormalize
channel_data = channel_data.astype(np.float32)
channel_data *= 255.0/channel_data.max()
atlas = np.zeros((dims.atlas_width, dims.atlas_height))
i = 0
for row in range(dims.rows):
top_bound, bottom_bound = (dims.tile_height * row), (dims.tile_height * (row + 1))
for col in range(dims.cols):
if i < self.aics_image.size_z:
left_bound, right_bound = (dims.tile_width * col), (dims.tile_width * (col + 1))
tile = zoom(channel_data[:,:,i], scale)
atlas[left_bound:right_bound, top_bound:bottom_bound] = tile.astype(np.uint8)
i += 1
else:
break
# transpose to YX for input into CYX arrays
return atlas.transpose((1, 0))
评论列表
文章目录