Dear SPMers,
 
I did the rotation estimation for my data, but found that the rotation in y (roll) seems to be wrong.
In spm_matrix.m,
R1  =  [1    0    0       0;
        0    cos(P(4))  sin(P(4))  0;
        0   -sin(P(4))  cos(P(4))  0;
        0    0     0       1];

R2  =  [cos(P(5))  0    sin(P(5))  0;
        0        1    0      0;
       -sin(P(5))  0   cos(P(5))  0;
        0          0    0       1];

R3  =  [cos(P(6))   sin(P(6))   0  0;
       -sin(P(6))   cos(P(6))   0  0;
        0           0           1  0;
        0          0     0  1];
 
But if the rotation is defined as counter-clock wise, then the rotation should be
 
R1'  =  [1    0    0       0;
        0    cos(P(4))  -sin(P(4))  0;
        0   sin(P(4))  cos(P(4))  0;
        0    0     0       1];

R2'  =  [cos(P(5))  0    sin(P(5))  0;
        0        1    0      0;
       -sin(P(5))  0   cos(P(5))  0;
        0          0    0       1];

R3'  =  [cos(P(6))   -sin(P(6))   0  0;
       sin(P(6))   cos(P(6))   0  0;
        0           0           1  0;
        0          0     0  1];
Note the sign difference between R1&R1', R3&R3', but R2=R2'. Also, the difference between R1' and R2'. (Check http://www.euclideanspace.com/maths/algebra/matrix/orthogonal/rotation/index.htm for better description). So, the rotation matrix R1, R2 and R3 are inconsistent.
 
Am I wrong? And are the angles defined as clock-wise or counter-clock-wise?