I had to manually reorient an image for this subject where the phase encoding direction was incorrect due to an overly steep obliquity to the bounding box and now fmriprep is failing.
I used the following commands on the BIDS-converted nifti files (both sbref, and BOLD) and also the field maps.
But I am getting this error when trying to run fmriprep like usual:
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/fileslice.py", line 681, in read_segments raise ValueError("Whoops, not enough data in file")
Any thoughts? Should I try running dcm2niix on the raw data, transform, and then BIDS convert with clpipe/heudiconv before running fmriprep?
This indicates to me that you have a truncated file:
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/fileslice.py", line 681, in read_segments
raise ValueError("Whoops, not enough data in file")
Could you share the header and the total size of the file at each stage? e.g.
Thank you for your help! I immediately notice that the file is truncated. This occurs during the 3drefit step. Therefore, I’ve included the output of 3drefit at the bottom here.
Hmm. Good catch with the gzip. I’d guess that there is some history here; AFNI has the BRIK/HEAD format, where the header is a separate file and can be modified without touching the data block. And if you’re not adding extensions, the same is true for NIfTI just by overwriting the first 348 bytes, so my guess is this code just writes the header. With gzipped files, you can’t only write the first 348 bytes without modifying the rest of the file, so we’re probably seeing an interaction of application-level code that assumes you can do random writes and I/O level code that will truncate and start a new gzip stream.
@effigies mentioned brought this issue up on the AFNI github page. I’m a little curious about this dataset, because I have used 3drefit a lot on gzipped NIFTIs (as well as on other files) and not had an issue. Is this problematic volume either public, or sharable (for example if I sent an upload link)?
I also see that that version of AFNI appears to be over 4 years old, so it is possible that an earlier issue about this has been resolved. However, that would still really surprise me, and I would like to investigate this more.
Just to follow up on this for any external readers, the problem seems to have been with the library libz that was installed and being applied by the NIFTI library. It had nothing to do with the dataset or with AFNI or the NIFTI library, except that libz needs to be an appropriate version for the package.
It is not clear whether an appropriate version will be installed by the system administrators, or perhaps we will try to provide some static linking to libz.a, instead.