Running into 3dVol2Surf Error


I am planning to perform an ROI analysis, and want to project the volumetric data to the surface for better viewing. It seems like AFNI’s 3dVol2Surf is what I need to use, but this is my first time using the command, so I wanted to make sure that I am using it properly. I used @SUMA_Make_Spec_FS beforehand to create a SUMA directory with the SUMA-specific files. Then I use 3dVol2Surf, with the following options:

-spec $freesurfer_dir/SUMA/std.141.${subj}_both.spec
-surf_A $freesurfer_dir/SUMA/std.141.lh.smoothwm.asc
-surf_B $freesurfer_dir/SUMA/std.141.lh.pial.asc
-sv $data_dir/T1w.nii.gz
-grid_parent $data_dir/run-01.func.nii.gz
-map_func ave
out_1D $freesurfer_dir/SUMA/test.1D
out_niml $freesurfer_dir/SUMA/test.niml.dset

The file for the -sv option is my anatomical (in MNI space), and the file for the -grid_parent option is the first run of my functional data (also in MNI space).

When I tried running the command, I received this error: ** surface name ‘/N/dc2/scratch/dlevitas/fMRI_data/std/001/freesurfer/sub-001/SUMA/std.141.lh.smoothwm.asc’ not found

I double checked, the file is indeed there; however, I tried changing to -surf_A smoothwm, but then got this error: ** surf name 6, ‘smoothwm’: multiple matches
‘/N/dc2/scratch/dlevitas/fMRI_data/std/001/freesurfer/sub-001/SUMA/././std.141.rh.smoothwm.asc’ and ‘/N/dc2/scratch/dlevitas/fMRI_data/std/001/freesurfer/sub-001/SUMA/././std.141.lh.smoothwm.asc’

I’m unsure why the error message is occurring the first time, and wanted to see if there are options for resolving it.

Thank you.


Hi Dan,

Change the spec file from both to lh, and see if
that resolves the problem.

Also, add “-oob_value 0.0”, so that you do not
lose nodes that happen to be outside the volume.

  • rick

Thanks Rick,

