1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
<html>
<head>
<title>Converting Molscript labels to Raster3D</title>
<!-- OWNER_NAME="Ethan A Merritt, Biological Structure" -->
<LINK rev=made href="mailto:merritt@u.washington.edu">
<!-- OWNER_INFO="University of Washington Box 357742, Seattle WA 98195" -->
<LINK REL=stylesheet HREF="r3d_docstyle.css" TEXT="text/css">
</head>
</body>
<h1 align=center>Converting Molscript labels to Raster3D</h1>
<hr>
The most frequent question I get about Raster3D is "How can I get the labels
from Molscript into my Raster3D picture?".
There is now a very easy answer - <i>"Install Molscript Version 2!"</i>
The newer Molscript version (available via the web from
<a href="http://www.avatar.se/molscript">http://www.avatar.se/molscript</a>
draws labels in such a way that they will simply appear in your Raster3D
image along with everything else.
<p>
The rest of this information is therefore now obsolete, at least with regard
to Molscript. It may, however, be useful as an example of how to mix
PostScript and Raster3D processing. Generally this requires more effort than
the result is worth.
I recommend simply labelling your Raster3D output image using an interactive
annotation tool on a workstation screen (e.g. the annotate mode of
ImageMagick's display program). However, for anyone bound and determined to
use Molscript for labelling I will describe how it can be done.
<ol>
<li>The first thing to do is to establish the size of your eventual image in
pixels. Let us say that you want a 3-inch by 2-inch print to be produced on
a 300 dpi dye sublimation printer. 300 dpi (dots per inch) times the
desired size gives 900x600 pixels for the image size. Construct a header
file for the render program which describes this image size; e.g.
<pre>
My new picture with no anti-aliasing
45 30 NTX,NTY number of tiles in x, y
20 20 NPX,NPY number of pixels per tile
1 anti-aliasing scheme 1 (none) or 4 (smoothed)
0 0 0 black background
(etc...)
</pre>
Pay particular attention to the fact (yes, it's confusing) that if you use
anti-aliasing schemes 2 or 3 then the eventual number of pixels is not
simply the product NTX*NPX,NTY*NPY. This is explained in the render manual.
<li>Now make sure that your Molscript input file is actually drawing in a box
of the shape you have just described. To use the procedure I describe below,
you must use the "area" command of Molscript to force the
lower left corner to (0,0) and the upper right corner to (900,600). Furthermore
there must be no bordering frame drawn around the image. So your Molscript
input file will begin:
<pre>
plot
noframe
area 0. 0. 900. 600. ;
background black ;
</pre>
<li>Run Molscript with the -raster3d option to produce an input file to render
which uses the header you constructed in step 1.
<pre>
molscript -r < picture.mol | render | convert avs:- picture.ppm
</pre>
<li>Edit the molscript file to remove or comment out all drawing commands
except for the labels. Run molscript again, this time in PostScript mode,
to produce a PostScript file containing only the labels.
<pre>
molscript < picture_labels.mol > labels.ps
</pre>
<li>Use ghostscript to convert the PostScript file into a raster image exactly
the same size as your Raster3D image.
<pre>
gs -sDEVICE=ppm -sOutputFile=labels.ppm -g900x600 labels.ps
</pre>
At this point you have two images:
<pre>
picture.ppm 900x600 Raster3D image from original Molscript file
labels.ppm 900x600 image containing only the labels
</pre>
<li>Use the combine program from ImageMagick to draw the labels on top of the
Raster3D image.
<pre>
combine -compose atop labels.ppm picture.ppm pic+labels.ppm
</pre>
<li> I used the ppm raster file format throughout this example just because
it works in both ImageMagick and ghostscript. This may be installation
dependent, however. I'll now convert it back to a TIFF file.
<pre>
convert pic+labels.ppm beautiful.tiff
</pre>
As you see, this is a rather lengthy procedure. Furthermore, the label
positioning will be slightly off compared to the pure PostScript version
because Raster3D and Molscript treat perspective differently. As I say,
I prefer to just type in the labels interactively so that I can see where
they are going.
</ol>
</body>
<hr>
<a href="raster3d.html">
<img src="index_button.gif" align=top> Back to top </a>
<a href="http://www.bmsc.washington.edu/raster3d/raster3d.html">
<img src="r3d_icon.gif" alt="" align=top> Raster3D homepage </a>
<hr>
<address>
Ethan A Merritt / merritt@u.washington.edu /
<a href="http://www.bmsc.washington.edu/index.html">
Biomolecular Structure Center at UW</a><br>
</address>
</html>
|