[VoxBo] realignment issue
Daniel Kimberg
kimberg at mail.med.upenn.edu
Fri Jul 24 10:35:12 EDT 2009
Hi all. It looks like the issue with VoxBo jobs using SPM2 realign has been around since at least 2006, and I'm sure since the spm2 jobs first appeared. The issue is that the script was not re-loading the volumes after the transformation matrix was saved, and SPM2 apparently doesn't keep those transformations in memory with the images it's just realigned. The fix is to re-load the images before re-slicing them. I've already made this change for the Penn CfN cluster, and verified that it leaves no apparent movement in a previously affected dataset. I'll append the revised jobtype at the bottom of this message for anyone elsewhere who needs it.
There is one common case where data could get realigned anyway. If you ran the script on the same dataset twice without deleting the .mat files that were created during the first run, they would be applied during the second run. So it's possible to have spm2_realign'ed data that did get realigned. If you're not sure, you should inspect your data visually.
If you're not sure if your data used SPM2 realigment at all, the easiest way to check is to look at the headers of your tes files. i.e., type "more myfile.tes" for a processed tes file, and see if spm2_realign appears in the header. If you don't have tes files, you're probably safe.
I'm sorry that this bug slipped by unnoticed for so long, and I hope it hasn't affected too many datasets. It's liable to be less of a problem for smoothed datasets with careful attention to quality control (i.e., dropping big movers), and more serious for studies in unsmoothed data, but the only way to know for sure is to examine your data, and re-process it if you can't tell. I would encourage everyone to re-run affected analyses to make sure the results aren't affected substantively. Realignment problems have the potential to create both false positives and false negatives.
Please let me know if you do have an affected dataset, and especially if it's caused any serious problems. I'll post another update once I've heard from more people. I'll also try to release some jobtypes to use recent versions of SPM and FSL soon. Again, sorry to have let this happen, and I apologize if it's affected anyone's data in a bad way.
dan
## the following file should replace VoxBo/etc/jobtypes/spm2_realign.vjt
shortname spm2_realign
description SPM2 Realignment for 4D
invocation script
requires cpu
requires matlab
retry_tag Try again later
setenv MATLABPATH=$(SPM2_PATH)
setenv HOME=/tmp
argument
name=dir
argdesc=directory
type=string
default=none
low=none
high=none
end
argument
name=refvolume
argdesc=full path to reference cube
type=string
default=none
low=none
high=none
end
argument
name=infile
argdesc=input tes file name
type=string
default=none
low=none
high=none
end
argument
name=outfile
argdesc=output tes file name
type=string
default=none
low=none
high=none
end
command vbconv $(dir)/$(infile) $(dir)/$(infile)_hdrsave.tes -i 0
command vb2img $(refvolume) $(dir)/$(infile)_ref.img
command vb2imgs $(dir)/$(infile) $(dir)/$(infile)_tmpspm
command $(SPM2_MATLAB_CMD)
| cd $(dir)
| spm_defaults;
| global defaults;
| P=spm_get('files','$(infile)_tmpspm','$(infile)_tmpspm*.img');
| P=strvcat('$(infile)_ref.img',P)
| rflags=struct('quality',1,'fwhm',5,'interp',7,'graphics',0,'rtm',0);
| spm_realign(P,rflags)
| rflags=struct('interp',7,'which',1);
| spm_reslice(P,rflags)
| exit
command /bin/rm -f $(dir)/$(outfile)
command vb2tes -n $(dir)/$(infile)_tmpspm/r$(infile)_tmpspm $(dir)/$(outfile)
command vbhdr -c $(dir)/$(infile)_hdrsave.tes $(dir)/$(outfile)
command /bin/rm -r $(dir)/$(infile)_tmpspm $(dir)/$(infile)_hdrsave.tes $(dir)/$(infile)_ref.[hi]*
command vbhdr -a "spm2_realign_date: {DATE}" $(dir)/$(outfile)
command vbhdr -a "spm2_realign_ref: $(refvolume)" $(dir)/$(outfile)
command test -e $(dir)/$(outfile)
More information about the voxbo-general
mailing list