rall_func dimensions and stats

I'm trying to create a mask of some sort. I'm using rall_func.nii file and loading it to MATLAB. Then after reading it, it's shown that the dimensions are x,y,z,1,7 (I have 7 regressors in the GLM). I know that the regressor of interest is number 1 (that's how I specified in the GLM in the first place), so that's the one I'm keeping for masking later. But then I tried to see if there were any negative values and I found none.
However, on AFNI I can see that there are voxels with negative values for that regressor, only on MATLAB I can see none. What could the reason be?


In general, I think it would be better to stick with using AFNI (or other) existing software programs for this kind of task. When doing analysis steps like this, keeping header information correct as the steps proceed is key, and it is easy for a small mistake to get made (e.g., data type changing from short to byte, but the header recording the old, wrong one).

In AFNI, to see the dimensions of a dataset, you can use:

3dinfo -n4 DSET

If you would like to check for negative values, you can run this to make a mask of where there are negative values (values <0) in DSET:

3dcalc -a DSET -expr 'isnegative(a)' -prefix DSET_NEG_MASK

If DSET has 5 subvolumes, so will DSET_NEG_MASK. If you want DSET_NEG_MASK to be a NIFTI dataset, put .nii or .nii.gz on the end of the -prefix .. output name.


Thank you so much, this helps a lot.
The reason I'm using MATLAB is that it's easier to see what variables I have and how their dimensions change and it's easier to examine the variables before using them. Don't NIFTI1 files preserve the header information though?
Also after examining the file and using 3dBrickStat to count voxels with negative values in the first block (so 1 of 7, which is supposed to be my regressor of interest), it's returning zero. However, I can see that there are voxels with negative values in the GUI. What could I be doing wrong?
Thank you in advance.

Perhaps your 1-based index 1 corresponds to the 0-based index 0 in AFNI, and you are looking not at a beta weight but at the full F-stat. What does the output of this show:

3dinfo -subbrick_info rall_func.nii
  • rick

Thank you so much it's now kind of resolved.