Hi,
I completely agree with this.
One modification to the script which may
make things look better is:
for x in `cat MY_IMG_LIST.txt` ; do
y=`$FSLDIR/bin/remove_ext $x`
flirt -in ${y} \
-ref MY_REF_IMG.nii.gz \
-applyxfm -init MY_AFFINE.mat \
-out ${y}_flirted ;
done
As this will stop it making images like myimage.nii.gz_flirted.nii.gz
since is x=myimage.nii.gz then y=myimage which is what you want.
Also note that you don't have to use a text file, you could also just
use a wildmask on the command line like:
for x in *diff*.nii.gz ; do
and this would then process any file containing "diff" and
ending with .nii.gz
It just depends on whether it is easier to use a wildmask or
make a list in a file.
All the best,
Mark
Anderson Winkler wrote:
> Dear Vin,
>
> In the FLIRT GUI window there is an option for this. You have to increase
> the "Number of secondary images to apply transform" to a number>0 and you'll
> see text entries for the additional images, with a browse button for each.
> But by doing this you'll be estimating a new affine matrix and using it,
> which may not be exactly what you want (you may have obtained you matrix
> from another source, and may not be willing to estimate another).
>
> If you want to use the very same matrix that you already have, I would
> suggest calling FLIRT from the command line. Just write a simple .txt file
> with the filenames of the images you want to apply the transform, one
> filename per line, and save as, say, MY_IMG_LIST.txt. Then run something
> like this at the shell prompt:
>
> for x in `cat MY_IMG_LIST.txt` ; do
> flirt -in ${x} \
> -ref MY_REF_IMG.nii.gz \
> -applyxfm -init MY_AFFINE.mat \
> -out ${x}_flirted ;
> done
>
> replacing the words in capital for the appropriate file names for the
> reference volume and affine matrix. You can remove all the \ and put
> everything in a single line. And you can also use other FLIRT options (e.g.,
> -interp sinc) if you want.
>
> Hope this helps!
>
> Kind regards,
>
> Anderson
>
>
|