Failure interpolating between surfaces with SurfToSurf:

AFNI Version AFNI_26.0.08 'Pupienus Maximus' :)

Hello AFNI Team,

A colleague of mine has shared with me some masks that were drawn on the fsaverage template:

And I would like to apply them to my own data which is already prepared on the standard (std.141) SUMA mesh. So, I attempted to interpolate between the two surface formats using the following call to SurfToSurf

SurfToSurf \
  -i_fs $FREESURFER_HOME/subjects/fsaverage/surf/rh.sphere.reg  \
  -i_gii $FREESURFER_HOME/subjects/fsaverage/surf/SUMA/std.141.rh.sphere.reg.gii  \
  -dset atlas-MTL200_hemi-R_space-fsaverage_den-164k_label-RPRC_desc-thresh30pct_mask.shape.gii \
  -prefix PRC.RH

However, it's not successfull and I'm having trouble understanding how to remedy the resulting error message:

++     Notice SurfToSurf (SUMA_SurfToSurf.c:671 @16:02:23):ne of 7.01 min total
Saving M2M into PRC.RH

Error SUMA_ngr_2_dset (suma_datasets.c:6106):
Failed to turn dset into a labeled one.
Error SUMA_MakeSparseColumnFullSorted (suma_datasets.c:9206):
Not full and cannot fill it
Error SUMA_DsetCol2FloatFullSortedColumn (suma_datasets.c:9025):
Failed to get full column vector
--     Error SUMA_morphDsetToStd (SUMA_SurfaceToSurface.c:858):
Failed to extract
--     Error SurfToSurf (SUMA_SurfToSurf.c:724):
Failed to map atlas-MTL200_hemi-R_space-fsaverage_den-164k_label-RPRC_desc-thresh30pct_mask.shape.gii

Thanks very much for reading,
Daniel

Hi Daniel-

I think I'm missing a step in your process. The GitHub project you shared just has the NIfTI files. Are you converting the NIfTI to GIFTI using workbench?

In general the process I would use is to take the GIFTI surface on the fsaverage and then SurfToSurf that to the std.141 of the fsaverage. Then run SurfToSurf between the GIFTI file for fsaverage like lh.white to std.141.lh.white with the -dset as the atlas region you want to bring along .

The help is under the MapIcosahedron program:

Say you want to map another (SOMEDSET) dataset defined on the
original mesh onto the std.60 mesh and use the same mapping derived
by MapIcosahedron. The command for that would be:

SurfToSurf -i_fs std.60.rh.smoothwm.asc \
		   -i_fs rh.smoothwm.asc \
		   -prefix std.60. \
		   -mapfile std.60.rh.niml.M2M \
		   -dset rh.SOMEDSET.gii.dset

Where here you'd have your first -i file is "from" and the second is the "to". And you'd likely want to specify the interpolation since it's an atlas as Nearest Neighbors. That is under the -output_params option.

Hi Peter,

I had contacted the original authors of that Github project and they sent me the files in GIFTI format. I'm not entirely sure how they did the conversion. Sorry for not clarifying that.

I tried your two prong approach as follows: First, I used SurfToSurf to map from the fsaverage surface to the std.141 of fsaverage

SurfToSurf \
    -i_fs $FREESURFER_HOME/subjects/fsaverage/surf/rh.sphere.reg  \
    -i_gii $FREESURFER_HOME/subjects/fsaverage/surf/SUMA/std.141.rh.sphere.reg.gii  \
    -prefix tmp

This successfully output the mapping file tmp.M2M. Then, if I understood correctly, I then feed that mapping file into the next step (bringing along the atlas region along from rh.white on fsaverage to the std.141 rh.white:

SurfToSurf \
  -i $FREESURFER_HOME/subjects/fsaverage/surf/rh.white.asc  \
  -i_gii $FREESURFER_HOME/subjects/fsaverage/surf/SUMA/std.141.rh.white.gii  \
  -dset atlas-MTL200_hemi-R_space-fsaverage_den-164k_label-RPRC_desc-thresh30pct_mask.shape.gii \
  -output_params NearestNode  \
  -mapfile tmp.niml.M2M  \
  -prefix PRC.RH

Unfortunately, this also fails with

Comment: #!ascii version of rh.white

++     Notice SurfToSurf (SUMA_SurfToSurf.c:678 @17:46:38):
Reusing mapping of SO1 --> SO2 from tmp.niml.M2M

Error SUMA_ngr_2_dset (suma_datasets.c:6106):
Failed to turn dset into a labeled one.
Error SUMA_MakeSparseColumnFullSorted (suma_datasets.c:9206):
Not full and cannot fill it
Error SUMA_DsetCol2FloatFullSortedColumn (suma_datasets.c:9025):
Failed to get full column vector
--     Error SUMA_morphDsetToStd (SUMA_SurfaceToSurface.c:858):
Failed to extract
--     Error SurfToSurf (SUMA_SurfToSurf.c:724):
Failed to map atlas-MTL200_hemi-R_space-fsaverage_den-164k_label-RPRC_desc-thresh30pct_mask.shape.gii

Did I misunderstand something? What does it mean by Failed to turn dset into a labeled one.

Thanks!

Ah, subtle change is that you already have the M2M file in your fsaverage/SUMA folder for the conversion. Try to use only the files in the fsaverage/SUMA (or in your case it seems to be in fsaverage/surf/SUMA

SurfToSurf \
-i $SUBJECTS_DIR/fsaverage/surf/SUMA/lh.white.gii \
-i $SUBJECTS_DIR/fsaverage/surf/SUMA/std.141.lh.white.gii \
-dset </path/to/atlas.lh> \
-mapfile $SUBJECTS_DIR/fsaverage/surf/SUMA/std.141.fsaverage_lh.niml.M2M \
-output_params NearestNode \
-prefix atlas.141 \

Sometimes surfaces are infuriating, so if this doesn't work, we may need to have you upload the file so one of us can try to debug further.

1 Like

Thanks for the tip that the M2M file is already there in the SUMA directory.

I ran the code you suggested and I got the following message:

Error SUMA_ngr_2_dset (suma_datasets.c:6106):
Failed to turn dset into a labeled one.

Despite that, I still got a .niml.dset saved out. So, it sounds to me like the atlas GIFTI file was just a plain 0/1 mask without any labels that SUMA could read. For my purposes, however, the labels weren't all that necessary and I was able to complete my objective anyways. Thanks again for the help, Peter. You guys rock!

1 Like

Awesome. If you want to upload your original GIFTI file, we can take a look at ways to make things work more seamlessly... or a more helpful/clever error message.