| 1 | #
|
|---|
| 2 | # Extend a map by zero padding to make it have equal grid points along x,y,z dimensions.
|
|---|
| 3 | # For a map of size 96,101,88 (1a0m from EDS) a command that does this is
|
|---|
| 4 | #
|
|---|
| 5 | # vop cover #0 ibox -2,0,-6,98,100,94 useSymmetry false cellSize 200,200,200
|
|---|
| 6 | #
|
|---|
| 7 | # This script just produces the right arguments for the input map dimensions and runs vop cover.
|
|---|
| 8 | # Run this script using Chimera command
|
|---|
| 9 | #
|
|---|
| 10 | # run /tmp/cube.py #2
|
|---|
| 11 | #
|
|---|
| 12 | def cubify(v):
|
|---|
| 13 | xs,ys,zs = v.data.size
|
|---|
| 14 | s = max((xs,ys,zs))
|
|---|
| 15 | xo,yo,zo = (s-xs)//2,(s-ys)//2,(s-zs)//2
|
|---|
| 16 | command = ('vop cover %s ibox %d,%d,%d,%d,%d,%d useSymmetry false cellSize %d,%d,%d'
|
|---|
| 17 | % (v.oslIdent(),-xo,-yo,-zo,s-xo-1,s-yo-1,s-zo-1,s,s,s))
|
|---|
| 18 | from chimera import runCommand
|
|---|
| 19 | runCommand(command)
|
|---|
| 20 |
|
|---|
| 21 | vspec = arguments[0]
|
|---|
| 22 | from chimera import specifier
|
|---|
| 23 | from VolumeViewer import Volume
|
|---|
| 24 | for v in specifier.evalSpec(vspec).models():
|
|---|
| 25 | if isinstance(v, Volume):
|
|---|
| 26 | cubify(v)
|
|---|