Hi Doug,

Thanks for your reply. I have the problem even if I use MRIread and MRIwrite. But I have done a little more digging following your suggestions. Basically, there are differences in the output of mri_vol2surf (that I should have spotted earlier), as well as differences in the header information. I highlight the differences below, and I have put the detailed outputs of mri_vol2surf at the end in case you still need to look at it.

I think the clearest way of explaining the different outcomes is as follows.:

1) mri_vol2surf performed on a nifti volume generated by Nibabel. Nothing done in Matlab.
mri_vol2surf ouput:
"Number of source voxels hit = 22587".
"niiRead(): NIFTI_UNITS_UNKNOWN, assuming mm"
Results looks fine in tksurfer (i.e., I have a distribution of voxel values in the Configure Overlay window).
If I look at the nifti header, hdr.volres= [2.0000e+10 2.0000e+10 2.0000e+10] and several other fields (e.g., vox2ras etc) also have the same magnitude. In addition, hdr.niftihdr.dim'=[3    76    76    93     1     1     1     1]

2) The Nibabel nifti is opened in matlab with MRIread and immediately saved with MRIwrite. Nothing else is done to the data in Matlab.
Output of MRIread=WARNING: xyz units code 0 is unrecognized
Rescaling NIFTI: slope = 1, intercept = 0
mri_vol2surf output:
"Number of source voxels hit = 1".
Nothing about NIFTI_UNITS (note the header is the same as in 1 above). Rest of mri_vol2surf output is exactly as for #1 above.
The header values are as above except hdr.niftihdr.dim'=[4    76    76    93     1     1     1     1]

3) The Nibabel nifti is opened in matlab with MRIread. The 3d volume is saved with MRIwrite but with the header information from a FSFAST created nifti.
mri_vol2surf says "Number of source voxels hit = 22587".
hdr.volres=[2 2 2] and other fields have values of the same order.
hdr.niftihdr.dim'=[4    76    76    93     1     1     1     1]

I don't know if I have focused on the relevant header information here so I also attach the headers from steps 1-3 above.

Thanks a lot for your help and time on this. I will often have to go back and forth between python functions and Matlab/FS-FAST scripts so this will be very useful.

Leila

Detailed output of mri_vol2surf with fsfast header (#3 above):
mri_vol2surf --src fs_hdr.nii --hemi rh --out_type mgh --float2int round --o fshdr-rh.mgh --projfrac 0.5 --trgsubject fsaverage --regheader fsaverage
srcvol = fs_hdr.nii
srcreg unspecified
srcregold = 0
srcwarp unspecified
surf = white
hemi = rh
trgsubject = fsaverage
surfreg = sphere.reg
ProjFrac = 0.5
thickness = thickness
reshape = 0
interp = nearest
float2int = round
GetProjMax = 0
INFO: float2int code = 0
Done loading volume
Computing registration from header.
  Using /APPLICATIONS/freesurfer/subjects/fsaverage/mri/orig.mgz as target reference.
Reading surface /APPLICATIONS/freesurfer/subjects/fsaverage/surf/rh.white
Done reading source surface
Reading thickness /APPLICATIONS/freesurfer/subjects/fsaverage/surf/rh.thickness
Done
Mapping Source Volume onto Source Subject Surface
 1 0.5 0.5 0.5
using old
Done mapping volume to surface
Number of source voxels hit = 22587
Writing to fshdr-rh.mgh
Dim: 163842 1 1

Detailed output of mri_vol2surf with nibabel header (after opening and saving in matlab) (#2 above):
 mri_vol2surf --src test.nii --hemi rh --out_type mgh --float2int round --o test-rh.mgh --projfrac 0.5 --trgsubject fsaverage --regheader fsaverage
srcvol = test.nii
srcreg unspecified
srcregold = 0
srcwarp unspecified
surf = white
hemi = rh
trgsubject = fsaverage
surfreg = sphere.reg
ProjFrac = 0.5
thickness = thickness
reshape = 0
interp = nearest
float2int = round
GetProjMax = 0
INFO: float2int code = 0
Done loading volume
Computing registration from header.
  Using /APPLICATIONS/freesurfer/subjects/fsaverage/mri/orig.mgz as target reference.
Reading surface /APPLICATIONS/freesurfer/subjects/fsaverage/surf/rh.white
Done reading source surface
Reading thickness /APPLICATIONS/freesurfer/subjects/fsaverage/surf/rh.thickness
Done
Mapping Source Volume onto Source Subject Surface
 1 0.5 0.5 0.5
using old
Done mapping volume to surface
Number of source voxels hit = 1
Writing to test-rh.mgh
Dim: 163842 1 1