as promised in my last thread "3dNwarpApply error: Warp dataset ‘nwarp native_al_mat.aff12.1D’ name is too much like a matrix text file " and encouraged by ptaylor I would be happy to discuss nonlinear registration of my data set. As you can see from the attached image “ROI_alignment_comp” the affine transformation was not successful - the red circle (manually drawn) is where the ROI should be after transformation and the blue patch is where the region actually is. Following is my plan and a description of my data:
I want to use several ROIs from an atlas that depict nuclei in the brainstem, hence it is necessary to transform the ROIs from the atlas via a T1 structural image to native (subject) space that looks similar to a T2 contrast. The caveat is that the native space image is high resolution but only covers a relevant part of the brainstem as can be also seen in the attached image.
The atlas is in MNI space with 1x1x1 mm resolution (MNI152_T1_1mm).
The individual T1 anatomical has 0.7x0.7x0.7mm resolution
The target native space has 0.4x0.4x0.4 mm resolution (but only covers a part of the brainstem)
I took a first step with 3dQwarp and 3dNwarpApply but the results were not satisfactory.
In more detail, I conducted the following steps (also following the SAMPLE USAGE ~1~ in the help file AFNI program: 3dQwarp):
3dWarp -overwrite -quintic -deoblique -prefix anat orig_T1_UNI-DEN.nii.gz
3dWarp -overwrite -quintic -deoblique -prefix target_native mtc.nii.gz
3dWarp -overwrite -quintic -deoblique -prefix mni MNI152_T1_1mm.nii.gz
3dUnifize -prefix anat_U -input anat+orig
3dSkullStrip -input anat_U+orig -prefix anatT1_U_brain -niter 400 -ld 40
#Linear registration of the target_native space to the anatT1 image
align_epi_anat.py -overwrite -dset1 target_native+orig. -dset2 anat_U+orig. -dset1to2 -partial_axial -dset1_strip None -dset2_strip None -edge -cost lpa
#Affine registration of the skullstripped anatT1 to MNI space
3dAllineate -prefix anatT1_to_MNI -base mni+tlrc -source anatT1_U_brain+orig. -twopass -cost lpa -1Dmatrix_save anatT1_to_MNI.aff12.1D -autoweight -fineblur 3 -cmass -twobest MAX -source_automask
As can be seen in the attached pic “transformation_steps”, row A, there is some deviation.
#Nonlinear warping of the affine transformed anatT1 to MNI space and saving the inverted warp field for later
3dQwarp -prefix QA_anatT1_to_MNI -blur 0 3 -base mni+tlrc -source anatT1_to_MNI+tlrc -iwarp
As can be seen in the attached pic “transformation_steps”, row B, the deviation is reduced but not gone.
Inverting and concatenating the transformation matrices from align_epi_anat (MNI–>target_native) and from 3dAllineate (MNI–>anat)
cat_matvec -ONELINE anatT1_to_MNI.aff12.1D -I target_native_al_mat.aff12.1D -I > mat_MNI_to_target_native.aff12.1D
3dNwarpApply -prefix mni2target_native_warped -source mni+tlrc -master target_native+orig. -nwarp QA_anatT1_to_MNI_WARPINV+tlrc mat_MNI_to_target_native.aff12.1D
As can be seen in the attached pic “transformation_steps”, row C (and ROI_alignment_comp), the inversion was not.successful.
Happy to learn more about how to improve the registration!