Hi-
A couple things:
A) I don't fully understand what you are doing in this step, but when has *that* stopped me from giving advice about something??
B) we recommend not using "*rank*" files from recon-all/@SUMA_Make_Spec_FS output. Precisely because those numbers might not be constant
+ renumbered data sets output, to replace old '*rank*' file data
sets. Also new tissue maps based on FS functions and
labels. Collectively, these are the '*REN*' dsets in the output
directory. (Rank dsets are no longer output by default, from
Nov, 2019; instead, use -make_rank_dsets if really needed.)
Is your AFNI version quite old to even still be making "*rank* datasets (what is "afni -ver"?)? At present, you need to specify an option to get those output, which we do not really recommend (for aforementioned stability reasons).
The *REN* dsets are most stably numbered, and there are even some free partitioning of ROIs into tissue types. You should use those.
C) You mention "once you resample you lose the region name information". I assume this is referring to the fact that the labeltable disappears from the output dataset, if the input one had it? That may be the case, but you can re-attach it, with:
3drefit -copytables DSET_ORIG_WITH_TABLE DSET_NEW_WITHOUT_TABLE
Then, you can use the labels to select ROIs again. Similarly, this command could also attach an existing labeltable to a file:
3drefit -labeltable NAME_OF_TABLE DSET_NEW_WITHOUT_TABLE
D) If you describe a bit more your code and what you want to get out, we might be able to help streamline this a bit more.
--pt