Hi Jen,
In order to script this, you need to be able to expect
the names of things like ROI datasets, or at worst,
request them from the command line. Reasonable data
organization is basically a requirement for being able
to script things easily.
And since we cannot really see all of your files (and
perhaps we would not want to :), we cannot say exactly
how to proceed.
One option would be to make a list of subject IDs and
corresponding masks. Then your script could walk
through those lists to retrieve the data.
But all of those ROIs and "path to" entries in the
3dROIstats command need to be predictable.
Otherwise, you could even just copy those datasets
to a new location and give them useful names.
- rick