When the nifti standard was adopted, they used a short int to represent the dimensions. Unfortunately, this only allows for a maximum dimension of 32k, which is not big enough for surfaces. So I hacked the FS nifti format to put a -1 as the first dim at which point the FS code will go to another place in the header to get the spatial dimensions. It is possible to reshape the spatial dimensions as long as the largest prime factor is less than 32k (see mri_surf2surf with --reshape option). Other than that, you might ask the nibabel people to program the same hack.
On 6/25/17 6:48 AM, Bai Haohao wrote:
Hello Freesurfer experts,
I am running my data with preproc-sess to project my func data to individual anatomy file, and the command shows as below:
preproc-sess -sf ${Sesslist} -fsd "bold" -surface self lhrh -fwhm 0 -per-run -force
And the subjectname point to the subject dir that created after recon-all.
After the running completed, I try to load data from fmcpr.sm0.self.lh.nii.gz with nibabel, and I get this error info:
>>> 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 file header by nibabel, and I get this:
>>> print(f.get_header())<class 'nibabel.nifti1.Nifti1Header'> object, endian='<'sizeof_hdr : 348data_type :db_name :extents : 0session_error : 0regular :dim_info : 0dim : [ 4 -1 1 1 451 1 1 1]intent_p1 : 0.0intent_p2 : 0.0intent_p3 : 0.0intent_code : nonedatatype : float32bitpix : 32slice_start : 0pixdim : [-1. 1. 1. 1. 2.00000072 1. 1.1. ]vox_offset : 352.0scl_slope : 0.0scl_inter : 0.0slice_end : 0slice_code : unknownxyzt_units : 10cal_max : 0.0cal_min : 0.0slice_duration : 0.0toffset : 0.0glmax : 0glmin : 146790descrip : FreeSurfer May 13 2013aux_file :qform_code : scannersform_code : scannerquatern_b : -0.0115927606821quatern_c : -0.996071338654quatern_d : -0.0864994972944qoffset_x : 73344.5546875qoffset_y : -1492.14978027qoffset_z : -2311.28955078srow_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
Note that the dim has value -1, but when I use -surface fsaverage, the dim is correct(show as below):
dim : [ 4 27307 1 6 451 1 1 1]
And I read the source code, the difference between self and fsaverage is appeared when running rawfunc2surf-sess, and log files are attached.
I have tried many commands to load data from fmcpr.sm0.self.lh.nii.gz, such as fslview, freeview, mri_convert, mri_surf2surf, ...
and only tksurfer could read this file by -timecourse fmcpr.sm0.self.lh.nii.gz.
I want to figure out how could I fix it, and any suggestion would be helpful.
Thanks in advance,
Bai Haohao
Version info:System: ubuntu-16.04.1-server-amd64Freesurfer: freesurfer-Linux-centos4_x86_64-stable-pub-v5.3.0-HCP nibabel: python-nibabel 1.2.2-1
_______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard. edu/mailman/listinfo/ freesurfer
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/ freesurfer
The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.