Splitting ROI image

Hello AFNI Team,

I am trying to input ROI data from an experiment into the Sleuth application from the Brainmap database. My only issue is that the irregular ROI has too many voxels for the Sleuth application to handle all at once. Could someone reccomend a solution on how to split my original ROI image into several (ideally 4) smaller ROI’s that could be added to equal my original image? My goal is that by feeding separate, smaller ROIs into the Sleuth application, I can still get the related data I need. I understand 3dcalc may be able to help, but specific suggestions on how to approach this problem would be greatly appreciated.

Thank you,

Will Snyder

I have never used Sleuth or Brainmap, so I don’t know how chopping up your data will affect performance of the tool.

Two ideas that come to mind:

  1. if you know where your region is, you could use 3dcalc commands with i,j,k or x,y,z values to divide the brain into quadrants, and then select those. In the following, the “i”, “j” and “k” letters are literally those, but you would have to put in some number values for X0 and Y0, which would represent (integer) slice numbers:

3dcalc -a ROI_SET -expr 'a*step(X0 - i)*step(Y0 -j)' -prefix my_ROI_01.nii.gz
3dcalc -a ROI_SET -expr 'a*(1-step(X0-i))*step(Y0 -j)' -prefix my_ROI_02.nii.gz
3dcalc -a ROI_SET -expr 'a*(1-step(X0-i))*(1-step(Y0 -j))' -prefix my_ROI_03.nii.gz
3dcalc -a ROI_SET -expr 'a*step(X0-i)*(1-step(Y0 -j))' -prefix my_ROI_04.nii.gz

… and be sure to check visually3dcalc-ically that all parts are accounted for, i.e., the sum of these gives your original set. This would involve knowing the center of mass of your ROI, probably, for putting X0 and Y0 values that are useful; you could get that with 3dCM.

  1. You could make a random data set of four values, and then assign those overlaps to carry your volumes:

# Makes a data set of size ROI_SET whose integer voxel values are uniformly sampled from the inclusive interval [0..3]. 
3dcalc -a ROI_SET -expr 'iran(3)' -prefix RANDOM.nii.gz -overwrite
# now use those to parcellate the dset/region:
3dcalc -a ROI_SET -b RANDOM.nii.gz -expr 'a*equals(b,0)' -prefix my_ROI_01 -overwrite
3dcalc -a ROI_SET -b RANDOM.nii.gz -expr 'a*equals(b,1)' -prefix my_ROI_02 -overwrite
3dcalc -a ROI_SET -b RANDOM.nii.gz -expr 'a*equals(b,2)' -prefix my_ROI_03 -overwrite
3dcalc -a ROI_SET -b RANDOM.nii.gz -expr 'a*equals(b,3)' -prefix my_ROI_04 -overwrite

The benefit of this method is that your regions should be roughly the same sized by random luck (theoretically), regardless of your data set’s placement in space. Also, you don’t need to know its center of mass. (And again, you should doublecheck that everything went well by summing up your parcels and subtracting the result from the original, making sure that you get zero everywhere.)

Again, how either method could affect your output results, I have absolutely no idea.

–pt

Thank you so much for that thourough response!

The as long as subtracting the resultant ROIs from my original ROIs gives all zeros, both of these methods should lead me to the same end data in the Sleuth application. I’ll be trying both out soon, and I very much appreciate the help.

Thanks again,

Will Snyder

According to their documentation, you are limited to 5000 voxels.


ROIs  must  be  formatted  as binary  NIfTI  (http://nifti.nimh.nih.gov)  images 
with  1x1x1  mm3 resolution,  and  the  ROI  must  not  extend  across  more  than  5000 voxels.

That’s not a lot of voxels at anatomical resolution, but it may be useful at EPI data resolution. Consider resampling ROIs to a lower resolution with 3dfractionize or 3dresample. Also “3dAutobox -noclust” can be used to limit the dataset, even the zero voxels, to the smallest box that contains the ROI.