pythonnibabel

Unzipping a .nii.gz file in python


I am using the nibabel package to load an image with 7 parcellations in it. It is a .nii.gz file and when I try to load it with nibable.load('image_file') I get the following error:

File "<ipython-input-8-ef77bd97a272>", line 1
    7net_Buckner_img=nib.load(r'Buckner2011_7Networks_MNI152_FreeSurferConformed1mm_TightMask.nii.gz')
                   ^
SyntaxError: invalid syntax

I downloaded the file from here: http://surfer.nmr.mgh.harvard.edu/fswiki/CerebellumParcellation_Buckner2011

How can I load this file in nibabel and view it?


Solution

  • As answered by user above variable can't start at number - remove 7 in name of variable.