nonlinear tlrc

Hi AFNI experts,

I have some confusions about “” and “3dQwarp”. Does “” perform the same things as “3dQwarp”?

If I want to do nonlinear normalization, should I use “” instead of “3dQwarp”?

Thank you!



The function is a wrapper for 3dQwarp, but it does a bit of pre-processing on the input volume before aligning it using 3dSkullstrip and 3dUnifize. So, in that sense, it might be preferable to use to start with (I find it’s often helpful to ‘polish’ up images for helping alignment, so single spikes in values in CSF or edges don’t ruin everything). In the history of your output from, you will see the full set of 3d* commands, including 3dQwarp.


Also includes an affine alignment step by default, which may be something you want; it’s often a good starting point. It call @auto_tlrc to do that step. 3dQwarp has a -allineate option that can do something similar. The transformations are concatenated together in that script. Another difference is puts all its output into a separate directory. It’s probably just easier to let worry about the details unless you need to do some more tweaking of the options.

Here is a script I have used recently to analyze a lot (198) of datasets. This script was used to warp the Cambridge subset of the FCON-1000 collection. It uses, since that makes it easy to use the warped results with in turn. The script below takes on the command line one argument, the subject ID; e.g, the command
tcsh warper.csh sub00156
will work on dataset anat_sub00156.nii.gz. I then submitted 198 runs of this script to the NIH Linux cluster.

The base.nii dataset to which the anat dataset is aligned was a 3dUnifize-d version of the MNI152_T1_2009c+tlrc.HEAD that is supplied with AFNI. This dataset is a nonlinearly registered version of the MNI template, and was created by MNI, not by the AFNI empire. This dataset was created with the command
3dUnifize -prefix base.nii -input MNI152_T1_2009c+tlrc -GM

I wrote this script partly because the default parameters to 3dSkullStrip didn’t work well with these datasets, which have had part of the face region simply zero-ed out, which caused funny things to happen in some cases. The 3dSkullStrip parameters used below worked well for these cases, but of course you should check your results!

Note: running to minpatch=11 (as set at the top of the script) will take longer than the default 25 – probably about twice as long. As I recall (this was months ago), each subject took about 2 hours to run – which is why learning to use a cluster is handy, so the jobs can run in parallel.


# set the subject ID and the minimum warp patch size

set sub  = $argv[1]
set minp = 11

# go to data directory

set topdir = /data/NIMH_SSCC/fcon1000.perm.test/Cambridge

cd $topdir/anat_orig

# create final output directory if needed

mkdir -p $topdir/anat_warped

# create temporary directory to hold the work, and copy data there

mkdir -p temp_$sub
cp anat_$sub.nii.gz base.nii temp_$sub
cd temp_$sub

# uniformize the T1 intensity

3dUnifize -prefix anatU_$sub.nii -input anat_$sub.nii.gz -GM

# strip skull

3dSkullStrip -input  anatU_$sub.nii  \
             -prefix anatS_$sub.nii  \
             -ld 33 -niter 777 -shrink_fac_bot_lim 0.777 -exp_frac 0.0666

# warp to the base dataset                    \
   -base base.nii               \
   -input anatS_$sub.nii        \
   -skull_strip_base  no        \
   -skull_strip_input no        \
   -unifize_input     no        \
   -qw_opts -noneg -pblur -minpatch $minp -workhard:0:4

# compress output datasets and move to final output directory

\rm awpy/base.nii

gzip awpy/*.nii

mv awpy $topdir/anat_warped/$sub.awpy

# delete the temporary directory

cd ..
\rm -rf temp_$sub