to teem

Build

teem

Windows users (except Cygwin):

Windows users should click here.

Non-Windows users (including Cygwin):

To build teem you will need GNU make. I am in fact using many GNU-make-specific features, and all my makefiles are actually named GNUmakefile instead of Makefile to minimize the chances of someone trying to use a non-GNU make.
  1. Download the teem distribution
  2. Untar it.
    Throughout this and all other teem documentation, the directory just created will be referred to as "teem", even though it will actually be called "teem-1.XblahN" or something similar.
  3. Go into this directory.
  4. Depending on what architecture you're on, set the TEEM_ARCH environment variable (however you do that in your favorite shell) to one of the following:
  5. cd src; make
    This will build and "install" all the teem libraries, as well as all the command-line tools. This build will take a little while. On a multi-processor machine, building teem-1.5betaX or later, feel free to use "make -j10" or similar to speed this up. NOTE: This isn't an "install" in the traditional Unix build sense, since no files will be created outside the top-level teem directory. Headers are put in teem/include, libraries are created in teem/<arch>/lib, and the command-line tools in teem/<arch>/bin, where "<arch>" is the same as what you set TEEM_ARCH to.
  6. cd ../<arch>/bin
  7. ./nrrdSanity
    This little program calls a nrrd function called nrrdSanity() which basically makes sure that everything hard-coded (or set at compile-time) into nrrd is correct for the machine you're on. For instance, the various assumptions about type sizes and representational ranges are checked, as is endianness, and the availability of IEEE 754 floating point numbers. If you get anything besides:
    ./nrrdSanity: nrrd sanity check passed.
    
    then your teem build will not work correctly. Either one of the default settings in the architecture-specific makefile teem/src/make/<arch>.mk is wrong, or your machine isn't up to snuff. In either case, email me (gk@cs.utah.edu) with the error message from nrrdSanity.
The compilation process is controlled by an assortment of environment variables, all starting with TEEM_. The TEEM_ZLIB, TEEM_BZIP2, and TEEM_PNG variables only need to be set; they don't need to be set to any particular string. If they are set, then the nrrd library is compiled with something optional turned on; either the zlib or bzip2 compression encodings, or the PNG image file format. More on these below. The other environment variables need to be set to a particular string.
TEEM_ARCH The architecture you're building on and for; described above.
TEEM_DEST If you'd rather everything be installed to some other directory (with include, lib, and bin subdirectories), then set environment variable TEEM_DEST to that directory, and make will put headers, libraries, and binaries in the corresponding subdirectories of TEEM_DEST.
TEEM_ZLIB If this is set (but it doesn't need to be set to anything in particular), nrrd will do zlib compression and decompression of data. It also enables the "-e gzip" encoding flag in unu save. Gzip/gunzip are command-line tools which uses zlib compression; the format nrrd uses for zlib-compressed data is always compatible with the gzip command-line tool. Enabling zlib also enables PNG images, since these are always zlib-compressed.
TEEM_BZIP2 This allows nrrd to do bzip2 compression and decompression, enabling the "-e bzip2" encoding flag in unu save. The data compressed this way is compatible with the bzip2/bunzip2 command-line tools.
TEEM_PNG This enables nrrd to read and write PNG images. Because the key/value chunk in PNG is used to store NRRD headers (such as axis labels, mins, and maxs) this means PNG is a a completely lossless format to store NRRDs, as long as they are 8 or 16 bit unsigned, either 2-dimensional, or 3-dimensional with 1, 2, 3, or 4 samples along axis 0. PNGs can be viewed with most browsers, and can even be imported into Powerpoint!

The following versions of the optional libraries are recommended:

Note that on Linux you may have to get the "development" version of the package ("...-dev") in order to get the headers and libraries, instead of just the associated command-line tools and their documentation.

In case you do not have the workable versions of zlib, bzip2, and png installed in /usr/local/ on your system (or wherever the C compiler looks for headers and libraries by default), you can teach the teem makefiles where to find them by setting more environment variables. In the following, "XXX" stands for either "ZLIB", "BZIP2", or "PNG".

TEEM_XXX_IPATH This is the include flag to be passed the compiler, to tell it where to find the header files for optional thing XXX. It should be of the form "-I<path>", such as "-I/home/gk/include".
TEEM_XXX_LPATH This is the link flag to be passed to the linker, to tell it where to find the library for optional thing XXX. It should be of the form "-L<path>", such as "-L/home/gk/lib". The makefiles know the name of the library; you do need to (nor can you) supply the library link flag itself (e.g. "-lzlib"); this is done by the makefiles for you.

If interested, you can read more about the directory structure of teem. For more specific information about how the GNUmakefiles work, or how to use them to do something besides the standard install described above, see How teem uses GNU make.