nifti_tool and Gzipped NIfTI

I like to edit the headers of some Gzipped NIfTI files. Since nifti_tool can’t modify Gzipped NIfTI, I extracted them. But, I like to compress them after modifications. So, I tried to pass .nii.gz extension to prefix in nifti_tool. An example:
nifti_tool -mod_hdr -prefix dnew.nii.gz -infiles dset0.nii -mod_field dim ‘4 64 64 20 30 1 1 1 1’

nifti_tool reported an error, even though the dnew.nii.gz file was successfully created.
** ERROR (write_hdr_to_file): failed to re-open mod file ‘dnew.nii.gz’

Two questions:
Can I request nifti_tool to support modifying Gzipped NIfTI natively?
What is the “failed to re-open mod file” error?

Just to follow up on this for public consumption (we had moved to an email discussion), note that -mod_hdr will (currently) not modify a compressed dataset header. Because it is compressed, nifti_tool cannot simply overwrite a fixed number of bytes. Maybe in the future I will allow for full dataset overwriting in such a case, but it is not allowed presently. Sorry.

  • rick