[Neuroimaging] load data and get negative dim in header

Satrajit Ghosh satra at mit.edu
Sun Jun 4 11:54:47 EDT 2017


hi,

these are "freesurfer" nifti files that stores the values across the
vertices in a nifti format file. as such, they are not valid files with
respect to the nifti standard. essentially the data is a single array of
values corresponding to the surface indices.

cheers,

satra

On Sun, Jun 4, 2017 at 10:42 AM, -- <744652457 at qq.com> wrote:

> Hello,
>
> I use "preproc-sess" command of Freesurfer to to project my func data to
> individual anatomy space,
>
> preproc-sess -sf ${Sesslist} -fsd "bold" -surface self lhrh -fwhm 0
> -per-run -force
>
>
> and I try to load nifti data with "get_data()" of nibabel, but it could
> not work, error info is here:
>
>
> >>> f.get_data()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/pymodules/python2.7/nibabel/spatialimages.py", line 341,
> in get_data
>     return np.asanyarray(self._data)
>   File "/usr/lib/python2.7/dist-packages/numpy/core/numeric.py", line
> 512, in asanyarray
>     return array(a, dtype, copy=False, order=order, subok=True)
>   File "/usr/lib/pymodules/python2.7/nibabel/arrayproxy.py", line 55, in
> __array__
>     self._data = self._read_data()
>   File "/usr/lib/pymodules/python2.7/nibabel/arrayproxy.py", line 60, in
> _read_data
>     data = self.header.data_from_fileobj(fileobj)
>   File "/usr/lib/pymodules/python2.7/nibabel/analyze.py", line 486, in
> data_from_fileobj
>     data = self.raw_data_from_fileobj(fileobj)
>   File "/usr/lib/pymodules/python2.7/nibabel/analyze.py", line 458, in
> raw_data_from_fileobj
>     return array_from_file(shape, dtype, fileobj, offset)
>   File "/usr/lib/pymodules/python2.7/nibabel/volumeutils.py", line 493,
> in array_from_file
>     raise IOError(msg)
> IOError: Expected -1804 bytes, got 264809160 bytes from file
> "fmcpr.vol2surf.lh.nii.gz"
>  - could the file be damaged?
>
> Then I check the header, and I mark the negative value in "dim" of the
> header:
>
> >>> print(f.get_header())
> <class 'nibabel.nifti1.Nifti1Header'> object, endian='<'
> sizeof_hdr      : 348
> data_type       :
> db_name         :
> extents         : 0
> session_error   : 0
> regular         :
> dim_info        : 0
> dim             : [  4  -1   1   1 451   1   1   1]
> intent_p1       : 0.0
> intent_p2       : 0.0
> intent_p3       : 0.0
> intent_code     : none
> datatype        : float32
> bitpix          : 32
> slice_start     : 0
> pixdim          : [-1.          1.          1.          1.          2.
> 00000072  1.          1.
>   1.        ]
> vox_offset      : 352.0
> scl_slope       : 0.0
> scl_inter       : 0.0
> slice_end       : 0
> slice_code      : unknown
> xyzt_units      : 10
> cal_max         : 0.0
> cal_min         : 0.0
> slice_duration  : 0.0
> toffset         : 0.0
> glmax           : 0
> glmin           : 146790
> descrip         : FreeSurfer May 13 2013
> aux_file        :
> qform_code      : scanner
> sform_code      : scanner
> quatern_b       : -0.0115927606821
> quatern_c       : -0.996071338654
> quatern_d       : -0.0864994972944
> qoffset_x       : 73344.5546875
> qoffset_y       : -1492.14978027
> qoffset_z       : -2311.28955078
> srow_x          : [ -9.99280393e-01   2.56918129e-02   2.79041883e-02   7.
> 33445547e+04]
> srow_y          : [  2.04970520e-02   9.84766901e-01  -1.72667429e-01  -1.
> 49214978e+03]
> srow_z          : [  3.19152586e-02   1.71971247e-01   9.84584868e-01  -2.
> 31128955e+03]
> intent_name     :
> magic           : n+1
>
>
> Well, I have tried to connect Freesurfer mailing list, but there may be
> something wrong with my e-mail address,
>
> and it would be helpful to me if you tell me why there is an negative
> value in the header or how can I fix it.
>
> Thanks in advance,
>
> Bai Haohao
>
>
> Version info:
> System: ubuntu-16.04.1-server-amd64
> Freesurfer: freesurfer-Linux-centos4_x86_64-stable-pub-v5.3.0-HCP
> nibabel: python-nibabel  1.2.2-1
>
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20170604/ccd82b21/attachment.html>


More information about the Neuroimaging mailing list