AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
February 18, 2023 10:06AM
Hi,

thank you for your scripting suggestions, much appreciated.
Let me provide some further background to answer your question.

The input ROIs stem from the 1000 parcellation Schaefer-Yeo 17 networks recently updated by you guys:
[afni.nimh.nih.gov]
[afni.nimh.nih.gov]

My aim was to use the 1000 parcellations, and then to individually combine the single ROIs/parcellations into the 17 networks. There are a couple of textfiles in one of the folders from the second link above. For example, the textfile "atlaslabels_17N_1000.txt" lists all 1000 ROIs/parcellations and shows to which of the 17 networks they belong.

This is the whole rationale for what I am trying to do here, and in fact, it worked now. I solved the problem as follows. Within my script, I defined conditionals using if.

if [[ $network == VisCent ]] then
array1=1..34
array2=501..539
elif [[ $network == VisPeri ]] then
array1=35..66
array2=540..568
and so on...

Then, I ran a for loop, including all 17 network names. In this four loop, the relevant part for 3dTcat looks as follows:

# Concatenate zero dataset with rois
3dTcat \
-prefix Temp.nii \
Zero_dataset.nii \
$directory_rois/{{$array1}.nii,{$array2}.nii}

This worked well. I skipped the last step (step 4) suggested by P. Molfese. More precisely, I did not run 3dcalc again in the end. All I now did was:
1. 3dcalc: Create a zero dataset using 3dcalc.
2. 3dTcat: Concatenate the zero dataset with the specific ROIs one wants to combine.
3. 3dTstat: Assign number to the single ROIs

Concerning your question: the output masks or ROIs show different values: 0 for black areas (background), different numbers (such as 1, 2, 3 or 20, 21, 22) depending on the single ROIs that were combined to create one network.

As far as my understanding goes, that should be fine, correct? Hence, the step number 4 (using 3dcalc to transform the 17 network .nii files that I created back to a byte type is not really required, or is it)?.

By the way:
I am using
{{$array1}.nii,{$array2}.nii}

because I wanted to combine the left and right hemisphere parcellations together into one network. However, the parcellations start with the left hemisphere for all regions, and then the list continues with the right hemisphere regions.

This is the reason why a continous code, such as {1..50}, does not work. For example, I have to combine the regions of the left hemisphere {1..50} with the ones of the right hemisphere, say {90..130}, from the same network. Does that make sense? This lead to the discussed problem above. And this is everything I basically wanted: (1) creating the 17 networks out of the 1000 parcellations; (2) combing the left and right hemisphere rois, so that overall, only 17 networks (ROIs) remain.



Edited 2 time(s). Last edit at 02/18/2023 10:31AM by Philipp.
Subject Author Posted

How to combine many ROIs (+60) into one ROI?

Philipp February 18, 2023 02:36AM

Re: How to combine many ROIs (+60) into one ROI?

rick reynolds February 18, 2023 09:43AM

Re: How to combine many ROIs (+60) into one ROI?

Philipp February 18, 2023 10:06AM

Re: How to combine many ROIs (+60) into one ROI?

Daniel Glen February 21, 2023 11:53AM