How to extract values from surface ROI

Hello,

I want to do some resting state analysis based on surface data.
I have mapped data from a volume domain to surface domain and drawn several ROIs on surface. I’m wondering 1) which commands I can use to extract the timeseries from each ROI and 2) if 3dDeconvolve can be used for the correlation analysis between two surface ROIs.

Thanks in advance.

You would use ROI2dataset to convert the ROI into a dataset (usually niml or 1D formats) and then 3dmaskave, 3dmaskdump and 3dcalc to process the datasets. See an example here:

https://afni.nimh.nih.gov/afni/community/board/read.php?1,162716,162730#msg-162730

Thank you very much for the reply!
I tried to follow the example but met some errors. From my understanding, when using 3dmaskave, the mask (ROI dataset) and input (resting fMRI dataset in my study) should have the same size. So, I checked the size of resting data and used it for -pad_to_node.

After running the command “ROI2dataset -label_dset surfROI_lv1.niml.dset -pad_to_node 135170 -overwrite -input surfROI_lv1.niml.roi” , I got

ROI2dataset: Adopting Parent_idcode_str (AFN_U28lct8gSjxH-44gCdqHGA) in ROI l_v1
++ Notice SUMA_ROIv2Grpdataset (SUMA_Surface_IO.c:6524 @20:09:54):
Have 1/1 new entries in colormap
– Error SUMA_ROIv2Grpdataset (SUMA_Surface_IO.c:6586):
ROI contains node index > padding limit
No padding done.
– Error ROI2dataset (SUMA_ROI2dataset.c:463):
Failed in SUMA_ROIv2Grpdataset

And when I tried the command on ROI of the other hemisphere, I got:
ROI2dataset -label_dset surfROI_rv1 -pad_to_node 135446 -overwrite -input surfROI_rv1.niml.roi
ROI2dataset: Adopting Parent_idcode_str (AFN_LOuSRAUTEdI-NTdTZv-G0g) in ROI r_v1
++ Notice SUMA_ROIv2Grpdataset (SUMA_Surface_IO.c:6524 @22:59:14):
Have 1/1 new entries in colormap
– Error SUMA_IsCmapOKForLabelDset (SUMA_Color.c:4273):
Have 2 unique values,
have no colormap big enough for this
– Error SUMA_CreateCmapForLabelDset (SUMA_Color.c:4223):
Provided cmap is no good
– Error SUMA_dset_to_Label_dset_cmap (SUMA_Color.c:4321):
Failed to add colormap
– Error ROI2dataset (SUMA_ROI2dataset.c:496):
Failed to make change

Is there something wrong with the node size I used?
I used SurfDsetInfo to check the information of resting dataset, the output is as follows:

Info for dset ( 1/ 1): /media/vpp/DATA/lh_vol2surf.smoothed.niml.dset

Dset 0x2e9c928, datum level 0 (0…3 possible)
Number of Links: 0
Dset Name: SPARSE_DATA (-1), isGraph 0, isCIFTI (MultiDomain)0
filename: /media/vpp/DATA/lh_vol2surf.smoothed.niml.dset
label: /media/vpp/DATA/…
self_idcode (idcode): AFN_qw3ySzam3j5psu0ZyVjJXA
geometry_parent_idcode:
domain_parent_idcode (MeshParent_idcode):
Node Index (NodeDef) Element:
inel->vec_len = 135170
inel->vec_num = 1
inel->vec_filled = 135170
Node Index Column found.
sorted_node_def: Yes
0, 1, …, 135167, 135168, 135169
Saux: (nil)
matrix_shape: -1matrix_max_index: 0, matrix_size: 0 0, matrix_2M: range_edge_index: 0 0, range_node_index: 0 0
N_seg_nodes: 0, N_all_nodes: 0
0 domains:
dset->Aux->doms is NULLData Element:
dnel->vec_num (N_subsets): 298
dnel->vec_filled (N_NodeDef): 135170
dnel->vec_len (N_Alloc): 135170

Try using a pad_to_node index that is 1 less than the number of nodes. We use a zero-based counting system, so that probably explains the difficulty. In this case use “-pad_to_node 135169”

Thanks for the reply, but it doesn’t work.
I have tried [node size - 1] and many other index values.
As long as the index value is larger than the max index of ROI, there always

– Error SUMA_IsCmapOKForLabelDset (SUMA_Color.c:4273):
Have 2 unique values,
have no colormap big enough for this
– Error SUMA_CreateCmapForLabelDset (SUMA_Color.c:4223):
Provided cmap is no good
– Error SUMA_dset_to_Label_dset_cmap (SUMA_Color.c:4321):
Failed to add colormap
– Error ROI2dataset (SUMA_ROI2dataset.c:496):
Failed to make change

What can I do to deal with "have no colormap big enough for this " ?
Thank you very much!

I’m not seeing these kinds of problems. Can you send me some data to look at this more closely?

Sure. How can I send the data to you? By email ?

I’ve PM’ed you upload instructions.

I have uploaded a file named Dong.tgz. Thanks for the help.

Sorry for the delay. There are some problems with this combination of options, -label_dset and -pad_to_node, and I got help from Rick Reynolds on this. The easier workaround is to use “-prefix” instead of “-label_dset”. You won’t have labels in the output, but if that doesn’t matter, then this should work. Alternatively, you can pad separately with ConvertDset -pad_to_node. Keep in mind, for now, for the label_dset option, all regions should have label names.