parcellate rsfMRI data using Schaefer atlas

Hello AFNI experts,

I apologize if this is a naive question but I am relatively new to AFNI.

I have preprocessed some resting state fMRI data using afni_proc.py (Example #11), and now I'd like to use the Schaefer-Yeo 1000 parcel 17 network atlas (https://afni.nimh.nih.gov/pub/dist/atlases/SchaeferYeo/) to parcellate the resulting errts files to obtain the timecourses from each of the 1000 parcels for each participant.

I was hoping for a little guidance on the correct way do this, or perhaps an example of what that code/workflow might look like.

Thank you,

Paul

Hi, Paul-

The Schaefer-Yeo atlases exist in volumetric form here:
Schaefer_Yeo_MNI2009c.tgz
Note that they are in MNI-2009c space. If you followed Example 11b, were you using TT_N27 as the alignment template, instead? If that is the case... I am not sure if we have a version of these in the TT_N27. Would have to ask @dglen . (Also, might have to ask him where the 1000-parcellation is, since I don't see it in that download directory?) Also, note that the 1000-parcellation is quite fine, and so you might want to see how typically large those regions are compared to your voxels---if they are similar, I am not sure it would make much sense to use those.

Note also that Example 11b is for a voxelwise analysis, and therefore includes blurring. You probably would not want to include blurring if you are running and ROI-based analysis, because you will artificially spread information across ROI boundaries before estimating time series. Example 11b uses FS information not for ROI-based analysis, but for ventricle and WM maps for ANATICOR regressor estimation.

But to the functionality you had asked about, for when those initial issues/questions are resolved:
You will want to resample the atlas to match your final EPI data resolution. If you are doing a resting state analysis (which is what Example 11b does), then this would be your errts* file in the afni_proc.py results directory. To resample that Schaefer_7N_400.nii.gz atlas to the DSET_ERRTS file, as well as retain the label information that AFNI includes in atlases you can run:

# resample the SY-400 to the errts data, with nearest-neighbor interp
# NB: 'NN' is actually an all-caps keyword to keep in the cmd
3dresample                                                    \
    -input   Schaefer_7N_400.nii.gz                           \
    -master  DSET_ERRTS                                       \
    -prefix  sy7n400_in_errts.nii.gz                          \
    -rmod    NN

# reattach labels and other header niceties for the atlas
# NB: 'INT_CMAP' is actually an all-caps keyword to keep in the cmd
3drefit -copytables Schaefer_7N_400.nii.gz  sy7n400_in_errts.nii.gz
3drefit -cmap INT_CMAP  sy7n400_in_errts.nii.gz

You can verify that the DSET_ERRTS and new atlas are on the same grid by running:

3dinfo -same_all_grid DSET_ERRTS sy7n400_in_errts.nii.gz

... which should produce five 1s if the five examined properties all match (woe betides if that is not the case---please ping back if so).

Finally, the way I would get the time courses would be to do so as an output of 3dNetCorr, which will also calculate a correlation matrix (command below has been amended from the original post, as @pmetzak correctly noted in the reply to this message: the option I should have put here originally was -ts_out, which is now included, as that dumps out the set of average ROI time series to a text file):

  3dNetCorr                                     \
      -inset DSET_ERRTS                       \
      -in_rois sy7n400_in_errts.nii.gz        \
      -fish_z                                 \
      -ts_out                                 \
      -prefix netcorr

--another Paul

Following up on "another Paul's" comments, the Schaeffer-Yeo atlas was also made for the N27 dataset, but in MNI space, MNI_N27. If needed, we can transform that to the Talairach-version TT_N27 space.

Hi Paul and Daniel,

Many thanks to both of you for your helpful suggestions. The code that you've provided seems to be exactly what I needed.

Just as matters of clarification, I used example 11 (not 11b) from the afni_proc.py webpage so my datasets were in MNI space as well. I take your point about blurring, and I will omit that step when I re-run the analysis.

I did have one followup question about the 3dNetCorr code below. I read through the documentation and it seems that replacing the '-ts_wb_corr' flag with '-ts_out' might be a more straightforward way to get the timecourses from each ROI. Is this correct, or have I misunderstood something along the way?

Thanks again for all your help, I really appreciate it!

Paul

Hi, Paul-

Ah, great about using the MNI already.

Re. 3dNetCorr- you are exactly right, I should have put "-ts_out". I will amend that in the post above, for other people who see it. But I should have put:

3dNetCorr                                     \
      -inset DSET_ERRTS                       \
      -in_rois sy7n400_in_errts.nii.gz        \
      -fish_z                                 \
      -ts_out                                 \
      -prefix netcorr

... though you can certainly also include -ts_wb_corr, too, if that is useful (though it would create a lot of wholebrain datasets, given the number of ROIs involved).

--another Paul