ANTsPy
ANTsPy copied to clipboard
Troubles in converting ANTsImage to PIL image.
Describe the bug Hi, I have troubles in converting ANTsImage to PIL image. Please run this scripts and you can find that 'fixA2.png' is different to 'A.png' or 'fixA1.png'. It shows that ants.to_file() have some tricks I don't know.
`from PIL import Image import numpy as np import ants
path = 'A.png' to_dir = '.' img = ants.from_numpy(np.array(Image.open(path)))
Image.fromarray(np.array(img.numpy())).save(os.path.join(to_dir, 'fixA1.png')) img.to_file(os.path.join(to_dir, 'fixA2.png'))`
A.png
fixA1.png
fixA2.png