The avf2ppm utility converts a collection of vector field files (e.g., .omf, .ohf) into color bitmaps suitable for inclusion into documents or collating into movies. The command line arguments control filename and format selection, while plain-text configuration files, modeled after the mmDisp configuration dialog box, specify conversion parameters.
Launching
The avf2ppm launch command is:
tclsh oommf.tcl avf2ppm [standard options] [-config file] [-f] \ [-filter program] [-format <P3|P6|B24>] [-ipat pattern] \ [-opatexp regexp] [-opatsub sub] [-v level] [infile ...]where
(\.[^.]?[^.]?[^.]?$|$)
.ppm for type P3 and P6 file output,
.bmp for B24 file output.
Note that by default avf2ppm is run with the standard option
-tk 0. This means
avf2ppm will not use or initialize Tk.
Tk is only needed to convert background color requests
(see misc,background in the configuration file discussion below)
from symbolic form to hexadecimal representation
(#RRGGBB). If the background color is not specified using the
hexadecimal format, then Tk is needed, and avf2ppm must be
run with -tk 1.
The file specification options require some explanation. Input files may be specified either by an explicit list (infile ...), or by giving a wildcard pattern, e.g., -ipat *.omf, which is expanded in the usual way by avf2ppm (using the Tcl command glob). Unix shells (sh, csh, etc.) automatically expand wildcards before handing control over to the invoked application, so the -ipat option is not needed (although it is useful in case of a ``command-line too long'' error). DOS does not do this expansion, so you must use -ipat to get wildcard expansion in Windows.
As each input file is processed, a name for the output file is produced from the input filename by rules determined by handing the -opatexp and -opatsub expressions to the Tcl regsub command. Refer to the Tcl regsub documentation for details, but essentially whatever portion of the input filename is matched by the -opatexp expression is removed and replaced by the -opatsub string. The default -opatexp expression matches against any filename extension of up to 3 characters, and the default -opatsub string replaces this with the extension either .ppm or .bmp.
If you have command line image processing ``filter'' programs, e.g., ppmtogif (part of the NetPBM package), then you can use the -filter option to pipe the output of avf2ppm through that filter before it is written to the output file specified by the -opat* expressions. If the processing changes the format of the file, (e.g., ppmtogif converts from PPM to GIF), then you will likely want to specify a -opatsub different from the default.
Here is an example that processes all input files with the .omf extension, sending the output through ppmtogif before saving the results in a files with the extension .gif:
tclsh oommf.tcl avf2ppm -ipat *.omf -opatsub .gif -filter ppmtogif
(On Unix, either drop the -ipat flag, or use quotes to protect the input file specification string from expansion by the shell, as in -ipat '*.omf'.) You may also pipe together multiple filters, e.g., -filter 'ppmquant 256 | ppmtogif'.
Configuration files
The details of the conversion process are specified by plain-text
configuration files, with fields analogous to the entries in the
mmDisp configuration dialog
box. Each of the parameters is an element in an array named
plot_config. The default values for this array are taken from the
default configuration file
oommf/app/mmdisp/scripts/avf2ppm.def,
which is a Tcl script read during avf2ppm initialization.
The sample default configuration script can be used as a starting point for user (per-run) configuration files. Refer to this sample file and the mmDisp documentation as we discuss each element of the array plot_config. (See the Tcl documentation for details of the array set command.)
array set plot_config {
colormaps { Red-Black-Blue Blue-White-Red Teal-White-Red \
Black-Gray-White White-Green-Black Red-Green-Blue-Red }
arrow,status 1
arrow,colormap Black-Gray-White
arrow,colorcount 0
arrow,quantity z
arrow,autosample 1
arrow,subsample 10
arrow,size 1
arrow,antialias 1
pixel,status 1
pixel,colormap Teal-White-Red
pixel,colorcount 225
pixel,quantity x
pixel,autosample 1
pixel,subsample 2
pixel,size 1
misc,background #FFFFFF
misc,drawboundary 1
misc,margin 10
misc,width 640
misc,height 480
misc,crop 1
misc,zoom 0
misc,rotation 0
}
User (per-run) configuration files are specified on the command line with the -config option. To create a user configuration file, make a copy of the default avf2ppm.def configuration file, and edit it as desired in a plain text editor. You may omit any entries that you do not want to change from the default. (Each entry consists of a name + value pair, e.g., misc,width 640.) You may ``layer'' configuration files by specifying multiple user configuration files on the command line. These are processed from left to right, with the last value set for each entry taking precedence.