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 09:43AM
Hi Philipp,

What are the current values in the ROIs, and what would you like the values in the output to be? The 2 expected cases are either 0/1 or 0/VALUE (for input, say), where VALUE is perhaps an ROI index. Then the output might be either 0/1 or 0,...,MAX_VALUE, where MAX_VALUE would either be the number of ROIs or perhaps even some larger number, where ROI IDs are not necessarily 1,2,3,...

We could probably give good ways to go with these, but for a precise answer, it would help to know what the inputs and outputs are.

Also, this might be easier if you used zero-padded naming, such as 001.nii, 002.nii, ..., 010.nii, ..., 100.nii. That would enable use of wildcards, rather than having to fight with {} and counting syntax. But still, either should work.


Note that doing this ir problematic, since the first line will make $array already filled with spaces. But you want $directory_rois attached when it expands:

array=({1..100}.nii {150..300}.nii)
3dTcat -prefix Temp Zero_dataset+tlrc $directory_rois/$array

So instead, consider the more direct:
3dTcat -prefix Temp Zero_dataset+tlrc \
   $directory_rois/{1..100}.nii $directory_rois/{150..300}.nii

Alternatively, you can use an $array variable, but it should not be initially evaluated, and having a space in it is problematic. So 2 vars would help:
a1='{1..100}.nii'
a2='{150..300}.nii'
3dTcat -prefix Temp Zero_dataset+tlrc  \
   `eval echo $directory_rois/$a1`     \
   `eval echo $directory_rois/$a2`

Ugly, but it should work.

And lastly, if the filename were zero-padded in the first place, it might be as simple as:
3dTcat -prefix Temp Zero_dataset+tlrc $directory_rois/*.nii

But to be sure, it would be nice to know about the values in the input and output.

- rick
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