From: todd@statsci.com (Todd Cromwell)
Subject: S-PLUS version 3.1 for Sun SPARC, image library
X-Gateway: dmssyd.syd.dms.CSIRO.AU
Organization: CSIRO Div. Maths & Stats, CSIRO Div. Applied Physics
Date: Tue, 12 Jan 1993 04:42:08 GMT

Dear S-PLUS version 3.1 for Sun SPARC users,

If you want to use the AT&T image library with S-PLUS version 3.1 for
Sun SPARC, you need to do the following steps before using it as you
would with the AT&T version of S.

1. In UNIX, create a pwd script in the cmd directory under the
directory where you installed S-PLUS.  You may need to be root or
whoever installed S-PLUS to do this.  You need this pwd script because
the image code does "S pwd", and our StatSci S script won't find the
pwd program unless it's in the cmd directory.

cat >`Splus SHOME`/cmd/pwd
#!/bin/sh
newpath=`echo $PATH | sed -e "s,$SHOME/cmd:*,,g"`
PATH=$newpath
pwd
<hit ctrl-D here>

Make the script executable:

chmod +x `Splus SHOME`/cmd/pwd

2. In S-PLUS, attach the libraries.  The image library should be
attached with first=T, so you get the image function from the image
library rather than our StatSci image function.  You also need to
attach the "Defunct" library, to get the AT&T supplied postscript
driver (called "opostscript"), which supports the image library.

library("external")
library("image",first=T)
library("Defunct")

3. The image library needs to use the "opostscript" driver (AT&T's
postscript driver, but we renamed it) rather than the StatSci
"postscript" driver, because our postscript driver doesn't support the
image libary.  Therefore, you need to make a new show.image function
(in S-PLUS) with a change that makes show.image use "opostcript".
Make the change for yourself in your own working data, or put the new
show.image in a place where everyone can get to it, or install it in
the image library .Data directory.  If you simply use the vi function
in S-PLUS to change it by saying "show.image <- vi(show.image)",
you'll get a new version of show.image in your working data, which
will suffice.  The following is a context diff, but you can just
change show.image by hand (the old context is listed then the new,
with one line changed -- change "postscript" to "opostscript").

*** show.image.q.old    Mon Jan 11 14:45:20 1993
--- show.image.q.new    Mon Jan 11 14:42:12 1993
***************
*** 21,27 ****
        }
        switch(.Device,
                news = NeWS.image(im, where, ...),
!               postscript = ps.image(im, where, ...),
                iris4d = iris.image(im, where, ...),
                x11 = x11.image(im, where, ...),
                stop(paste("show.image not supported on device", .Device)))
--- 21,27 ----
        }
        switch(.Device,
                news = NeWS.image(im, where, ...),
!               opostscript = ps.image(im, where, ...),
                iris4d = iris.image(im, where, ...),
                x11 = x11.image(im, where, ...),
                stop(paste("show.image not supported on device", .Device)))

4. You can copy the following ASCII README file to the directory shown
by the UNIX command

echo `Splus SHOME`/library/image

if you want.

------------cut here---------
This section contains an implementation of images as external objects
in S-PLUS.  The material is experimental and is not supported by
StatSci.

To use, you must attach the image library section first since the
function `image' in this section masks the S-PLUS function `image'. You
must also attach the external library section, i.e.:

> library(image,first=T)
> library(external)

Most of the image processing functions require the PBMPLUS portable
bitmap toolkit which, at the time of this writing, is available free by
anonymous ftp as ftp.ee.lbl.gov:pbmplus*.tar.Z,
export.lcs.mit.edu:contrib/pbmplus*.tar.Z or
wuarchive.wustl.edu:graphics/graphics/packages/pbmplus/pbmplus*.tar.Z.
The author can be contacted at jef@well.sf.ca.us.

The only available graphics device driver for displaying these images
is the original AT&T PostScript device, now called `opostscript'.  This
device driver is available in the library section Defunct i.e. to use
it you must first type:

> library(Defunct)

For more information on these image functions see:
John M. Chambers and Neil Crellin, "Images in S", AT&T Bell
Laboratories Stat. Res. Report No. 100 (Dec. 1991).
------------cut here---------

5. Now you can proceed as before.  For example, you can do the example
in the image help file:

test.pattern <- image(20,20)  # create a new 20x20 image
sp <- make.spans(1,400)       # will fill it all at once
spans(test.pattern, sp) <- rep(1:5,rep(80,5)) # with horizontal bars
opostscript(file="/tmp/test.pattern.ps")
plot(test.pattern)
dev.off()
q()
lpr /tmp/test.pattern.ps
Newsgroups: aus.stats.s