Help with regress_ROI - Imported Mask

AFNI version info (afni -ver): Version AFNI_24.2.01 'Macrinus'

Hi, I think I'd like to endeavor how to figure out how to convert my previous per-processing commands to afni_proc.py.

But prior to that I'd like to understand better regressing out time series of a mask average. I have a manually segmented mask I'd like to import to use.

Question 1: Using afni_proc.py, it appears '-regress_ROI' does this. But I read in the documentation:

        Other ROI labels can come from -anat_follower_ROI options, i.e.
        imported masks.

      * Use of this option requires either -mask_segment_anat or labels
        defined via -anat_follower_ROI options.

But it's not clear to me how to implement this with the function. But let's just say I only wanted to do the regression with afni_proc.py, I imagine it's something like the following, but not sure what else to add (with this desired mask to use: $AnimalID/$FolderID/MaskFile+orig):

 afni_proc.py                                  \
            -subj_id                 $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box+orig  \
            -blocks                  regress \
            -regress_ROI       ???  \
            -anat_follower_ROI  ???

Question 2: If the mask had multiple label values in it, can I specify which value of the mask to use?

Happy to answer any questions to clarify.

Cheers,
Edwin

Hi Edwin,

That mask could be passed via -anat_follower_ROI with your choice of LABEL (pizza_roi for example) and have it resampled onto the epi grid. Then applied for regression:

-anat_follower_ROI pizza_roi  epi   $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box+orig
-regress_ROI       pizza_roi

I expect there is much more you would have afni_proc.py do here, so these options could be added to the rest.

  • rick

Thank you very much Rick. I wasn't sure how the label was being used but now I see it's just used to call for other options.

As a follow up, let's say the mask had values of 1's and 2's in it, but I only wanted to use the values equal to one. Is it possible to reference the regress_ROI to use only values equal to one?

And yes, there is more I do. Currently, I have been doing things with individual commands (e.g. 3dDespike, 3dvolreg, 3dTproject). I would like to get some help transferring my current preprocessing protocol to afni_proc.py.

Should I ask here or start a new question thread?

That is a good question. -regress_ROI treats the dataset like a mask, treating all non-zero values as included, while only zeros are excluded. Alternatively, if the ROI label is passed to -regress_compute_tnsr_stats, then each ROI gets its own stats. So those options are different in that regard. But handling separate ROIs for regressors seemed a bit messy, especially since there should not be many such ROIs, so it is just a single mask in that case.

It is up to you in terms of the MB threads. Certainly, they are nicer when they don't get too long, so it might make sense to keep them separate. But if some are very short, putting them together should be fine. Of course, that can be hard to predict.

Thanks,

  • rick
1 Like

Hi Rick,

One last follow up; let's say I wanted to just do a regressing protocol with the function afni_proc.py, I would need to do something like the following:

afni_proc.py                                  \
-subj_id                 $AnimalID  \
-dsets                    $AnimalID/$FolderID/${AnimalID}_${FolderID}.DS.Box_al+orig \
-blocks                  regress \
-anat_follower_ROI mMask  epi   $AnimalID/$FolderID/MMASK_${AnimalID}_${FolderID}.Box.Mean+orig \
-regress_ROI       mMask

Just want to confirm that the data set I call along with 'anat_follower_ROI' is the actual mask data set. But I also need to initially call the EPI data set also, correct?

EDIT: I just ran this and it seemed to work. But it gave a proc.{ $AnimalID} file.

  1. So I need to also add '-execute' at the end of this to actually run the regressing?

That is right, either add exec or just run the proc script yourself:

tcsh -xef proc.$AnimalID 2>&1 | tee output.proc.$AnimalID.txt

And yes, the EPI data is always needed for an analysis.
Note that "anat_follower" means apply all transformations that would bring the anat into final EPI space to the follower. The _ROI aspect of it means to use nearest neighbor interpolation, so the values do not change. But in this case, there are no transformations, since registration is not included.

  • rick