Skip to content

Instantly share code, notes, and snippets.

@chrisgorgo
Created July 17, 2014 15:09
Show Gist options
  • Save chrisgorgo/ec39334a9d69488b9bae to your computer and use it in GitHub Desktop.
Save chrisgorgo/ec39334a9d69488b9bae to your computer and use it in GitHub Desktop.
from nilearn.plotting.img_plotting import plot_img
import pylab as plt
import nibabel as nb
import numpy as np
nii = nb.load("/home/raid3/gorgolewski/Downloads/fmap_field_masked.nii.gz")
print nii.get_affine()
scaling_affine = np.array([[-3, 0, 0, 0],
[0, 3, 0, 0],
[0, 0, 3, 0],
[0, 0, 0, 1]])
new_nii = nb.Nifti1Image(nii.get_data(), scaling_affine)
plot_img(new_nii)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment