translation and rotation in MATLAB using transformation matrices from chimera
Dear all,
I need to merge two maps in MATLAB using
alignment data from chimera. Inputs: two maps of the same box size, origin. I use matrixget - to report translation and rotation
matrices for the aligned map . Translation operation works well when transferred into MATLAB (briefly, translation matrix gets converted in eulers and pased on to tom_rotate command in MATLAB, TOM package). However the x y z translation coordinates (the fourth column top to bottom in matrixget - output) are way off the real translation when using tom_shift command in MATLAB, TOM.
I found out that if I open the rotated map
and fit it again, it gives close to correct translation
matrix.
What's going wrong here? Does anyone have a
solution how to overlay 3D arrays in MATLAB using chimera-reported transformation matrices?
Many
thanks,
Oleksiy
Dr Oleksiy Kovtun
Research Fellow
Briggs group
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge
CB2 0QH
UK
Tel: + 44 1223 267551
Email: okovtun@mrc-lmb.cam.ac.uk
Dr Oleksiy Kovtun
Research Fellow
Briggs group
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge
CB2 0QH
UK
Tel: + 44 1223 267551
Email: okovtun@mrc-lmb.cam.ac.uk
Dear Oleksiy, I can’t advise on MATLAB, just wanted to point out that in Chimera, after fitting you could resample one map “A" on the grid of another “B". This would create a new resampled map “C” (although with some loss of resolution due to interpolation) that is already in register with “B” so you wouldn’t have to specify a transformation.
The command is “vop resample”: http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/vop.html#resample See also: http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/savemodel.html#afterfitting
Best, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco
On Apr 24, 2017, at 9:30 AM, Oleksiy Kovtun okovtun@mrc-lmb.cam.ac.uk wrote:
Dear all, I need to merge two maps in MATLAB using alignment data from chimera. Inputs: two maps of the same box size, origin. I use matrixget - to report translation and rotation matrices for the aligned map . Translation operation works well when transferred into MATLAB (briefly, translation matrix gets converted in eulers and pased on to tom_rotate command in MATLAB, TOM package). However the x y z translation coordinates (the fourth column top to bottom in matrixget - output) are way off the real translation when using tom_shift command in MATLAB, TOM. I found out that if I open the rotated map and fit it again, it gives close to correct translation matrix.
What's going wrong here? Does anyone have a solution how to overlay 3D arrays in MATLAB using chimera-reported transformation matrices?
Many thanks, Oleksiy
Hi Oleksiy,
I’m not sure the cause of your MATLAB positioning problem, but here is an explanation of the Chimera matrices that may be helpful.
First the Chimera command matrixget gives the position in the Chimera scene including any mouse rotation and translation you did to view the models. So you would have to consider positioning matrices for both maps. Even when you first open the maps and don’t move them, then fit one in the other, both maps probably have non-zero translations since the initial centering of the view on the first map does a translation. So using matrixget is not a good way to get the position of one map relative to another, unless you are going to invert one of the matrices and multiply times the other. Instead use the “measure rotation” command (e.g. measure rotation #0 #1) which reports a matrix in the reply log giving the motion of map #1 relative to the coordinates of map #2.
Another thing to be aware of is that these 3x4 matrices contain a rotation (the first 3 columns) and a translation (4th column) and the rotation is applied first, followed by the translation. The rotation is about center x,y,z = (0,0,0) but that is not necessarily grid point i=j=k=0 because the MRC file can have an origin offset. If you look in the Chimera volume viewer dialog coordinates panel (volume viewer menu Features / Coordinates) the origin grid index is given as “Origin index”. That is the grid point the rotation is centered on.
Tom
On Apr 24, 2017, at 9:30 AM, Oleksiy Kovtun okovtun@mrc-lmb.cam.ac.uk wrote:
Dear all, I need to merge two maps in MATLAB using alignment data from chimera. Inputs: two maps of the same box size, origin. I use matrixget - to report translation and rotation matrices for the aligned map . Translation operation works well when transferred into MATLAB (briefly, translation matrix gets converted in eulers and pased on to tom_rotate command in MATLAB, TOM package). However the x y z translation coordinates (the fourth column top to bottom in matrixget - output) are way off the real translation when using tom_shift command in MATLAB, TOM. I found out that if I open the rotated map and fit it again, it gives close to correct translation matrix.
What's going wrong here? Does anyone have a solution how to overlay 3D arrays in MATLAB using chimera-reported transformation matrices?
Many thanks, Oleksiy
Dr Oleksiy Kovtun
Research Fellow
Briggs group
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge
CB2 0QH
UK
Tel: + 44 1223 267551
Email: okovtun@mrc-lmb.cam.ac.uk
Dr Oleksiy Kovtun Research Fellow Briggs group MRC Laboratory of Molecular Biology Francis Crick Avenue Cambridge CB2 0QH UK
Tel: + 44 1223 267551 Email: okovtun@mrc-lmb.cam.ac.uk
<untitled-[2].html>_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
Hi Tom, Thank you for the explanations. I did not touch the maps after opening and ensured that the matrices reported by matrixget, measure rotation and fitmap commands were identical. There was no origin offset either. And yet if I apply these reported rotation and translation, the translation is constantly off by what seems to be varying value. I however found the way to achieve correct translation. The trick is to apply rotation only first. Then fit this rotated map to the reference again. The reported translation is correct this time. Still puzzled with why I first reported translation is not equal to the second. Cheers, Oleksiy
Hi
Oleksiy,
I’m not sure the cause of your MATLAB positioning
problem, but here is
an explanation of the Chimera matrices that may be helpful.
First the Chimera command matrixget gives the position in the
Chimera
scene including any mouse rotation and translation you did to view
the
models. So you would have to consider positioning matrices for
both
maps. Even when you first open the maps and don’t
move them, then fit
one in the other, both maps probably have non-zero translations
since
the initial centering of the view on the first map does a
translation.
So using matrixget is not a good way to get the position of one
map
relative to another, unless you are going to invert one of the
matrices
and multiply times the other. Instead use the
“measure rotationâ€
command (e.g. measure rotation #0 #1) which reports a matrix in
the
reply log giving the motion of map #1 relative to the coordinates of
map
#2.
Another thing to be aware of is that these 3x4 matrices contain a
rotation (the first 3 columns) and a translation (4th column) and
the
rotation is applied first, followed by the translation. The rotation
is
about center x,y,z = (0,0,0) but that is not necessarily grid
point
i=j=k=0 because the MRC file can have an origin offset. If you look
in
the Chimera volume viewer dialog coordinates panel (volume viewer
menu
Features / Coordinates) the origin grid index is given as
“Origin
indexâ€. That is the grid point the rotation is centered
on.
Tom
On Apr 24, 2017, at 9:30 AM, Oleksiy Kovtun
wrote:
Dear all,
I need to merge two maps in MATLAB using
alignment data from chimera. Inputs: two maps of the same box
size,
origin. I use matrixget - to report translation and rotation
matrices for the aligned map . Translation operation works well
when
transferred into MATLAB (briefly, translation matrix gets
converted in
eulers and pased on to tom_rotate command in MATLAB, TOM
package).
However the x y z translation coordinates (the fourth column top
to
bottom in matrixget - output) are way off the real translation
when
using tom_shift command in MATLAB, TOM.
I found out that if I open the rotated map
and fit it again, it gives close to correct translation
matrix.
What's going wrong here? Does anyone have a
solution how to overlay 3D arrays in MATLAB using
chimera-reported
transformation matrices?
Many
thanks,
Oleksiy
Dr Oleksiy Kovtun
Research Fellow
Briggs group
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge
CB2 0QH
UK
Tel: + 44 1223 267551
Email: okovtun@mrc-lmb.cam.ac.uk
Dr Oleksiy Kovtun
Research Fellow
Briggs group
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge
CB2 0QH
UK
Tel: + 44 1223 267551
Email: okovtun@mrc-lmb.cam.ac.uk
<untitled-[2].html>_______________________________________________
Chimera-users mailing list: Chimera-users@cgl.ucsf.edu
Manage subscription:
Dr Oleksiy Kovtun
Research Fellow
Briggs group
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge
CB2 0QH
UK
Tel: + 44 1223 267551
Email: okovtun@mrc-lmb.cam.ac.uk
Hi Oleksiy,
I’m sure there is a simple explanation of what is going on, but you need to give me a full description of the problem — exactly how you get the matrix that doesn’t work, and how you try to use that matrix which produces the wrong position, including the writing of temp files, .... I can’t figure it out knowing just fragments of your procedure.
Tom
On May 10, 2017, at 3:10 AM, Oleksiy Kovtun okovtun@mrc-lmb.cam.ac.uk wrote:
Hi Tom,
Thank you for the explanations. I did not touch the maps after opening and ensured that the matrices reported by matrixget, measure rotation and fitmap commands were identical. There was no origin offset either. And yet if I apply these reported rotation and translation, the translation is constantly off by what seems to be varying value. I however found the way to achieve correct translation. The trick is to apply rotation only first. Then fit this rotated map to the reference again. The reported translation is correct this time.
Still puzzled with why I first reported translation is not equal to the second.
Cheers,
Oleksiy
Hi Oleksiy,
I’m not sure the cause of your MATLAB positioning problem, but here is an explanation of the Chimera matrices that may be helpful.
First the Chimera command matrixget gives the position in the Chimera scene including any mouse rotation and translation you did to view the models. So you would have to consider positioning matrices for both maps. Even when you first open the maps and don’t move them, then fit one in the other, both maps probably have non-zero translations since the initial centering of the view on the first map does a translation. So using matrixget is not a good way to get the position of one map relative to another, unless you are going to invert one of the matrices and multiply times the other. Instead use the “measure rotation†command (e.g. measure rotation #0 #1) which reports a matrix in the reply log giving the motion of map #1 relative to the coordinates of map #2.
Another thing to be aware of is that these 3x4 matrices contain a rotation (the first 3 columns) and a translation (4th column) and the rotation is applied first, followed by the translation. The rotation is about center x,y,z = (0,0,0) but that is not necessarily grid point i=j=k=0 because the MRC file can have an origin offset. If you look in the Chimera volume viewer dialog coordinates panel (volume viewer menu Features / Coordinates) the origin grid index is given as “Origin indexâ€. That is the grid point the rotation is centered on.
Tom
On Apr 24, 2017, at 9:30 AM, Oleksiy Kovtun okovtun@mrc-lmb.cam.ac.uk wrote:
Dear all, I need to merge two maps in MATLAB using alignment data from chimera. Inputs: two maps of the same box size, origin. I use matrixget - to report translation and rotation matrices for the aligned map . Translation operation works well when transferred into MATLAB (briefly, translation matrix gets converted in eulers and pased on to tom_rotate command in MATLAB, TOM package). However the x y z translation coordinates (the fourth column top to bottom in matrixget - output) are way off the real translation when using tom_shift command in MATLAB, TOM. I found out that if I open the rotated map and fit it again, it gives close to correct translation matrix.
What's going wrong here? Does anyone have a solution how to overlay 3D arrays in MATLAB using chimera-reported transformation matrices?
Many thanks, Oleksiy
Dr Oleksiy Kovtun
Research Fellow
Briggs group
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge
CB2 0QH
UK
Tel: + 44 1223 267551
Email: okovtun@mrc-lmb.cam.ac.uk
Dr Oleksiy Kovtun Research Fellow Briggs group MRC Laboratory of Molecular Biology Francis Crick Avenue Cambridge CB2 0QH UK
Tel: + 44 1223 267551 Email: okovtun@mrc-lmb.cam.ac.uk
<untitled-[2].html>_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
Dr Oleksiy Kovtun Research Fellow Briggs group MRC Laboratory of Molecular Biology Francis Crick Avenue Cambridge CB2 0QH UK
Tel: + 44 1223 267551 Email: okovtun@mrc-lmb.cam.ac.uk
participants (3)
-
Elaine Meng
-
Oleksiy Kovtun
-
Tom Goddard