AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
April 27, 2022 05:24PM
Hi, Philipp-

It sounds like you have 2 stages of alignment (conceptually: MNI -> anat; anat -> EPI). You will want to concatenate these alignments, so that you have one (MNI -> EPI). Each of these alignments appears to be affine, so the concatenation can be done with cat_matvec (and any inversion, if necessary, can be done on one or more component matrices in this program), and then the result will *also* be affine, you you would use 3dAllineate to apply it.

Note that we talk about "aligning A to B", so we conceptualize taking a point in A's space and figuring out where to send it in B's space. The way AFNI warps/alignments are actually calculated are sitting at a grid point in B and figuring out where to pull data from in A. This matters in terms of order of concatenating: think about starting in your "end" space (here, EPI) and ordering your warps by which successive pulling of data (so, would be the "anat->EPI" warp, then "MNI->anat" warp).

Second note: we often use affine registration between the EPI and anatomical data from the same subject. However, when aligning data between different subjects' anatomicals (which includes a subject brain to a standard space template), then we would typically recommend using nonlinear alignment (e.g., 3dQwarp or @SSwarper---which combines skullstripping (ss) with nonlinear warping, or @animal_warper for non-human data). That is something for you to consider. The nonlinear warps and affine transforms can still be concatenated and applied, just using different programs (actually, the 3dNwarpApply that you were using).

For the present data, you could do the following:
cat_matvec \
     -ONELINE \
     mat_MNI_to_anat.aff12.1D mat_anat_to_EPI.aff12.1D > mat_MNI_to_EPI.aff12.1D
and, if above you actually had mat_anat_to_MNI.aff12.1D, say, you could use the following to invert that:
cat_matvec \
    -ONELINE \
    mat_anat_to_MNI.aff12.1D -I mat_anat_to_EPI.aff12.1D > mat_MNI_to_EPI.aff12.1D
... and I *think* the "-ONELINE" is useful for formatting the output dset to use later.

Then, use 3dAllineate:
3dAllineate \
   -1Dmatrix_apply mat_MNI_to_EPI.aff12.1D \
   -source DSET_ATLAS_in_MNI   \
   -prefix  DSET_ATLAS_in_EPI \
   -final NN \
   -master DSET_EPI
... where "-master DSET_EPI" sets the appropriate grid for the output dset, and "-final NN" tells the program to use nearest neighbor interpolation for the final output creation, so that integers stay integer.

Furthermore, if there is a labeltable associated with the dset, you can run the following to copy its header info along (while also telling AFNI to use an ROI-based colorbar when overlaying it in the GUI):
         3drefit -copytables DSET_ATLAS_in_MNI  DSET_ATLAS_in_EPI
         3drefit -cmap INT_CMAP DSET_ATLAS_in_EPI

Please let me know how that goes, esp. verifying in the GUI that I have put things in the correct order here...
--pt
Subject Author Posted

3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

philippn April 27, 2022 03:58PM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

rick reynolds April 27, 2022 04:14PM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley Attachments

philippn April 27, 2022 05:14PM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

rick reynolds April 27, 2022 05:21PM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

ptaylor April 27, 2022 05:24PM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

philippn April 27, 2022 06:26PM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

ptaylor April 28, 2022 07:29AM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

philippn April 28, 2022 11:35AM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

ptaylor April 28, 2022 12:31PM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

philippn April 28, 2022 07:17PM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

ptaylor April 29, 2022 08:52AM

Re: 3dNwarpApply error: Warp dataset 'nwarp native_al_mat.aff12.1D' name is too much like a matrix text file moody smiley

philippn April 29, 2022 04:04PM