"data bytes needed" error

Hi,

I have a function written in R that uses the oro.nifti package to read in a gzipped nifti file using the readNIfTI command. I then do some processing on that data and write it out using writeNIfTI, again to a gzipped nifti file, copying the header info from the input (foolish perhaps).

This works fine most of the time, but for a few datasets I get the following error when trying to view them in AFNI.

++WARNING: nifti_read_buffer(path to file):
data bytes needed = 580320
data bytes input = 580304
number missing = 16 (set to 0)
** load bricks: cannot read brick ### from ‘path to file

This then creates problems in my pipeline as AFNI functions will not work on these datasets. Is anybody able to explain to me what this error means exactly, and if there is a work around?

Thanks very much

Joe

Hi Joe,

Does it work on that same dataset if the input and output are
not compressed?

What does nifti_tool say about the input and output? For
example:

nifti_tool -diff_hdr -infiles INPUT.nii.gz OUTPUT.nii.gz
nifti_tool -disp_hdr -infiles OUTPUT.nii.gz
  • rick