def load(path, dtype=numpy.single):
""" Load an image.
Parameters
----------
path: str
the path to the data to be loaded.
dtype: str
type to which the data will be cast. Passing 'None' will not cast.
Returns
-------
image: Image
the loaded image.
"""
# Load the image
loader = get_loader(path)
image = loader.load(path)
# Cast the image if requested
if dtype:
image.data = image.data.astype(dtype)
return image
评论列表
文章目录