Surf2VolCoord error



I am attempting to find the closest nodes to a COM xyz coordinate that I have using Surf2VolCoord. The surface I'm passing in is a gifti that I made using ConvertDset:

ConvertDset -o_gii -input peak_times.1D -prefix peak_times

Where the 1D file has SUMA vertices and scalar values. I've been attempting to run

Surf2VolCoord -i_gii peak_times.gii -grid_parent sub-p130_ses-clinical_SurfVol.nii -closest_node '-18.962 28.194 29.804' -prefix closest_node

but I get the following error message:

Error Surf2VolCoord_demo:
Grid parent ./sub-p130_ses-clinical_SurfVol.nii does not exist.

I'm pretty certain there are no issues with my SurfVol and have used it as the grid parent in the past, so I"m wondering if there could be a problem with the way I'm generating the surface file?

Thank you for your time!


Hm, that is odd. I get that error message even when I definitely see the grid_parent file exists without any path.

Note that using that syntax refers to "demo mode", and I'm not actually sure what that mode is. I will have to look into that.

But from this AFNI Academy video on using SUMA, I followed the demo script for getting distance to a surface (expand the text description beneath the video and go to the end of it, and/or click here), and that works.

Adapting your example to the files I have as part of the AFNI Bootcamp data download in AFNI_data6/FT_analysis/FT/SUMA/, I ran:

Surf2VolCoord                                                \
    -RAI                                                     \
    -i_gii          std.60.lh.pial.gii                       \
    -i_gii          std.60.rh.pial.gii                       \
    -sv             FT_SurfVol.nii                           \
    -qual           LR                                       \
    -closest_node   '-18.962 28.194 29.804'   

... (since you can load more than one GII if you have hemispheres) and got the reasonable looking output:

26868R 8.660474

Is that the kind of output you are interested in?



Thank you for the example, that is the desired output I've been aiming for. I looked into the referenced files and tried out your parameters.

Surf2VolCoord -RAI -i_gii 1_rh_peak_times.gii -sv sub-p130_ses-clinical_SurfVol.nii -qual R -closest_node '-18.962 28.194 29.804' -prefix 1_rh_closest_node

** afni_open_gifti_surf: 1_rh_peak_times.gii is not a surface

Error SUMA_Load_Surface_Object_eng: Failed in SUMA_GIFTI_Read.

Error SUMA_Load_Spec_Surf: could not load SO

Error Surf2VolCoord_demo:

Failed to find surface

in spec file.

Unfortunately, the issue seems to be with my input gifti (created as described in the initial post), but I'm not sure what exactly it's missing since I've been loading it into SUMA for visualization without error. Any ideas would be much appreciated!

Thanks again,

Hi Leela,

To be sure, peak_times does not sound like a surface, but like data on a surface. Does it contain times or coordinates?

In your later example, the error says

1_rh_peak_times.gii is not a surface

I would expect that is because it does not have surface coordinates. In the example that Paul ran, the inputs were real surfaces, not data files.

What does this command show (edited, since I last used a .gii file):

head peak_times.1D
  • rick

Hi Rick,

That's correct, it's just data on a surface. The index is dropped per ConvertDset preference, but each row should correspond to a SUMA vertex. The command returns











My goal is to find the SUMA vertex here with a nonzero value that is closest to the coordinates I passed into Surf2VolCoord with -closest_node. Let me know if there is a more efficient approach you can think of!

Thank you for your help as always,

Hi Leela,

I think the -i options specify input surfaces (coordinates, not data) against which the input coordinates passed via -closest_node (or -closest_nodes COORDS.txt) are compared. With the output including a node index. I do not think the input is supposed to include any index, though it is possible that I am missing something.

What exactly would you like to happen with respect to the 26? Would you like to find a surface node and coordinates that are close to the coordinates from node #26?

  • rick

Hi Rick,

The nonzero values (26, for example, which is the value for SUMA vertex 9 of 36001) in peak_times.1D correspond to the SUMA vertices that I am interested in.

I want to know which of these vertices lies closest to the coordinate that I passed in. So for example, vertex 9 could be an option, if it happens to be closest. Does this make more sense? Apologies for the confusion.

I believe I need to manipulate the input surface — or define a subset of the std.60 .gii file, maybe?


Yes, if the goal is to restrict the results of the command to a subset of nodes from the full surface, I think you would need to get that subset of node coordinates into the -i file. For example, to get a more simple to edit surface coordinate file, the PLY format works well:

ConvertSurface -i std.60.lh.pial.gii -sv SurfVol.nii -o_ply coords.ply

The resulting coords.ply file have coordinates for the std.60.lh.pial nodes (after the little header), as 0-based row numbers. So the first coordinate would be for node 0, then node 1, ... Then extract node 20, and whatever else you want. Of course, you would have to be very careful. :)

Then if this restricted set of coordinates is in coords.1D for example, you can use the -i_vec method to read this vector of coordinates as the surface to compare with. However that needs a mesh file, which really does not matter to the program. So create mesh.1D to be a file of '1 2 3' for example, with that repeated for the same number of rows as you have coordinates in coords.1D.

Then run as:

Surf2VolCoord -i_vec coords.1D mesh.1D -closest_nodes XYZ.1D

It is a little messy, but that seems like a reasonable way to strongly restrict the surface nodes. I do not know how to do it with only nodes indices.

  • rick

Thank you, Rick! I will give this a try and get back to you.

Just to note that files that end in .gii are gifti files, but there are multiple kinds - surface, functional and label. suma can read these, but when it expects a surface (with -i or with -spec and -surf_A/B, it should be the surface type. You can generate a list of masked coordinates with 3dmaskdump, as with a volume. The command SurfaceMetrics -closest_node xyzlist.1D ... can also provide a list of the closest_nodes.