I'm trying to extract all ROIs from the AICHA atlas using the 3dcalc command.
and because I don't feel like type all ROIs one by one; I'm trying to loop that in with this command: (and for now trying only with one of them say the third ROI)
#for i in [1..384]
i = 3
3dcalc -a AICHAJoliot2015_space-MNI152NLin6_res-2x2x2.nii'<['$i']>' -expr 'a' -prefix ROI/ROI$i
My problem is that with the way I set it up , it can find the file because want I want to use:
We don't have exactly that syntax. The range selector you want is between the "less than" and "greater than" angle brackets. The square brackets are used to specify volume indices instead. If you want only data with a value of 3, then you would use "<3>". If you wanted both 3 and 7, then you might use "<3,7>". A range of values can be specified too "<3..24>". BTW, atlases or other labeled datasets in AFNI can have specific labels for each value, and those can be specified by their labels too, e.g. "". Volume numbers go in the square brackets - get the third volume (0-based) with "[2]". It's easier to put the quotes with something like this:
3dcalc -a ~/Downloads/AICHA.nii"<$i>" -expr a -prefix testroi$i.nii.gz
BTW, there may be a more recent version of that atlas online.
Just to note, the single quote probably blocked the intepretation of the $, depending on the shell being used.
--pt
1 Like
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.