[Chimera-users] Fit-to-window for procedurally generated images

Tom Goddard goddard at sonic.net
Fri Dec 9 14:16:29 PST 2016

Hi Mike,

  Here's an explanation of why the "window" command doesn't make the molecule exactly fill the window.  I don't have any suggestion to remedy this but at least it will help you understand what the window command does.  The visible parts of the molecule has a bounding computed in the atomic coordinate system of the molecule.  By the coordinate system of the molecule I mean the x,y,z values that came from the PDB file.  The window command centers and scales to just fit that bounding box in view.  So if you chimera/ a spherical shaped molecule the bounding box has lots of empty space near the corners.  If you open it and don't rotate it will fit pretty nicely in the window without extra padding after the "window" command.  But if you rotate it 45 degrees so the box corners are now touching the edges of the window then the "window" command appears to leave lots of extra padding at the edge.   The ratio of the width of the long diagonal of a cube to its edge length is 1.7 (sqrt(3)) so in this worst case orientation the spherical molecule may actually be scaled 1.7 times smaller than what is necessary for the molecule to touch the edges of the window.

  All bounds calculation are based on bounding boxes in the molecule coordinate frame, so there is no capability in Chimera to avoid this inaccuracy in the knowing the right scale to fit in a window.


> On Dec 9, 2016, at 1:45 PM, Elaine Meng wrote:
> Hi Mike,
> I have been bothered by this issue myself…
> There is a “window” command that is meant to fill that need.  However, in my experience, it generally leaves too much space around the structures.  Maybe it is a tolerable amount; take a look. One could use “window” or the similar “focus” (each without arguments) and then “scale" up empirically something like 1.2X, but with that approach there is no guarantee some bit won’t fall outside the frame. 
> <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/window.html>
> <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/focus.html>
> <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/scale.html>
> The extra space is larger in the default perspective mode, as opposed to the orthographic projection (see “set projection” or the Camera tool if interested).
> <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/set.html#projection>
> Sorry I don’t have a definitive solution to maximize the use of pixels,
> 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 Dec 9, 2016, at 9:17 AM, Mike Sivley wrote:
>> I am procedurally generating images of protein structures using a Chimera python script. I can center the protein structure within the viewing window, align the protein to emphasize certain elements, set the output size of the final image, and manually apply a scale factor to the view, but I have not found a way to ensure that the protein structure is maximized (but fully contained) within the final image. Is there a "fit-to-window" command that will automatically scale the view in this way?
>> Thanks!
>> Mike Sivley
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

More information about the Chimera-users mailing list