[Chimera-users] Camera parameters

Tom Goddard goddard at cgl.ucsf.edu
Mon Jul 26 19:03:35 PDT 2010


Hi Matt,

   The Chimera camera always points along the negative z-axis.  The 
positions of the models are moved/rotated to get different view-points.  
Do you mean you want camera location (x,y,z) and horizontal angular 
field of view to the edges of the window (for perspective projection)?  
I know how to get at these using Python code, but I'm not sure if any 
Chimera commands report those values.  Also I don't know if that info 
makes its way into X3D or VRML exported from Chimera.  Greg Couch would 
know these answers.  He is at SIGGRAPH this week.

   A quite gruesome way to get the parameters is to find them in the 
Chimera session file.

     grep formattedPositions mysession.py

     formattedPositions = {'p2': (0.3954088241213373, 
18.749999499320985, (14.059999585151672, 7.399999618530273, 
8.628906249999993), (36.02048479676247, -18.762672296762467), 
8.62890625, {(0, 0): ((13.338430482851305, 2.7738552720503122, 
6.309792459458727), (0.3889244976446376, 0.8937166155966246, 
0.22362545950400858, 33.757570197325826))}, {(0, 0, 'Volume'): (False, 
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, False, 5.0)}, 4, (29.312384727061698, 
10.919780805124898, 8.628906249999993), False), 'p1': (1.0, 
18.749999499320985, (14.059999585151672, 7.399999618530273, 8.62890625), 
(36.02048479676247, -18.762672296762467), 8.62890625, {(0, 0): 
((-1.913954659058722, -0.7459259145443079, 6.309792459458727), 
(0.3889244976446376, 0.8937166155966246, 0.22362545950400858, 
33.757570197325826))}, {(0, 0, 'Volume'): (False, 0.0, 0.0, 0.0, 0.0, 
0.0, 0.0, False, 5.0)}, 4, (14.059999585151669, 7.399999618530277, 
8.628906249999993), False)}

This is pretty messy and the values depend on which Chimera version 
saved the file.  The values are defined by Python code

     chimera/share/Midas/__init__.py in the _savePosition() routine:

     return (
         viewer.scaleFactor,
         viewer.viewSize,
         cam.center,
         cam.nearFar,
         cam.focal,
         xforms,
         clips,
         om.cofrMethod,
         cofr,
         viewer.clipping
     )


If you want a Python script to simply dump the camera positions for all 
savepos positions I can provide that.

     Tom

> Hi Tom,
>
> I am creating a workaround for my graphics problem.  What I have done in the past is to create a VRML file from Chimera export, extract the openGL camera parameters using a text editor, start up Amira, using TCL I would recreate the same camera view within Amira.  At this point I could splice animation clips made by Chimera&  Amira using Final Cut Pro.
>
> It has been a while since I have done this.  I am now looking at the exported VRML files and they are lacking the camera info.
>
> Is there a command I can use to get the camera parameters for the savepos keyframes?
>
> thanks, Matt
>
>    




More information about the Chimera-users mailing list