[Neurodebian-users] FSL FNIRT bug

Jan Scholz Jan.Scholz at phenogenomics.ca
Fri Aug 26 00:32:29 UTC 2011


Hi,

I seem to have found a bug in FNIRT, FSL's non-linear alignment tool. For some reason it does not save the affine transformation if a non-linear initial warp (inwarp) is used to initalize FNIRT. You can test this easily by running the following commands (<5min). The error does not come up on a CentOS system with the newest build, non-neurodebian). So it might have been fixed in some newer version (FNIRT build 419).

I checked the same commands on neurodebian ubuntu lucid and latest-version locally compiled CentOS, and they produce different results, if I'm not mistaken. Please check whether you can reproduce the bug with the following commands.

Thanks,
Jan


System:
Ubuntu Lucid
Linux 2.6.32-29-generic #58-Ubuntu SMP Fri Feb 11 20:52:10 UTC 2011 x86_64 GNU/Linux
$ fnirt
Part of FSL (build 418)
fsl 4.1.8


# The bug strikes on a ubuntu lucid machine and a freshly installed ubuntu lucid virtual machine. So I'm fairly sure it's not just one particular system that is affected. I tested this only on a mouse brain, so there's a slight chance the bug does not happen with "normal"-sized brains.# To test whether there is a bug take any random_image, preferably brain-extracted with some empty space around# This is going to be the new referenceimcp random_image.nii.gz ref# let's move it by a perceptible amount. I created this matrix for a mouse brain, you might need larger translations for human brainsprintf "0.984808  0  -0.173648  0.828463\n0  1  0  -1\n0.173648  0  0.984808  -0.51938\n0  0  0  1\n" >> aff_orig.mat# the moved image is our input imageflirt -in ref -ref ref -applyxfm -init aff_orig.mat -out in# check that the two differfslview ref in# Now let's pretend we have to images (in,ref) we want to align. First estimate the affine matrixflirt -in in -ref ref -omat aff.mat -out aff && fslview ref aff# Then the warp coefficiants (i.e. non-linear alignment). Again these values are for mouse brains, Choose lambda=100 warpres=10,10,10 to speed up things for human brainsfnirt --in=in  --ref=ref --aff=aff.mat --iout=nlin1 --cout=nlin1_warp --logout=/dev/null -v --applyrefmask=1 --applyinmask=1 --subsamp=2 --miter=2 --infwhm=0.3 --reffwhm=0.3 --lambda=3 --estint=1 --warpres=0.5,0.5,0.5 --regmod=bending_energy --intmod=global_non_linear_with_bias --intorder=5 --biasres=10,10,10 --biaslambda=500 && fslview ref aff nlin1# This should work and the brains should align. You could test that the nlin1_warp is actually correct by using applywarp# applywarp -i in -r ref -w nlin1_warp -o nlin1b && fslview ref aff nlin1 nlin1b # Now let's use the previously estimated non-linear warp (nlin1_warp) as inwarp for another non-linear iterationfnirt --in=in  --ref=ref --inwarp=nlin1_warp --iout=nlin2 --cout=nlin2_warp --logout=/dev/null -v --applyrefmask=1 --applyinmask=1 --subsamp=2 --miter=2 --infwhm=0.3 --reffwhm=0.3 --lambda=3 --estint=1 --warpres=0.5,0.5,0.5 --regmod=bending_energy --intmod=global_non_linear_with_bias --intorder=5 --biasres=10,10,10 --biaslambda=500 && fslview ref aff nlin2# The alignment works but the output image is moved by the affine part, i.e. the affine transformation didn't make it into the non-linear warp output. Images "aff" and "nlin2" don't overlap.# Applying the affine transformation in addition to the second non-linear warp yields the correct results (if your system has the bug)applywarp -i in -r ref --premat=aff.mat -w nlin2_warp -o nlin2b && fslview ref aff nlin2 nlin2b 




Jan Scholz, D. Phil.
Research Fellow

Mouse Imaging Centre (MICe)
Hospital for Sick Children
Toronto Centre for Phenogenomics
25 Orde Street
Toronto, Ontario, M5T 3H7
Tel: 647-837-5811 x4332
Fax: 647-837-5832

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/neurodebian-users/attachments/20110825/dbe3d5c2/attachment.html>


More information about the Neurodebian-users mailing list