| 1 | # Script to rotate a volume using Euler angles, then shift it, then resample it
|
|---|
| 2 | # on the original unrotated grid.
|
|---|
| 3 | #
|
|---|
| 4 | # runscript eulermove.py #0 45 60 20 15 33.5 -10
|
|---|
| 5 |
|
|---|
| 6 | if len(arguments) != 7:
|
|---|
| 7 | from Commands import CommandError
|
|---|
| 8 | raise CommandError('eulermove.py requires 7 arguments')
|
|---|
| 9 |
|
|---|
| 10 | from chimera import specifier
|
|---|
| 11 | m = specifier.evalSpec(arguments[0]).models()[0]
|
|---|
| 12 | euler_angles = [float(a) for a in arguments[1:4]]
|
|---|
| 13 | translation = [float(x) for x in arguments[4:7]]
|
|---|
| 14 |
|
|---|
| 15 | from Matrix import euler_xform
|
|---|
| 16 | xf = euler_xform(euler_angles, translation)
|
|---|
| 17 | mcopy = m.copy()
|
|---|
| 18 | mcopy.openState.localXform(xf)
|
|---|
| 19 |
|
|---|
| 20 | from chimera import runCommand
|
|---|
| 21 | runCommand('vop resample %s onGrid %s boundingGrid true' %
|
|---|
| 22 | (mcopy.oslIdent(), m.oslIdent()))
|
|---|