[Chimera-users] Control of the volume viewer from the command line

Thomas Goddard goddard at cgl.ucsf.edu
Tue Nov 28 10:45:08 PST 2006

Hi Lukas,

  There is no Chimera command to set the volume contour surface threshold
or color.  We plan on adding this command.

  For now, I have four suggestions.  You can use "Volume Series" tool
available on the Chimera Experimental Features web page:


This page contains plugins that are not yet distributed with Chimera.
You download a zip file and put the new directory in with your existing
Chimera to use it.  The Volume Series tool lets you play a series of
volume data sets perserving thershold level and color settings just as
you want:


There is no Chimera command for this tool either so to make a movie you
would start Movie recorder (menu entry Tools / Utilities / Movie Recorder
or use Chimera movie command) then press the Play button on the volume series

  A second approach is to use the EMANimator animation tool


It is a Chimera extension included with the EMAN single particle reconstruction
package.  It provides a time-line user interface for composing animations
and has a specific capability for playing a sequence of volume data sets
just as you want.

  A third approach is to use some Python code in Chimera to script your
movie.  This is a bit more complicated than using just Chimera commands.
But you can easily use all Chimera commands in a Python script and you
additionally can control all of the volume settings.  I include an example
at the bottom of this email.  You simply open the Python file to run the

  A fourth approach is to get the Animation Commands package


from the Chimera experimental features page.  It includes a command
to change the contour level of a volume map from one value to another over
a set number of frames.  You could use it to set the contour level.  But
there is not a command in this package to set the volume color.


Example seriesmovie.py Python script follows.  Tested in Chimera 1.2309.

directory = '/usr/local/src/chimera-demos/volume/dna_blur' # Volume file location
files = ['1enn_00.mrc', '1enn_05.nc', '1enn_10.nc', '1enn_15.nc', '1enn_20.nc',
          '1enn_25.nc', '1enn_30.nc', '1enn_35.nc', '1enn_40.nc',
          '1enn_45.nc', '1enn_50.nc']
movie_path = '/usr/local/src/staff/goddard/1enn.mov'
threshold = 0.12
color = (.5, .7, 0)     # red, green, blue
delay = 10              # movie frames per volume

def set_volume_threshold_and_color(threshold, rgb):
    import VolumeViewer
    d = VolumeViewer.volume_dialog()
    r = d.focus_region
    r.set_parameters(surface_levels = [threshold],      # Set threshold level.
                     surface_colors = [color])  # Set color rgb or rgba.
    d.show_region(r, 'surface')

from chimera import runCommand
runCommand('cd %s' % directory)
runCommand('movie record')
for filename in files:
    runCommand('open %s' % filename)
    set_volume_threshold_and_color(threshold, color)
    runCommand('wait %d' % delay)
    runCommand('close #0')
runCommand('movie stop')
runCommand('movie encode mformat mov output %s' % movie_path)

More information about the Chimera-users mailing list