Hi AFNI team,
I was runing SurfClust on a flat map to extract cluster information from a dataset and got the following errors:
++ Notice SUMA_Make_Edge_List_eng (SUMA_MiscFunc.c:7799 @11:47:44):
Min/Max number of edge hosting triangles: [1/2]
You have edges that form a border in the surface.
Fatal Signal 11 (SIGSEGV) received
SUMA_Build_Cluster_From_Node_NoRec
SUMA_FindClusters
SurfClust
Bottom of Debug Stack
** AFNI version = AFNI_19.3.18 Compile date = Dec 27 2019
** [[Precompiled binary macos_10.12_local: Dec 27 2019]]
** Program Death **
** If you report this crash to the AFNI message board,
** please copy the error messages EXACTLY, and give
** the command line you used to run the program, and
** any other information needed to repeat the problem.
** You may later be asked to upload data to help debug.
** Crash log is appended to file /Users/lingyan/.afni.crashlog
This is the command I used:
SurfClust -i ./$hem.full.flat.patch.3d.gii -input /Volumes/bcm-neuro-yau/data/Shoaib/TacFreqEnc/volume_lw/full/${subj}/fs/SUMA/${dname}${hem}final.niml.dset 0
-rmm -1.000000 -thresh_col 0 -athresh 0.000000 -amm2 30.000000 -sort_area -no_cent -prefix ${subj}${dname}${hem}_flat_node -prepend_node_index -out_roidset
I suspect the reason is that I have some clusters on the edge of the map…How can I solve this?
Thank you!
I would try visualizing the dataset to see if that is the case.
I guess I would also not use a flatmap for the clusters, if they were created on a non-flat map. I am not sure what it would mean to move from a closed hemisphere to a flat-map—the topology would be broken at the boundary.
–pt
Hi pt,
Thanks for the reply.
I checked the flat map and it seems broken boundaries are the reason.
I have to use a flat map because I need to calculate the Euclidean distance between different nodes within a cluster. If it’s not a flat map, such as a inflated one, the euclidean distance calculated between different nodes from x,y,z are not accurate.
If there is no other way in fixing this, I think the only thing I can do might be to making the cuts in a different way that avoid the clusters…would you agree? I was following this tutorial to create the flat map: https://openwetware.org/wiki/Beauchamp:FreeSurfer
Howdy-
So, my first thought would be that calculating distance along the ‘anatomical’ surface would be a great way to go, being both physiological and avoiding the arbitrariness of cutting, but I am sure you have reasons for wanting Euclidean distance on the flat map.
I guess I would wonder if you can first make the flat map and then clusterize, rather than the other way around? The cutting will still be a problem because something that should be 1 cluster (and hence essentially 0 distance from itself) can end up getting chopped and then artificially be very far away (because of the cut+flattening).
Even if you avoid cluster cuts, where you cut will affect your final distances, I believe. Can I ask what you plan to do with the Euclidean distances?
–pt
Hi pt,
Thanks for your input.
My research needs to do a topography analysis:
within each cluster, I calculate the feature distance and Euclidean distance between pairs of nodes and try to identify if there is a relationship between a physical map and a feature map. In this way, this flat map distance, which should correspond to surface distance, is more appropriate than the anatomical map in a 3D brain. I’m actually doing the thing you suggested: create the flat map first and project my data to the flat map…and some clusters got cut into halves.
What do you mean by ‘calculating along the anatomical surface’? It sounds like the same thing I’m trying to do but I don’t know how to directly calculate the surface distance without flattening it into a flat map.
So for my analysis, the inter-cluster distance doesn’t matter, what matters is the nodes’ relative position to each other within a cluster. The only reason I’m proposing the avoid-cluster cuts is because it will cause the error and I couldn’t run surfclust.
Howdy-
By ‘calculating along the anatomical surface’ I mean keeping the mesh looking like the subject’s anatomical brain, but taking the shortest route of edges between any 2 nodes on it, and summing up the distance walked along the edges, and that is your distance. This can be done with the SurfDist program, which would calculate the anatomical distance between nodepairs along any surface:
SurfDist
Usage: SurfDist [OPTIONS] <SURFACE> <NODEPAIRS>
Output shortest distance between NODEPAIRS along
the nesh of SURFACE, or the Euclidian distance.
To me, this seems the most meaningful way to calculate distance between two nodes, involving the surface.
This AFNI Academy video shows a bit more about using the program, with scripts (linked under the video description/outline); some of the parts of the demo might not apply.
I am not sure I follow why this would be the case: “In this way, this flat map distance, which should correspond to surface distance, is more appropriate than the anatomical map in a 3D brain”. Isn’t the way the flattening is done somewhat arbitrary, as well as the cut? Why wouldn’t the distances along the anatomical surface be more appropriate?
–pt
Hi pt,
I think you’re right! This is exactly the thing I’m looking for! I didn’t know this exist and thought distance of node pairs on a 3d brain is the x,y,z euclidean distance.
Can you send the link of the video? You mentioned a video but I didn’t find it in your post.
Thanks so much – this is very helpful!
Whoops! Sorry to have forgotten the link.
I meant this video:
[AFNI Academy] Surface distance examples: interactive and driving SUMA
https://www.youtube.com/watch?v=XEQqz9EKVhE&list=PL_CD549H9kgqSs51SCNZQ4q57IguXvFI8&index=7
Glad that sounds useful.
–pt
… and, actually, if you haven’t seen the AFNI Academy online, this might be worth browsing:
https://www.youtube.com/c/afnibootcamp
–pt
Hi pt,
Sorry that I have another question about this.
Calculating the distance is just one analysis we’re doing. Another analysis we’re trying to do, and this might actually requires a flat map:
We want to put the interested voxels within a cluster into a flat map and average the feature values through different axis that go through the center of the cluster.
I think this could only be done on a flat map. If this is the case, do you have any suggestions on the error I encountered at the beginning?
I think I might need a better picture of what is going on. You mention “voxels”, but we are on a surface, so those don’t exist here.
Are you projecting voxels from the volume onto the surface? And when you say “center of the cluster”, do you mean the center on the surface, or volumetrically?
Let’s say you are interested in the center of a cluster on the surface—you define the central node in the cluster on the surface. You also have a set of edge nodes. Why not calculate the path from each edge node to teh central node on the non-flatmap? I don’t see why the flatmap would be necessary—indeed, the arbitrariness of flattening would still be a problem. I think you should be able to find the geodesic path from each edge node to the central node. I am not sure why a flat map would be preferable.
–pt
Hi pt,
The main reason for not using a non-flat map in this analysis is I need to settle the relative direction of each node to the cluster center.
But anyway, I found a way to solve the problem: I use the cluster info from a closed map and only use the coords from the flat map.
Thank you so much for your help, it was really useful advice!