Hi - good question; we've just added the answer to this at the FAQ - see:
http://www.fmrib.ox.ac.uk/fslfaq/#feat_customreg
But note that there is a minor bug in the distributed updatefeatreg script
(it tries to run in the named featdir rather than its reg subdir) - a
corrected script is attached.
Cheers, Steve.
On Tue, 16 Nov 2004, Alex Fornito wrote:
> Hi all,
> I'm trying different things to improve my registration results and was
> wandering how I might incoporate into the registration process implemented
> in FEAT.
> For example, I've perfomed a custom registration of the intial highres
> (subject's wholehead epi) to the main structural image (subject's T1). Is
> there anyway I can tell feat to use this image in the registration
> process, rather than running the standard FLIRT registrations on the
> original images?
> Thanks for your help,
> Alex
>
Stephen M. Smith DPhil
Associate Director, FMRIB and Analysis Research Coordinator
Oxford University Centre for Functional MRI of the Brain
John Radcliffe Hospital, Headington, Oxford OX3 9DU, UK
+44 (0) 1865 222726 (fax 222717)
[log in to unmask] http://www.fmrib.ox.ac.uk/~steve
#!/bin/sh
# updatefeatreg - updates all inverse transforms and gif images based
# on fundamental registration matrices:
# i.e. example_func2highres.mat , highres2standard.mat
# - this allows for manual/other correction of the matrices
#
# Mark Jenkinson, FMRIB Image Analysis Group
#
# Copyright (C) 1999-2004 University of Oxford
#
# SHCOPYRIGHT
dirnm=$1
if [ X${dirnm}X = XX ] ; then
echo "Usage: $0 <feat_directory> [-gifs]"
exit 0;
fi
if [ X${dirnm}X = X.X ] ; then
dirnm=`pwd`;
fi
if [ ! -d $dirnm ] ; then
echo "$dirnm is not a valid directory"
echo "Usage: $0 <feat_directory> [-gifs]"
exit -1
fi
if [ "X"`echo $dirnm | grep feat`"X" = "XX" ] ; then
echo "Directory must be a feat directory"
echo "Usage: $0 <feat_directory> [-gifs]"
exit -2
fi
cd ${dirnm}/reg
init=no;
if [ -e initial_highres2highres.mat -o -e example_func2initial_highres.mat ] ; then
init=yes;
fi
if [ $init = "yes" ] ; then
if [ ! -f example_func2initial_highres.mat ] ; then
echo "Could not find example_func2initial_highres.mat"
exit -3
fi ;
if [ ! -f initial_highres2highres.mat ] ; then
echo "Could not find initial_highres2highres.mat"
exit -3
fi ;
else
if [ ! -f example_func2highres.mat ] ; then
echo "Could not find example_func2highres.mat"
exit -3
fi ;
fi
if [ ! -f highres2standard.mat ] ; then
echo "Could not find highres2standard.mat"
exit -4
fi
if [ $init = "yes" ] ; then
# concatenate to make example_func2highres
${FSLDIR}/bin/convert_xfm -in example_func -ref highres -middlevol \
initial_highres -omat example_func2highres.mat -concat \
initial_highres2highres.mat example_func2initial_highres.mat
# make inverses
${FSLDIR}/bin/convert_xfm -in initial_highres -ref highres -inverse \
-omat highres2initial_highres.mat initial_highres2highres.mat
${FSLDIR}/bin/convert_xfm -in example_func -ref initial_highres -inverse \
-omat initial_highres2example_func.mat example_func2initial_highres.mat
fi
# concatenate to make example_func2standard
${FSLDIR}/bin/convert_xfm -in example_func -ref standard -middlevol highres \
-omat example_func2standard.mat -concat \
highres2standard.mat example_func2highres.mat
# make inverses
${FSLDIR}/bin/convert_xfm -in highres -ref standard -inverse \
-omat standard2highres.mat highres2standard.mat
${FSLDIR}/bin/convert_xfm -in example_func -ref highres -inverse \
-omat highres2example_func.mat example_func2highres.mat
${FSLDIR}/bin/convert_xfm -in example_func -ref standard -inverse \
-omat standard2example_func.mat example_func2standard.mat
if [ X$2 != X-gifs ] ; then
exit 0;
fi
sl=/tmp/slice_$PID
ef=example_func
ih=initial_highres
hr=highres
st=standard
ef2hr=example_func2highres
${FSLDIR}/bin/flirt -applyxfm -init $ef2hr.mat -in $ef -ref $hr -out $ef2hr
${FSLDIR}/bin/slicer $ef2hr $hr -s 0.5 -x 0.4 ${sl}a -x 0.5 ${sl}b -x 0.6 ${sl}c -y 0.4 ${sl}d -y 0.5 ${sl}e -y 0.6 ${sl}f -z 0.4 ${sl}g -z 0.5 ${sl}h -z 0.6 ${sl}i
${FSLCONVERT} -colors 100 +append ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i ${ef2hr}.gif
/bin/rm -f ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i `${FSLDIR}/bin/imglob $ef2hr.*`
ef2st=example_func2standard
${FSLDIR}/bin/flirt -applyxfm -init $ef2st.mat -in $ef -ref $st -out $ef2st
${FSLDIR}/bin/slicer $ef2st $st -s 1 -x 0.4 ${sl}a -x 0.5 ${sl}b -x 0.6 ${sl}c -y 0.4 ${sl}d -y 0.5 ${sl}e -y 0.6 ${sl}f -z 0.4 ${sl}g -z 0.5 ${sl}h -z 0.6 ${sl}i
${FSLCONVERT} -colors 100 +append ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i ${ef2st}.gif
/bin/rm -f ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i `${FSLDIR}/bin/imglob $ef2st.*`
hr2st=highres2standard
${FSLDIR}/bin/flirt -applyxfm -init $hr2st.mat -in $hr -ref $st -out $hr2st
${FSLDIR}/bin/slicer $hr2st $st -s 1 -x 0.4 ${sl}a -x 0.5 ${sl}b -x 0.6 ${sl}c -y 0.4 ${sl}d -y 0.5 ${sl}e -y 0.6 ${sl}f -z 0.4 ${sl}g -z 0.5 ${sl}h -z 0.6 ${sl}i
${FSLCONVERT} -colors 100 +append ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i ${hr2st}.gif
/bin/rm -f ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i `${FSLDIR}/bin/imglob $hr2st.*`
if [ $init = "no" ] ; then
exit 0;
fi
ef2ih=example_func2initial_highres
${FSLDIR}/bin/flirt -applyxfm -init $ef2ih.mat -in $ef -ref $ih -out $ef2ih
${FSLDIR}/bin/slicer $ef2ih $ih -s 1 -x 0.4 ${sl}a -x 0.5 ${sl}b -x 0.6 ${sl}c -y 0.4 ${sl}d -y 0.5 ${sl}e -y 0.6 ${sl}f -z 0.4 ${sl}g -z 0.5 ${sl}h -z 0.6 ${sl}i
${FSLCONVERT} -colors 100 +append ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i ${ef2ih}.gif
/bin/rm -f ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i `${FSLDIR}/bin/imglob $ef2ih.*`
ih2hr=initial_highres2highres
${FSLDIR}/bin/flirt -applyxfm -init $ih2hr.mat -in $ih -ref $hr -out $ih2hr
${FSLDIR}/bin/slicer $ih2hr $hr -s 1 -x 0.4 ${sl}a -x 0.5 ${sl}b -x 0.6 ${sl}c -y 0.4 ${sl}d -y 0.5 ${sl}e -y 0.6 ${sl}f -z 0.4 ${sl}g -z 0.5 ${sl}h -z 0.6 ${sl}i
${FSLCONVERT} -colors 100 +append ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i ${ih2hr}.gif
/bin/rm -f ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i `${FSLDIR}/bin/imglob $ih2hr.*`
ih2st=initial_highres2standard
${FSLDIR}/bin/flirt -applyxfm -init $ih2st.mat -in $ih -ref $st -out $ih2st
${FSLDIR}/bin/slicer $ih2st $st -s 1 -x 0.4 ${sl}a -x 0.5 ${sl}b -x 0.6 ${sl}c -y 0.4 ${sl}d -y 0.5 ${sl}e -y 0.6 ${sl}f -z 0.4 ${sl}g -z 0.5 ${sl}h -z 0.6 ${sl}i
${FSLCONVERT} -colors 100 +append ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i ${ih2st}.gif
/bin/rm -f ${sl}a ${sl}b ${sl}c ${sl}d ${sl}e ${sl}f ${sl}g ${sl}h ${sl}i `${FSLDIR}/bin/imglob $ih2st.*`
|