
SPM bugs (internal report page)
This page is meant for reports and fixes of bugs. Especially after updates, some bugs show up. If you find one yourself or you notice a useful fix on the list, please leave a reply with the description of the problem, and if possible the solution, on this page.
This is a test (i don’t see any posts here?) and also to post something i’ve come across while preprocessing my data. I use ’4D’ data; all EPI’s are in one single file. I think the following also applies if you use single files for each volume (although i would recommend building ’4D’s’ for each fmri data set).
The orientation of fmri-data in a 4D.nii file is stores in the 4D.mat file. If you have N volumes, that’ll be N times a 4-by-4 orientation matrix (encoding for rotation, translation, scaling and a bit of morphing making for a total of 12 linear parameters; the other 4 parameters don’t do anything, but i’m moving off-topic here). This matrix you can load into matlab by typing load 4D.mat, or a4D.mat, or reward4D.mat.
The orientation of a 4D.nii file is ALSO stored in the header of the 4D.nii file, however, only 1 orientation is stored there.
Since there are N volumes in the 4D.nii, a 4D.mat file is therefore needed to encode for all of the orientations (and the 4D.mat file is the file changed when doing stuff like re-alignment and co-registration without resampling).
The thing i found, is
a) after the slicetiming correction, an a4D.mat file is created, with N times a 4×4 matrix. The first and the second one just contains alot of zeros. The third-till-Nth matrix actually contains orientation data!!
b) if the matrix contains zeros, the orientation in the header is used.
c) when you use the display function in SPM to change the orientation of an image, depending on whether it’s a t1 or the 50th volume in your 4D, display will change either the header of your 4D.nii or your 4D.mat file.
I came across this while preprocessing my data and wanting to apply a rotation to the fmri data without using the display utility (to automize some steps); it worked for images from 3-to-N, but not for the first and second image. After some searching i came upon the above, and now I just copy the 3rd matrix the the 2nd and 1st, and then apply the rotation.