Next: PSFD(1) Up: WFDB Applications Guide Previous: PNWLOGIN(1)On This Page

Name

pschart - produce annotated ‘chart recordings’ on a PostScript device

Synopsis

pschart [ [ options ... ] script ... ]

Description

pschart produces high-quality annotated plots of WFDB records on PostScript devices. When rendered on a PostScript laser printer or phototypesetter, the plots closely resemble those that appear on pages 99-177 of the MIT-BIH Arrhythmia Database Directory.

pschart reads one or more script files containing newline-terminated commands. Its standard output is a PostScript file suitable for printing directly with no further processing. By default, pschart draws ‘zero-width’ lines; doing so typically reduces the printing time by a factor of three for a first-generation (300 dpi) laser printer while producing visually pleasing results. If the output is destined for a high-resolution (600 dpi or more) printer or phototypesetter, however, be sure to use the -d option (see below), or the traces and grid will be invisible (or nearly so).

Options:

-a ann
Print annotations from annotator ann (default: ‘atr’). To suppress annotation printing, use ‘-a ""’.
-A ann
As for -a, but for a second annotator. The second set of annotations is shown below the first set.
-b n
Set the binding offset to n millimeters (default: 0). The inside margin is increased by n mm, and the outside margin is decreased by the same amount.
-c string
Print ‘Copyright © string’ in the left page footer; string may include whitespace if it is quoted. The characters ‘%d’, if included in string, are replaced by the current year. A default copyright notice is printed if no -c option is specified. To suppress printing the copyright notice, use ‘-c ""’.
-C
Produce charts in color (default: black and white).
-Ca r g b
Draw annotations (if enabled) in the specified color. The color is specified using three numerical arguments (with values between 0 and 1 inclusive) that indicate the amounts of red, green, and blue respectively. Examples: -Ca 0.5 0.5 1.0 produces light blue (the default obtained using -C only); -Ca 0 0.5 0 produces a deep green color.
-Cg r g b
Draw the grid (if enabled) in the specified color. Default: red (1 0 0).
-Cl r g b
Draw labels and other non-annotation text in the specified color. Default: black (0 0 0).
-Cs r g b
Draw signals in the specified color. Default: deep blue (0 0 0.5).
-d n
Set up for using a printer with a resolution of n dots per inch (default: n = 300, the typical resolution for laser printers). For a phototypesetter, n is typically 1200 or 2400. Note that n does not have to be correct in order to get properly scaled output; the value determines the granularity of the calculations made by pschart and the line width used by the printer, but not the scales.
-e
Process even-numbered pages in a manner appropriate for two-sided printing. Even-numbered pages are printed with reversed page headers, and with the outside margin on the left (default: page headers are not reversed, and the inside margin is always on the left).
-E
Generate EPSF format (encapsulated PostScript file format), suitable for inclusion in another PostScript file.
-g
Print a 0.5 mV x 0.2 sec grid with 0.1 mV x 0.04 sec subticks under each strip (default: no grid). This grid is drawn using the grid procedure in the prolog file (see ENVIRONMENT below).
-G
Print a 0.5 mV x 0.2 sec grid without subticks under each strip (default: no grid). This grid is drawn using the Grid procedure in the prolog file (see ENVIRONMENT below).
-h
Print a usage summary.
-H
Read the signal files in high-resolution mode (default: standard mode). These modes are identical for ordinary records. For multifrequency records, the standard decimation of oversampled signals to the frame rate is suppressed in high-resolution mode (rather, all other signals are resampled at the highest sampling frequency).
-i file
Print the (text) contents of file instead of the title in the title area of the first page of output. The text is printed in a monospaced font; use spaces rather than tabs in the text to align columns.
-l
Label the signals in the margins next to each strip (default: no signal labels).
-L
Print in landscape orientation (default: portrait orientation).
-m inside outside top bottom
Specify page margins in millimeters. Defaults: top and bottom, 25 mm; inside and outside, 25-37.5 mm (half of the difference between the page width and the default strip width). The default strip width is the largest multiple of 25 mm that is at least 50 mm less than the page width. Note that page headers and footers, time stamps, and signal labels are printed in the margins. Also note that hardware-enforced, printer-specific margins are not included; the margins specified using -m apply to the imageable area, and not necessarily to the physical page.
-M
Print marker bars across the signals to show the locations of beat annotations (equivalent to -M1).
-Mbarstyle
Set marker bar and annotation format (note: no space between -M and barstyle). Legal values for barstyle: 0 (no bars); 1 (bars across all signals); 2 (bars across attached signal, annotations at center); 3 (bars across attached signal, annotations above bars). Default: barstyle = 0.
-n n
Use n as the number of the first page (default: 1). Use ‘-n 0’ (or any negative value for n) to suppress page numbering.
-p
Pack sufficiently short strips side-by-side (default: print each strip centered between the inside and outside margins in a row by itself).
-P pagesize
Specify the size of the output pages to be printed. Legal values for pagesize are: ‘letter’ (8.5" x 11", 216 mm x 279 mm; imageable area 209 mm x 272 mm), ‘lwletter’ (8.5" x 11", 216 mm x 279 mm; imageable area 203 mm x 277 mm), ‘legal’ (8.5" x 14", 216 mm x 356 mm; imageable area 209 mm x 348 mm), ‘legal13’ (8.5" x 13", 216 x 330 mm; imageable area 209 mm x 322 mm), ‘A4’ (8.27" x 11.69", 210 mm x 297 mm; imageable area 202 mm x 289 mm), ‘A5’ (5.84" x 8.27", 148 mm x 210 mm; imageable area 140 mm x 202 mm); ‘B4’ (9.84" x 13.9", 250 mm x 353 mm; imageable area 249 mm x 356 mm), ‘B5’ (6.93" x 9.84", 176 mm x 250 mm; imageable area 173 mm x 249 mm), or ‘widthxheight’ (where width and height are the width and height of the imageable area in millimeters). ‘lwletter’ is the standard letter size for the Apple LaserWriter; all of the other predefined page sizes are those used by the Sun SPARCprinter. Note that some printers may require non-standard PostScript code to select non-standard page sizes; in such cases, it may be necessary to customize the prolog file (see FILES). Default: letter size.
-r
Print ‘‘Record xxx’’ as the first part of the title of each strip, where xxx is the record name.
-R
Print a record name as part of the header on each page. If strips from two or more records are printed on one page, the name of the last record is printed.
-s signal-list
Print only the signals named in the signal-list (one or more signal numbers or names, separated by spaces; default: print all signals).
-S scale-mode timestamp-mode
Print scales and timestamps in the specified modes. Legal values for scale-mode: 0 (no scales); 1 (mm/unit in footers); 2 (units/tick in footers); 3 (mm/unit above strips); 4 (units/tick above strips); 5 (mm/unit within strips); 6 (units/tick within strips). Legal values for timestamp-mode: 0 (no timestamps); 1 (elapsed times only); 2 (absolute times if defined, elapsed times otherwise). Defaults: scale-mode = 1, timestamp-mode = 2.
-t n
Set the time scale to n millimeters per second (default: n = 12.5, half of the standard scale for chart recorders).
-T title
Set the page title to title (which may include whitespace if quoted). If no -T option is specified, the page title is constructed from the date of the last recording on the page, if defined, or today’s date otherwise. To suppress printing the page title, use ‘-T ""’.
-u
Generate ‘unstructured’ PostScript as a workaround for a bug in the Adobe TranScript software (also see ENVIRONMENT below). Default: generate structured PostScript, suitable for processing by page-selection or page-reversal post-processors.
-v n
Set the voltage (ordinate) scale to n millimeters per millivolt. Signals that do not have units of millivolts (as specified in the record’s header file) are scaled proportionately, as specified by the calibration file (see wfdbcal(5) ). The default scale is 5 mm/mV, half of the standard scale for chart recorders.
-V
Verbose mode (echo each command as it is read from the script file).
-w n
Set the line width for signals, grid lines, and marker bars to n mm. Default: 0 (the narrowest possible width; note that some devices may not render zero-width lines correctly).
-1
Print only the first character of each comment annotation.

