# SUMA surface distance

For my connectivity analyses I include signal from n neighbouring voxels. To do so, I have to estimate the distance between each of the voxels within the ROI. I am using distance between voxels along the cortical surface as a measure of proximity (rather than distance in volumetric space).

Doing so, I used Surf2VolCoord to obtain nodes corresponding to voxels within the ROI

``````
Surf2VolCoord -i rh.pial.asc  -sv anat2standard.nii.gz -grid_parent example_func2standard+tlrc. -closest_nodes XYZ.1D -prefix closest_results.1D

``````

And subsequently I would be able to compute the distances between selected node pairs using SurfDist:

``````
SurfDist -i rh.pial.asc -input selected_nodes.1D > node_distances.1D

``````

However, assuming my ROI would include 400 voxels this would require a vast amount of pair-wise distance calculations to obtain distances between all voxels. Is there an easier way of doing this? Is there perhaps a way to map all nodes onto a 2d-surface-flatmap in a way that distances can be inferred from the x and y coordinates of the flatmap? Or anything else that would save me the ±80.000 pairwise distance measures per ROI?

Any advice is appreciated & please let me know is something is unclear.

Thanks,
Jasper

If you are only looking for the maximum proximity distances, you could reduce computation time by only looking at nodes on the edges of the mask.

I’m looking for the minimum distances, so nodes that are closest to the selected node on the cortical surface? In this case its not possible to do this right? Please correct me if I misunderstood your reply.

I just created a 1D file comparing each node with every other node
1 1
1 2
1 3
1 4
1 5

1 500
2 1
2 2
2 3

and reorder the obtained 25000 distance values into a 500x500 distance matrix which can be formatted (e.g. t-SNE) into a 2d flatmap. This seems computationally inefficient and a lot of information is lost in the process. If anyone would have thoughts on more directly obtaining cortical distances between all voxels within an ROI I would be happy to hear about it.

OK, I think I see then. You could initially filter the data by geometric distance. If you’re looking for nodes within a specific node-wise distance, then the geometric distance should be an approximate limit that you could use. 3dVol2surf is one way to do that. Another way is to look recursively at each node and the triangles in which they are included. Stroll out along each node to its neighbors in each triangle until the distance is greater than your distance limit and don’t allow repeats of nodes within each chain. If the data has been registered to a standard mesh, you could use the same initial mask for each subject or the same found masks.