Hi Guys,
I wanted to chime in here, since I am (remotely) working with Danny on this project.
#1) My plan for initial testing is to the use variants of the @toMNI_Awarp and @toMNI_Qwarpar bash scripts that Bob coded.
#2) This pipeline requires a skull-stripped (SSed) T1 and a template. We're planning to use the MNI152_2mm nonlinear template released with FSL for the template. In my mind, the choice of which SSed T1 to use (from among the already-python-processed files) depends on whether there is a better within-subject registration using epi2anat vs. anat2epi. I believe that Danny has generated both files, but it is not clear which is better. If you have suggestions, we'd welcome them.
#3) Once the affine and nonlinear warps have been computed, I was planning to use 3dNwarpApply to catenate and apply. Naturally, the particulars will depend on how we address #2.
a) epi2anat: If we start with SSed T1s in native-space, then we can catenate the A-transform with the Q-transform and apply to the SSed T1. For the EPI, we can catenate these with the additional transfrom from epi native-space to T1 native-space.
-or-
b) anat-to-epi: If we start with SSed T1s that have been registered to the corresponding native-space epi, then we can catenate the anat2epi transform, the A-transform, and the Q-transform. For the EPI, we can catenate just the A- and Q-transforms.
#4) Unfortunately, we have not been able to get my tweaked version of @toMNI_Awarp to run, likely owing to my deficiencies as a bash coder. The script is not finding the template. But it looks like Danny just posted and got an answer to that question in a separate thread. (Thanks, Peter Molfese!). We'll go ahead and move the template nii file (reoriented to match our data).
Thanks for your patience and advice regarding this issue - we're eager to take Qwarp for a serious spin around block.
Best wishes, Alex
--------
#!/bin/tcsh
if( $#argv < 2 ) then
echo " "
echo " script written by box cox and tweaked by shackman july 2013 "
echo " "
echo "Script to take a collection of no-skull & no-unifized T1 datasets and linearly normalize them "
echo "to 1x1x1 mm MNI space with an affine (linear) transformation. "
echo "These datasets should already have been skull-stripped. "
echo " "
echo " We are NOT assuming that you already registered the single subject T1 and EPI to one another in native space - We'll do it later :) "
echo " "
echo " copy this script to the directory containing the no-skull T1's and correct MNI template. "
echo " "
echo "Usage: @toMNI_Awarp1 dirname dataset1 dataset2 ..."
echo " "
echo "where 'dirname' is the full path and name of the directory which will be created and "
echo "then get the results we're going to make, and 'dataset1 dataset2 ...' is a list of T1 datasets "
echo "to be transformed. "
echo " "
echo "The results can further be nonlinearly registered to form a template "
echo "using script @toMNI_Qwarpar (which will take a long time). "
exit 0
endif
echo " "
echo "did you specify the correct mni template in the script (MY_MNI152_1MM_NOSKULL_NONLINEARTEMPLATE_INCORRECTORIENTATION.NII)?"
echo " "
set basename = MY_MNI152_1MM_NOSKULL_NONLINEARTEMPLATE_INCORRECTORIENTATION.NII
echo " "
echo basename
echo " "
set dname = $argv[1]
if( -e $dname ) then
echo "** @toMNI_Awarp: Directory $dname already exists -- cannot continue"
exit 1
endif
set tpath = `@FindAfniDsetPath $basename`
if( $tpath == '' ) then
echo "** @toMNI_Awarp: Failed to find template $basename -- cannot continue"
exit 1
endif
set dlist = ( )
set nerr = 0
foreach fred ( `count -dig 1 2 $#argv` )
set dlist = ( $dlist $argv[$fred] )
if( ! -f $argv[$fred] ) then
echo " * @toMNI_Awarp: Dataset file $argv[$fred] does not exist"
@ nerr++
endif
end
if( $nerr > 0 ) then
echo "** @toMNI_Awarp: Cannot continue after such flagrant problems"
exit 1
endif
\mkdir -pv $dname
if( ! -d $dname ) then
echo "** @toMNI_Awarp: Failed to create directory $dname -- cannot continue"
exit 1
endif
set ndset = $#dlist
set flist = ( )
echo "++ @toMNI_Awarp: copying input datasets to $dname"
foreach fred ( `count -dig 1 1 $ndset` )
set pan = `@parse_afni_name $dlist[$fred]`
set isn = `3dinfo -is_nifti $dlist[$fred]`
if( $isn ) then
set nip = `echo $pan[2] | sed 's/.nii.gz$//g' | sed 's/.nii$//g'`
3dcopy $dlist[$fred] $dname/$nip
set fname = `echo $dname/${nip}+????.HEAD`
else
3dcopy $dlist[$fred] $dname/$pan[2]
set fname = `echo $dname/$pan[2]+????.HEAD`
endif
set flist = ( $flist $fname:t )
end
cd $dname
echo "++ @toMNI_Awarp: beginning @auto_tlrc loop"
foreach fred ( `count -dig 1 1 $ndset` )
set pan = `@parse_afni_name $flist[$fred]`
set pre = $pan[2]
set vvv = $pan[3]
echo " "
echo "========================================================================="
echo " 3dUnifize-ing dataset $flist[$fred], then @auto_tlrc-ing the result"
echo "========================================================================="
echo " "
3dUnifize -prefix ${pre}_uni -GM -input $flist[$fred]
@auto_tlrc -base $basename \
-input ${pre}_uni${vvv} \
-no_ss -init_xform AUTO_CENTER \
-rmode quintic
\rm -f ${pre}_???${vvv}.*
end
\rm -f pre.* *_shft.1D
cd ..
exit 0