Color output

If none of the -C options is used, output is in black and white. If any color option is used, output is in the default colors (light blue annotations, red grid, black labels, deep blue signals) unless overridden by one or more of the -Ca, -Cg, -Cl, or -Cs options. Color output can be rendered in greyscale by monochrome PostScript printers, although black-and-white output may look better in such cases.

Scripts:

Any argument that is not an option or an option argument is taken as the name of a script of newline-terminated commands to be executed by pschart. If the script name is ‘-’, pschart reads commands from the standard input. Options that follow a script name are not applied to the processing of that script, so it is possible to use two or more scripts with different sets of options in a single run. Standard commands are of the following form:
   record time title

in which record is the name of the record for which a strip is to be printed, time indicates the time of the left edge of the strip to be printed, and title is a description to be printed above the strip. Fields are separated by spaces or tabs. If the time field contains a hyphen (‘-’), the portion that precedes the hyphen is taken as the time of the left edge of the strip, and the portion that follows the hyphen indicates the end of the desired segment; additional strips continuous with the first are printed if necessary. Unless the -p option is specified, strips that are less than the full width of the page are centered within the margins. The title field may include embedded spaces or tabs, or it may be omitted. A totally empty command line specifies a page break, i.e., it causes pschart to put the next strip at the top of a new page, even if the current page is not full.

