[Neuroimaging] 2D NIFTI images in nibabel

paul mccarthy pauldmccarthy at gmail.com
Thu Sep 1 05:14:55 EDT 2016


Howdy all,


Nibabel truncates the third dimension of a NIFTI image with dim3=1.


(boo) ws189:nifti2D paulmc$ fslinfo MNI152_T1_2mm_sliceXY.nii.gz
data_type      INT16
dim1           91
dim2           109
dim3           1
dim4           1
datatype       4
pixdim1        2.000000
pixdim2        2.000000
pixdim3        2.000000
pixdim4        1.000000
cal_max        8000.0000
cal_min        3000.0000
file_type      NIFTI-1+


(boo) ws189:nifti2D paulmc$ ipython
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 12:54:16)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import nibabel as nib

In [2]: i = nib.load('MNI152_T1_2mm_sliceXY.nii.gz')

In [3]: i.shape
Out[3]: (91, 109)

In [4]: i.header.get_zooms()
Out[4]: (2.0, 2.0)

In [5]:


Does anybody else think that this is a problem?

Note that the dimensions for an image of e.g. size (91, 1, 91) will be
preserved.

Cheers,

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20160901/40251131/attachment.html>


More information about the Neuroimaging mailing list