I've been using @animal_warper on T2w images with the lpc cost function. This works pretty well, but could probably be better. The affine registration of NMT to the individual results look good in terms of brain outline; the nonlinear alignment has better aligned WM but now the GM takes weird shapes, and expands beyond the real brain outline. Now there are a lot of options I haven't played with, but I was hoping someone could give me some pointers on where to start. I'm assuming something with cost functions, weights, or masks would potentially be the way to go, but Iet me know if you have some advice!
Everything I tried so far is actually worse than the original result. I haven applying 3dQwarp to the affine registration from @animal_warper with different options to see if it gets better than the nonlinear step in @animal_warper. I tried different cost functionals, used the brain mask as a weight, used the noweight an inedge options, skullstripped first, reduced blur, but no luck. Monstrous results
What I think I'd need is an option that tells 3dQwarp to stay within the outer boundaries of the affine brainmask. Does that exist?
affine alignment of the T2w image and NMT using @animalwarper with cost lpc
apply the affine transform to the NMT brainmask, dilate, and skullstrip the original T2w with it
use 3dUnifize -T2 -T2 to invert the T2w contrast in the skullstripped image and make it look like T1w
use 3dQwarp with cost lpa on the skullstripped 'fake T1w' and a skullstripped NMT
Looks great! Only need to find a way to work this into the workflow nicely. What I'd probably need to do is run @animal_warper with just the affine transform, then take the above steps, then use the resulting non-linear warp for the non-linear part of @animal_warper so I get all the followers.
If I wait long enough, you'll figure it all out yourself, and I don't have to do anything....
But I'll add a bit.
Inverting the T2 to T1 can be done like this too (we do this sometimes for inverting T1 for alignment to CT):
3dAutomask -apply_prefix anat_amd -dilate 3 my_anat.nii.gz
set max = `3dBrickStat -max anat_amd+orig`
3dcalc -a anat_amd+orig. -expr "step(a)*(${max}-a)" -prefix anat_amd_rev
There's also this script that is made to invert T1 to T2, fat_proc_imit2w_from_t1w. Not sure if this would work the other way too.
The @animal_warper program allows the -ok_to_exist option, so you can have it only do an affine the first time through. Do the unifizing/inverting separately as you like. Then restart with -ok_to_exist and the default affine+nonlinear steps. Or we could add a pre-nonlinear inverting step into the @animal_warper program.
Thanks Daniel! I'll have some fun with it and may get back to you if I think such a step inside @animalwarper would help. The skullstripping was crucial though, doing the contrast manipulation on the whole head did not give the same good result.
For anyone reading this: This does work, but be aware that running @aw with the just the affine alignment still outputs warp(ed) files. When you then continue with the 'all' alignment and 'ok_to_exist' (after doing the contrast manipulation workaround and copying the resulting warp files where @aw looks for them), @aw sees these files and does NOT overwrite them with new non-linear registration versions. Instead they are still the affine warps.
I solved this by renaming a whole bunch of files that @aw checks for to versions with '_AFF' in the name so that I know they're the affine only version and @aw now actually creates the new files that do take the nonlinear warps into account.
I don't think there's a way to make @aw pick the externally generated warp files but does in fact overwrite all the output that is normally generated after these warps are calculated.
That's good to know. I think this bit of a kludge should work, so I'll have to fix it. I'm glad you got it working through sheer persistence!
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.