Environment

The environment variable PSCHARTPRO can be used to name an alternate prolog file (see below) for custom formats. The environment variable TRANSCRIPTBUG may be set (to any value) to generate ‘unstructured’ PostScript by default (see the -u option above). It may be necessary to set and export the shell variables WFDB and WFDBCAL (see setwfdb(1) ).

Files

/usr/local/lib/ps/pschart.pro
default PostScript prolog file.
/usr/local/lib/ps/12lead.pro
alternative PostScript prolog file, suitable for printing standard 12-lead diagnostic ECGs (10 seconds, 4 traces, with the top three traces divided into 2.5 second segments by marker bars). This file redefines the grid drawn by the -G option (see the Grid procedure for details).

Bugs

On older PostScript printers, output may be quite slow. A full page, with grids and default scales, typically takes about 3 minutes to render on an Apple LaserWriter, or about 6 minutes on a Linotronic 1200 dpi phototypesetter. Most modern printers can render pschart output at nearly full speed.

If the record you wish to plot is sampled at a very high rate relative to the printer resolution (i.e., if one sample interval would appear on the page as much less than the distance between pixels), you may wish to use xform(1) to decimate to a lower frequency for efficiency’s sake. In extreme cases, this may be necessary to avoid running out of memory in your PostScript printer.

Specifying EPSF output using the -E option does not prevent pschart from producing multi-page output, which is not permitted in EPSF. You should make sure that your output fits entirely onto one page (most easily verified using the -V option) before including it in another document. Note that the bounding box calculated by pschart covers the entire width of the page and most of its height (excluding only about half of the top and bottom margins, so that the header and footer material is included), even if only a small portion of the page contains plots. If you wish to fit such a plot into another document with a minimum of empty space around it, you may either edit the bounding box comment in the pschart output, or specify a page size that closely matches the size of your plot. The document in which pschart output is included can arbitrarily rescale the plot, so that scales expressed in mm/unit cannot be relied upon.

Under MS-DOS, a bug in command.com makes it impossible to pass an empty string in the argument list of a command, so that -a "", -c "", and -T "" do not work as described above. Type a space between the quotation marks to avoid this bug, or use one of the UNIX shells that have been ported to MS-DOS instead of command.com.

There are too many options. Invoke pschart with no arguments for a brief summary of options.

Availability

This program is provided in the app directory of the WFDB Software Package. Run make in that directory to compile and install it if it have not been installed already.

The PhysioNet ATM (http://physionet.org/cgi-bin/ATM) provides web access to pschart (select Plot waveforms from the Toolbox).

See Also

psfd(1) , setwfdb(1) , wave(1) , xform(1)

Author

George B. Moody (george@mit.edu)

Sources

http://www.physionet.org/physiotools/wfdb/app/pschart.c
http://www.physionet.org/physiotools/wfdb/app/pschart.pro


Table of Contents

Up: WFDB Applications Guide


Please e-mail your comments and suggestions to webmaster@physionet.org, or post them to:

PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 10 June 2022