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