def save(self, image, outpath):
""" A method that save the image data and associated metadata.
Parameters
----------
image: Image
the image to be saved.
outpath: str
the path where the the image will be saved.
"""
diag = (1. / image.spacing).tolist() + [1]
_image = nibabel.Nifti1Image(image.data, numpy.diag(diag))
nibabel.save(_image, outpath)
评论列表
文章目录