alignment of "raw" cross-modal data in AFNI


Potentially “heady” in the header sense question for you.

At the scanner, on the same scout scan, we Rx two scans. One is a high-res SPGR and the other is an oblique slab of dynamic T1s. When we get back to the lab we convert the data to NIFTI via either dcm2niix or dimon and then overlay the oblique T1 scan on the SPGR in the AFNI viewer. We note that the oblique T1 is cattywampusly overlaid on the SPGR and then we do much 3dAllineating per Peter Molfese’s fine advice and then things line up pretty well. The issue is that we have a very sensitive and finicky measure of blood-brain-barrier permeability that gets perturbed by the interpolation. We’d prefer just to align images by hand the old fashioned way. To do this better and more efficiently, we’d like it if the overlay and underlay started within the ballpark of one another. We note that the alignments looks close to decent when we view via MRIcronGL relative to AFNI (see attached pic). We assume that AFNI can perform similarly but that we need to set an environment variable to get AFNI read and act on alignment information in the nifti headers. Care to point us in the right direction?

Tusen tack från sverige…


Hi Paul,

The afni GUI preserves original data values, and as such, currently, will not apply an oblique transformation to a dataset for viewing (it truncates to the nearest cardinal grid). If you want to actually warp the oblique data and sample it on a cardinal grid, consider something like:

3dWarp -deoblique -prefix dynam.resam dynam.raw+orig

Another option would be to warp the underlay to match the oblique overlay:

3dWarp -card2oblique dynam.raw SPGR.raw+orig

In any case, I would not try to align them by hand, unless you do not care to be precise. Note that will apply the obliquity when attempting to align the volumes. Also note that has options for partial coverage (-partal*).

  • rick

I would take Rick’s advice (as usual), and go with one of the two options he provided. includes something like the second command as part of alignment between two datasets to use the obliquity info, and you can use to move the larger dataset to the smaller oblique dataset. Also see this page on a quick overview of obliquity.

Hi Gents–

I’m very with you in spirit here and I think this is a step forward but something turned out funky with the implementation. Mind taking a look?

Original volume = t1_dyn_contrast_volreg_ave.nii

Command = 3dWarp -deoblique -prefix t1_dyn_contrast_volreg_ave_DO.nii t1_dyn_contrast_volreg_ave.nii

See picture for pre and post (dyn_contrast_volreg_ave.nii on the left and t1_dyn_contrast_volreg_ave_DO.nii on the right).

It looks like your anatomical dataset is also oblique, so doing just that won’t get you where you want to be. Use the “3dWarp -card2oblique” with the other dataset as your target obliquity. The result should look right in the AFNI viewer.

This did the trick, Daniel. Thanks much!