I run a voxelwise regression analysis in R and saved the Z-values in an 617361 array and exported it as nifti using oro.nifti. This numeric array contains also NANs but the numbers range from -5.65 to 6.44382. However, in order to get a file that could be read, I used the header of a single subject seed correlation file (imported it as nifti object to R and replaced the data array while keeping the header). It turns out that dmin and dmax of this file is still as in the header of the original file -0.563 to 1.783 and that the afni viewer reads the OLay accordingly.
- I would like to replace dmin and dmax but am not sure how to do it correctly
- are there likely other header attributes that need to be corrected when using the method described?
- are there better ways of exporting a 3d data set from R to afni/nifti including all necessary header parameters?
Are you using the functions in AFNIio.R?
Out of curiosity, what happens when you pass
the resulting dataset through 3dcalc?
3dcalc -a bad.nii -expr a -prefix test.nii
No, I havn’t used AFNIio.R as far as I am aware, just oro.nifti - is that better?
3dcalc seems to sort of fix it: now the OLay is -6 to 5 which seems the rounded actual min and max values (-6.270428 and 5.36703). Do you think it is correct like this now?
Well, I know nothing about oro.nifti (and little about AFNIio.R,
for that matter).
I thought to use 3dcalc because it can remove the bad NaN
values in the dataset. To just remove the old range limits,
you could probably use nifti_tool -rm_ext.
But the rounding/truncating from 3dcalc is strange. Would
you be willing to upload those 2 versions of the dataset
for me to look at? If so, I will send you instructions.
yes, absolutely - would be great if you could have a look!
I actually still had the problem when replacing all NAN by 0 before writing the file…