Preserving ROIs after warp

Hi,

I am using 3dUndump to create 66 spherical ROIs at various coordinates with the following command:

3dUndump -prefix Targets_MNI.nii -master T1_allineate_Q.nii -xyz coords.txt

After, I am trying to apply the inverse of warping the subject’s T1 to MNI space to get the ROIs in subject space:

3dAllineate -prefix T1_allineate.nii -base MNI152_T1_2009c+tlrc. -source anat_brain.nii -twopass -cost lpa -1Dmatrix_save anat_brain.aff12.1D -autoweight -fineblur 3 -cmass
3dQwarp -prefix T1_allineate_Q.nii -blur 0 3 -base MNI152_T1_2009c+tlrc. -source T1_allineate.nii
3dNwarpApply -prefix Targets_subject.nii -nwarp ‘INV(T1_allineate_Q_WARP.nii) INV(anat_brain.aff12.1D)’ -interp NN -source Targets_MNI.nii -master T1_allineate_Q.nii

The alignment of the T1 to the template looks great but when I warp the set of ROIs, some are missing. I start with 66 points and end up with around 57. I need to retain all 66 ROIs so I was wondering if anyone has an idea about why this is happening and if there is a way to prevent it.

Thanks,
Brady

Hi, Brady-

My guess is that some are being squashed into oblivion by the regridding in some cases. That is, by applying the NN interpolation when applying the warp, you are preserving the integer values in your data set. However, it looks like your Undump “ROIs” are just individual voxels: in the case that the warping process leads to a contraction of the source grid, your individual voxel might get “outweighed” by surrounding zero voxels when regridding.

One thing you could do is not apply the “-interp NN” in the 3dNwarpApply command-- that would get rid of your integer-values in the output dset, but you will probably still see some nonzero value for each ROI. You could then use 3dExtrema to make a binary map of all the local maxes-- basically, finding the peak location of your non-integer, mapped ROIs. If your ROIs aren’t too close together (so that 3dNwarpApply doesn’t warp them into each other), that could should work? This way of proceeding assumes that each ROI was just a ‘1’ value, because you would lose the identity of different integers.

–pt

Also consider warping the coordinates around which you put the original spheres. Use 3dNwarpXYZ to warp those coordinates. Then create the spheres with 3dUndump at those locations in native space instead. The 3dUndump typically needs a -srad option to create spheres.

Ah, this 3dNwarpXYZ usage seems a much easier solution than the one I suggested.

–pt

Both are perfectly acceptable answers and work fine. For my purposes, it does seem 3dNwarpXYZ is more straightforward.

As always, your help is much appreciated!
Brady