def from_file(path, scale):
''' Reads a file into a new Image instance, always monochrome
Args:
path (`string`): path to a file.
scale (`float`): pixel scale, in microns.
Returns:
`Image`: a new image object.
Notes:
TODO: proper handling of images with more than 8bpp.
'''
imgarr = imread(path, flatten=True, mode='F')
return Image(data=np.flip(imgarr, axis=0) / 255, sample_spacing=scale, synthetic=False)
评论列表
文章目录