Adding sulci images

Hi AFNI team,

I have a unique issue and I was wondering if I could have some guidance with how to approach it with AFNI’s tools.
I am trying to create a probabilistic atlas of certain sulci I am interested in, and have been able to create NIFTI files with each subject’s binary representation of the sulci (i.e. the location of the sulci have a voxel value of 1). From here, the next step would be to add all the subject’s sulci maps together so that the resulting map (the addition of the binary images) is a heat map with greatest intensity where the sulci are most prominent. The subjects were all normalized and the sulci should be in the same space, however the program I am using (BrainVISA morphologist) will output each subject’s sulci map with slightly different dimensions (e.g. 161x198x161 versus 162x200x158). I’m not sure why the program does this (possibly it restricts the image to just where the sulci are, so the dimensions are reflective of subject specific extents of sulci), but as you can imagine, this makes this heat-map/addition procedure much more complicated. Sulci maps are not too informative relative to full structural T1 scans, so affine transformations and registering each sulci map to a reference image may create issues. Any suggestions on how I may approach this issue while retaining an accurate resulting heat map would be greatly appreciated and will be of great help to my project.

Best,
Will Snyder

Hmm, you should be able to:

  • 3dresample the individual volumes to the same “master” grid (-> assuming the “x, y, z” values are still correct in the oddly-gridded dsets):

3dresample -master DSET_ON_GOOD_GRID -prefix OUTPUT -input ODD_GRID_FILE

I don’t know if you also want to do this, then, to combine all your masks, but:
if you want to combine all the ROIs into a map where the location of each has a separate integer (assuming they don’t overlap):

  • 3dTcat the new volumes into a single 4D dataset:

3dTcat -prefix aaa.nii.gz  DSET1 DSET2 DSET3 DSET4 .....

  • Make a mask of where all the nonzero values are across all your dsets (this is not binary, but it will suffice):

3dTstat -abssum -prefix aaa_nonzero.nii.gz aaa.nii.gz

  • and then use 3dTstat again to make a map of the ROIs, where each voxel’s value is the index+1 of the volume that is nonzero at that location:

3dTstat -argmax1 -prefix aaa_map_rois.nii.gz -mask aaa_nonzero.nii.gz aaa.nii.gz

That is, once you’ve concatenated the dsets, each ROI sits in a volume with index “i”; the above command will make a new dset whose value is “i+1” wherever an ROI exists. If your ROIs overlap, then this might not be the way to go, because you would likely want a better way to select which value gets assigned to a voxel than being later in the concatenated list.

-pt