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:
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?
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:
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!
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
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
26.0
0.0
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!
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?
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:
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.
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.
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.