3dresample # of voxels

Hi AFNI gurus,

I’m using the command 3dUndump to create a 6mm sphere ROI around a xyz coord I choose. When I do this all my ROIs have the same number of voxels and same radius, yay. However, when I resample to the EPI dataset so that I can run a correlation analysis, it outputs ROIs with different numbers of voxels. Why is that? How do I make sure all my ROIs have the same number of voxels after resampling?

Also, what is the best way to deal with overlapping ROIs in 3dNetCorr?


Unless the resample step is done very carefully, it is
unlikely that the resulting ROIs would have the same
number of voxels.

If you give your resample command, along with the
original voxel sizes, maybe we can help get the
result to match. If the voxel size is not be scaled
down by an integer, that may not be possible, though.

  • rick

#create 6mm ROI around peak task activation
3dUndump -prefix task_6mmROI -master ${pnum}_Anat_bc_ns.AB+tlrc. -srad 6 -orient RAI -xyz task_peak_xyz.txt

output of 3dBrickStat -count -non-zero task_6mmROI+tlrc. is 925 voxels.

#resample task ROI to resting state data
3dresample -master pc09.${pnum}_${RUN}MEICA.spc.nii.gz -prefix resamp${RUN}_taskROI -inset task_6mmROI+tlrc.

**Again, I would like all the ROIs to have the same number of voxels. Ideally that number would be in the 100-125 range. Thanks!

On the 3dNetCorr note: it is not possible to have overlapping ROIs. You can use 3dROIMaker to inflate ROIs in a manner that they won’t overlap with each other, perhaps.


I just thought of something…

since all my xyz coordinates and my final processed EPI datasets are all in MNI space, could I create the ROI with 3dUndump directly on the EPI set? Why am I bothering to make the ROI using the anat volume and then resampling to the epi volume if all of them are in the same MNI space? That way I would probably get the same number of voxels in each ROI.


#find center of mass of subarea and output xyz coordinates to text file
3dCM -set x y z subroi_1_leftSTG.nii.gz > CM_subroi1_leftSTG.txt
#read text file into command to make 6mm ROI using epi dataset as master
3dUndump -prefix leftSTG_sub1_6mmROI -master pc09.${pnum}_rest_run1_MEICA.spc.nii.gz -srad 6 -orient RAI -xyz CM_subroi1_leftSTG.txt

Sorry, I forgot to mention that. We are busy…

In any case, even starting in MNI space, to have a consistent
number of voxels, be sure that the ROI centers are exactly on
top of voxel centers. Otherwise, the sizes might still vary,
depending on how coordinates happen to fit between the voxel

  • rick