Hi-
(*NB: I have edited this to make the output dset names for examples C and D distinct: ‘lhipp’ and ‘rhipp’.)
The syntax for using 3dcalc is as follows:
- input a dataset with “-a …”, “-b …”, “-c …”, etc.
- then, in the mathematical expression part “-expr …”, you refer to each dataset by the letter you used to input it; for example, “-expr 2*a” would double each value in the dataset entered with the option “-a …”.
More specifically to your case, I think the ROI value associated with Left-Hippocampus is 17, and that of Right-Hippocampus is 53 (please verify these yourself!). So, you could use the following to extract each:
# Example A
3dcalc -a follow_ROI_aaseg+tlrc -expr 'equals(a,17)' -prefix lhipp -short
3dcalc -a follow_ROI_aaseg+tlrc -expr 'equals(a,53)' -prefix rhipp -short
Note that in the output, each of those datasets will be a binarized mask of zeros and ones; if you want each ROI to keep its value in the output (perhaps for being able to combine more easily later), you could use:
# Example B
3dcalc -a follow_ROI_aaseg+tlrc -expr '17*equals(a,17)' -prefix lhipp -short
3dcalc -a follow_ROI_aaseg+tlrc -expr '53*equals(a,53)' -prefix rhipp -short
That above notation works, but it can be a bit opaque because of the 17 and 53 in the expr, which don’t really have easily identifiable meaning. Instead, you could make use of AFNI selectors with the input file names, which allow you to select sub-volumes, subsets of values within volumes, or ROI label names. Please see the “INPUT DATASET NAMES” section in the 3dcalc help about details on all these.
For your case specifically, assuming the ROI labels are still attached, you should be able to use the following to extract just the ROI (note that the quotes around the selector part are necessary):
# Example C
3dcalc -a follow_ROI_aaseg+tlrc'<Left-Hippocampus>' -expr 'a' -prefix lhipp -short
3dcalc -a follow_ROI_aaseg+tlrc'<Right-Hippocampus>' -expr 'a' -prefix rhipp -short
This will produce output where each ROI has its same value as the input data set (so, like Example B, above). It just can be a bit easier to read+understand, and a bit more stable as you copy/edit/etc. code. Note that this case only works if the input dataset has a labeltable or atlas table attached (so, if you view the dset in the AFNI GUI and click on a region, do you see its name displayed in the control panel, as well as its numerical value?).
If you wanted just binarized masks in each case, then you could use:
# Example D
3dcalc -a follow_ROI_aaseg+tlrc'<Left-Hippocampus>' -expr 'step(a)' -prefix lhipp -short
3dcalc -a follow_ROI_aaseg+tlrc'<Right-Hippocampus>' -expr 'step(a)' -prefix rhipp -short
… which will provide output in the same form as Example A (please see the 3dcalc help file about what the step() function does).
–pt