error - creating subject-specific ROI for PPI

Hello,

I’m trying to use the command below as part of a script which loops through a data directory with subject subdirectories.

3dmask_tool -inputs $ROIdir/$ROI+tlrc.HEAD full_mask.${subjID}+tlrc.HEAD -prefix $ROI.mask_inter
-frac 1.0

I want to create individualized ROis using an ROI from an atlas created by another group. Last time I did this with another ROI from an AFNI atlas, I resampled the ROI first to have the same voxel dimensions as the functional images for each participant. I’ve checked that the voxel dimensions of the ROI mask and the functional images are similar but I’m still getting this error when I’m trying to create these personalized ROIs which are the intersection of the subject functional images and the standard ROI (below at end of the output):

Thanks in advance for any help that you can give in this matter.

Best,

Aviva Olsavsky

** Program compile date = Dec 2 2018
set subjID = s21052
set ROI = rs_VTA_Adcock_mask
set ROIdir = /data2/psychology/kimlab/fmri/studies/IDEA/infantcry/joelPPI/masks
cd s21052/s21052.results
set currDir = pwd
pwd
set subjdata = /data2/psychology/kimlab/fmri/studies/IDEA/infantcry/joelPPI/data/s21052/s21052.results
3dmask_tool -inputs /data2/psychology/kimlab/fmri/studies/IDEA/infantcry/joelPPI/masks/rs_VTA_Adcock_mask+tlrc.HEAD full_mask.s21052+tlrc.HEAD -prefix rs_VTA_Adcock_mask.mask_inter -frac 1.0
++ processing 2 input datasets…
++ padding all datasets by 0 (for dilations)
** FATAL ERROR: nvoxel mis-match

Hi-

Splitting your 3dmask_tool command onto multiple lines so it is a bit easier to read:


3dmask_tool \
-inputs \
     /data2/psychology/kimlab/fmri/studies/IDEA/infantcry/joelPPI/masks/rs_VTA_Adcock_mask+tlrc.HEAD \
     full_mask.s21052+tlrc.HEAD \
-prefix rs_VTA_Adcock_mask.mask_inter \
-frac 1.0

… it seems you have two input dsets that you want to use together to make one mask. Those datasets must be on the same grid for processing.

You could check this property by running:


3dinfo -same_grid full_mask.s21052+tlrc.HEAD /data2/psychology/kimlab/fmri/studies/IDEA/infantcry/joelPPI/masks/rs_VTA_Adcock_mask+tlrc.HEAD

… where


-same_grid: Output 1 if the grid is identical between two dsets
                      0 otherwise. 
               For -same_grid to be 1, all of -same_dim, -same_delta,
               -same_orient, -same_center, and -same_obl must return 1

If you want to check the origin, orientation and voxel sizes of your dsets, you can run:


3dinfo -origin -orient -ad3 -prefix full_mask.s21052+tlrc.HEAD /data2/psychology/kimlab/fmri/studies/IDEA/infantcry/joelPPI/masks/rs_VTA_Adcock_mask+tlrc.HEAD

From the message you are getting above, I assume that your mask and ROI dsets are not on the same grid. You could resample your mask dset, for example, via:


3dresample \
  -master full_mask.s21052+tlrc.HEAD /data2/psychology/kimlab/fmri/studies/IDEA/infantcry/joelPPI/masks/rs_VTA_Adcock_mask+tlrc.HEAD \
  -prefix mask_resampled \
  -input full_mask.s21052+tlrc.HEAD \
  -rmode NN

… where the rmode option is used to specify that the integer-valued mask should stay integer-valued.

Since these dsets are both in a standardized space, apparently (from the +tlrc in their BRIK/HEAD file names), I was wondering why they might be on different grids? How was each made?

–pt

Hi Paul,

Thank you so much for your assistance!

The VTA ROI was from a recently published atlas (not through AFNI) and was a nifti format initially. I had converted the nifti file to a BRIK and resampled it to match the voxel dimensions of the functional, but had neglected to realize that the orientation would be off. Now I’ve used the functional as a master for the resample so it should all be good. Thanks so much!

Best,
Aviva

Hi, Aviva-

Being BRIK/HEAD or NIFTI format will not matter to AFNI at all-- both are valid.

The main issue is the grid (origin, orientation, voxelsize, etc.). If the ROI was defined on some atlas somewhere, then it makes sense that it would probably be on a different grid. And indeed, you could use the same 3dresample command from above–with “-rmode NN”–with the final EPI dset as the “master” reference grid to resample the ROI volume.

–pt