Skip to content

Instantly share code, notes, and snippets.

@czotti
Created April 4, 2016 14:14
Show Gist options
  • Save czotti/9a1f45ea18e85deeb69db1d5bae4537e to your computer and use it in GitHub Desktop.
Save czotti/9a1f45ea18e85deeb69db1d5bae4537e to your computer and use it in GitHub Desktop.
reading nifti(or supported format) with nibabel
import nibabel as nib
def read_file(filename):
"""
Args:
-----
filename(str): path of your file
Output:
-------
ndarray: numpy array of the data of the file
"""
img = nib.load(filename)
return img.get_data()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment