Software for 15-463

This page describes the software we have installed for use in 15-463. Software listed here is generally useful. There may also be specific programs for use with particular assignments. You should look at the appropriate assignment page for relevant documentation.

Example Code: If you're wondering how to use all this stuff, try looking at my example program in pub/src/tifflmap/. It contains both an example Makefile and the C code for the program. It's a very simple example of reading a TIFF file, manipulating the pixels, and writing a TIFF file. It applies a linear map, ap + b to each channel of each pixel.


Setting up

In order to easily use the software for the class, you will want to add various things to your .login file. Basically, you want to tell your shell where the binaries are, where the shared libraries are, and where the man pages are. Assuming that you're running csh, the lines below should do the trick. On Andrew, these lines should come after the sourcing of /usr/local/lib/global.login.

   setenv cs463 /afs/andrew.cmu.edu/scs/cs/15-463/pub
   set path = ($path ${cs463}/bin)

   setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${cs463}/lib

   setenv MANPATH /usr/man:/usr/local/man:/usr/contributed/man:${cs463}/man
On SGI's, the LD_LIBRARY_PATH is not initially defined, so you just want to say
   setenv LD_LIBRARY_PATH ${cs463}/lib
and you should use the following MANPATH instead:
   setenv MANPATH /usr/share/catman:/usr/share/man:/usr/catman:/usr/man:/usr/local/man:${cs463}/pub/man

Using Make and our libraries

I suggest that you use something like the following at the beginning of your Makefiles.

   CS463 = /afs/andrew/scs/cs/15-463/pub

   OPTFLAGS = -g # Or whatever optimization policies you want

   INCDIR = $(CS463)/include
   LIBDIR = $(CS463)/lib

   CFLAGS = -I$(INCDIR) $(OPTFLAGS)
   LFLAGS = -L$(LIBDIR) $(OPTFLAGS)
Now, make sure that you use $(CFLAGS) when compiling C source code and $(LFLAGS) when linking. The compiler should be able to find the headers and libraries described below.

Available Libraries

libtiff
This is a library by Sam Leffler from SGI. It supports the reading and writing of TIFF files. We have the documentation that comes with the library. For those who are interested finding out about the gory details of the TIFF format, we have the official TIFF specifiction from Aldus (now Adobe). The man pages are installed in our directories as well.

NOTE: In Andrew, an older version of libtiff is installed in /usr/local. Linking with this library should not cause you problems. However, you might want to make sure that you're using our version of the library just to be on the safe side.

libpicio
This is a little library provided for your convenience. It supports a very simple interface to read picture files. Our programs, such as xplay, use this library. The features you might be interested in are tiff_read and tiff_write. To use this library, you need to put #include <pic.h> in your source code and -lpicio on your link line. Currently, the only documentation for the library is the header file.

libforms
The graphical interface of medit is provided by the XForms library. You probably won't need this for anything, but it's here anyway. You can read the XForms documentation and you can run the interface designer, fdesign.

To see how to use the TIFF library, I suggest you look at the source for pub/src/libpicio/tiff.c. When implementing your assignments, you have the option of using our libpicio routines to write TIFF files, or you can write your own. If you want to write you own, tiff.c should provide a good starting point.

Available Programs

xplay
xplay is our simple program for displaying image sequences under X11. The usage of xplay is as follows:
Usage: xplay [options] PICFILE1 PICFILE2 ...
Displays PPM or TIFF picture files in rapid sequence
    options:
    -zoom Z     zoom picture by factor of Z (e.g. "-zoom 2" doubles)
    -newcm      create a new colormap (makes playback look best,
                    but might make other windows look odd)
    -ncolor N   requests that N or fewer colors be used (default=256)
    -gray       force grayscale display (only relevant on color display)
    -nodither   don't dither pixel values
    -depth D    requests depth of D bits per pixel, where D=24 or 8
                    (default is to try 24 first, then 8)
    -gamma G    use a gamma of G. G>1 lightens, G>1 darkens.
                    (default: G=1.7)
    -abbrev     abbreviate file name in window name
    -grid       don't perform adaptive color quantization

TIFF tools
We've installed various TIFF tools from the libtiff distribution. You can read the man pages to find out how they work, and you can look at the TIFF tools overview to get an idea of what they do.

fdesign
The interface designer for XForms. Documentation on its use can be found in the XForms documentation.


January 25, 1996
garland@cs.cmu.edu