I reorganized things, and now it runs smoothly using this code:
hemi=(lh rh)
runs=ls $data_dir/*run*preproc.nii* | wc -l
for r in seq 1 $runs

	for h in ${hemi[li]}

[/li] do

		if [ ! -f $data_dir/sub-${s}_run-${r}_${h}_v2s.niml.dset ]; then
			3dVol2Surf 																		\
				-spec $freesurfer_dir/std.60.${s}_${h}.spec			\
				-surf_A smoothwm 															\
				-surf_B pial 																\
				-sv $data_dir/sub-${s}*space*preproc*				\
				-grid_parent $data_dir/*run-${r}*preproc.nii*		\
				-map_func ave 																\
				-f_steps 10 																\
				-f_index nodes 																\
				-oob_index -1 																\
				-oob_value 0.0 																\
				-outcols_NSD_format 														\
				-out_1D $data_dir/sub-${s}_run-${r}_${h}_v2s.1D \
				-out_niml $data_dir/sub-${s}_run-${r}_${h}_v2s.niml.dset

I had two follow-up questions that I wanted to clarify.

1). The anatomical file from the -sv option and the functional runs in the -grid_parent option are both normalized in template (MNI) space. I’ve seen some other examples of 3dVol2Surf where the anatomical and functional runs appear to still be in native space; is it fine to perform 3dVol2Surf where the data has already been moved to template space?

2). The functional data I’m using has not been spatially smoothed nor intensity normalized at this point. Am I correct in assuming that these steps should occur following 3dVol2Surf?

Thanks again.


Hi Dan,

  1. It might not be advantageous to convert to MNI space
    before running FreeSurfer. In order to do the group
    analysis on the surface, you would need to use the standard
    mesh surfaces, and those go through FreeSurfer’s registration
    to their own template (on the surface).

The prior volumetric transformation will distort and smooth
the anatomical before FreeSurfer see it. I am not sure how
that might affect the results.

Usually surface analysis is done in orig space, though the
standard mesh surfaces are immediately usable in group
analysis. Then one can use the surface from the anatomical
template for reference, which will give MNI coordinates to
those surface nodes.

But still, what you are doing should work, assuming you ran
FreeSurfer on the MNI space subject anat datasets.

  1. Yes, smoothing should be done on the surface. That is
    one of the main advantages of running a surface analysis.
    Scaling does not matter, except with regard to the order
    of processing steps.
  • rick

Hi Rick,

I’m a little confused regarding Freesurfer’s usage here. I had run Freesurfer prior to @SUMA_Make_Spec_FS, where Freesurfer was used to reconstruct surfaces from T1w/T2w structural images, and the the motion-corrected functional series (after resampling to T1w space) is sampled to the surface. In total, Freesurfer is generating surfaces in the subjects’ native space, and also transforming them to an fsaverage template space.

It seems to me then that using the MNI standardized anat and EPI datasets in 3dVol2Surf is incorrect, since Freesurfer was working in subjects’ native space. Might it be better than to use @SUMA_AlignToExperiment where the -exp_anat option contains the T1w anatomical (skull-stripped)? Or are the fsaverage surface files appropriate in this case?


Hi Dan,

The impression that I had (though was not sure about,
and so mentioned it as an assumption) was that you ran
FreeSurfer on standard space anatomical volumes.

Since that is not true, and you are running FS on orig
data, then it is preferable to no run AlignToExperiment
using standard space data. It is not horrible if the
alignment is affine, but non-linear cannot be done.

It seems to me then there is no reason to go to standard
space. Consider following the class analysis example
that starts with orig space surfaces.

There is an command: AFNI_data6/FT_analysis/s03.ap.surface
and the corresponding proc script: AFNI_data6/FT_analysis/

@SUMA_AlignToExperiment is run in there.

  • rick

Hi Rick,

I am not clear about the pipeline of group analysis on the surface.

  1. In which step should I map data to standard mesh surface?
    [li] Like the single subject surface analysis, after motion correction? By replacing subject surface with standard surface in afni_proc scripts?
    [/li][li] Then what is the -surf_anat of the standard surface? Using the same -surf_anat as in single subject surface analysis?
    [/li][li] Can I map the single subject surface analysis results(stats.subj.?h.niml.dset) to standard mesh surface directly? By 3dSurfToSurf?

  2. Which standard mesh surface should I choose?
    [li] Why these sulcus on the same standard surface called std.141.subj_both.spec of different subject look very different? (Like original surface. )
    [/li][li] Then the std.141.subj_both.spec of which subject should I choose to show the group results?
    [/li][li] And some use MNI305 FsAverage brain as template surface, is it better? How to use it in afni manner?

Thank you,

Hi 2086,

  1. Yes, map the volume registered time series to the
    surface, as is done in in the surface analysis class
    example with: command : s03.ap.surface
    resulting proc script:

Basically, do not even use the original surfaces.
Yes, the -surf_anat dataset is the same for original
surfaces as for standard mesh surfaces.

You would have to be careful mapping the stats, but it
should work, I think. If you view the results before
and after mapping, they should look almost identical.
Of course, this will add a small blur to the result
which is not accounted for.

  1. In AFNI, surface analyses are run on each hemisphere,
    not via the ‘both’ spec file. See the
    command linked to above.

You can use any standard mesh surface (of the same
resolution) to show the results. Node correspondence
comes via FreeSurfer’s internal spherical registration.
Assuming that works, any corresponding standard mesh
surface is okay.

A good choice might be a template. If you can run
that MNI305 dataset through FreeSurfer and then import
it into AFNI (via @SUMA_Make_Spec_FS -NIFTI), then all
results can be shown there.

  • rick