Written by Ofri Sadowsky, 2003-02-02
Slicer is a “freely available, open-source software for visualization, registration, segmentation, and quantification of medical data.” Slicer is available from http://www.slicer.org. There were various revisions to the Slicer code base, the most significant thereof was the introduction of Slicer-2, which is built using VTK-4, while previous versions of Slicer used VTK-3. Slicer-2 is on the web at http://slicer.ai.mit.edu/slicer2/Doc/index.html.
This document describes the installation process on the Linux workstation 'tragus' (Red Hat Linux release 8.0 (Psyche)). There may be available RPM for Slicer, but more often than not, there are revision conflicts between the “official release” of Slicer, and one of the software packages on which it depends. Therefore, it is advisable to acquire the recent nightly build of Slicer through cvs. Our installation process follows the instructions on the Slicer web pages, but these may be inaccurate or incomplete, and so we extend the explanation beyond them.
Slicer depends on external packages, including Tcl/Tk, VTK, and, possibly, ITK. Tcl/Tk has stable RPM for Linux, and is not described here. VTK installation instructions are in VTK.Linux.html. ITK installation instructions are in ITK.Linux.html. It is recommended to use the nightly cvs versions of both VTK and ITK for compatiblity with Slicer.
The installation of Slicer uses CMake (see CMake.Linux.html). A typical example of using CMake is in VTK.Linux.html. You may like to switch on to the advanced options to choose your own compiler and possibly other configuration parameters. This document does not deal with these, and assumes previous experience with CMake, e.g., when installing VTK.
Obtain the cvs source code through cvs: On the Slicer-2 web page, select “Developer's Guide”/“CVS Access”, or see the bookmark http://slicer.ai.mit.edu/slicer2/Doc/devl/index.html#10. I had the distribution checked-out in usr/local/erc-share/downloaded-src/slicer2-cvs into a slicer2 subdirectory. We shall refer to this subdirectory hereafter as SLICER_HOME.
Follow the instructions on the Slicer-2 web page (Section 5). You should build/install VTK first. Then, create a directory named “redhat-8.0” (which we call later OS_DIRNAME) under ${SLICER_HOME}/Base/builds, and cd there. Run cmake -i ../.. and/or ccmake ../.., followed by a make. This builds the basic Slicer package. You can follow the configuration in Section 5. The most important value to set up is VTK_BINARY_PATH, and also set USE_BUILT_VTK to ON.
Before starting Slicer, you need the following environment variables set. The values below are examples, and should be set according to your system's configuration. These values are stored on tragus in ${SLICER_HOME}/slicer-env.
setenv
VTK_HOME /usr/local/erc-share/vtk4x-cvs/VTK
setenv SLICER_HOME
/usr/local/erc-share/downloaded-src/slicer2-cvs/slicer2
setenv
TCL_LIBRARY /usr/lib/tcl8.3
setenv TK_LIBRARY
/usr/lib/tk8.3
setenv LD_LIBRARY_PATH
${SLICER_HOME}/Base/builds/redhat-8.0/bin
setenv TCLLIBPATH
"${SLICER_HOME}/Base/Wrapping/Tcl/vtkSlicerBase
S{VTK_HOME}/Wrapping/Tcl"
To launch Slicer, cd to
SLICER_HOME and type
> vtk
./launch.tcl
which runs a local Tcl/Tk script for Slicer.
As of the creation of this document, some manual configuration had
to be made, since the Slicer development team had not yet mastered
the use of CMake. Some files had to be edited and modified, and the
external modules (in the ${SLICER_HOME}/Modules
subdirectory) had to be built separately. Without these external
modules, Slicer can run, but prints odd error messages that may be
annoying. The manual changes to be made are described below.
Next to the beginning of the file, there is a switch for the value of $tcl_platform(os). Under the “Linux” value, write your OS_DIRNAME instead of “redhat7.3”.
Create a directory
${SLICER_HOME}/Lib/${OS_DIRNAME}
Create
subdirectories vtk and tclXX
under it, where XX stands for your locally installed version of
Tcl/Tk.
Create symbolic links under the vtk
subdirectory:
VTK points to your VTK_HOME.
VTK-build points to where VTK has installed its executables and libraries. For example, VTK can create them as bin and lib subdirectories under /usr/local/erc-share, in which case VTK-build points to /usr/local/erc-share.
Create symbolic links under the tclXX subdirectory:
bin usually points to /usr/lib/tclXX.
lib points to /usr/lib.
In launch.tcl, make sure that the “VTK source and binary dirs and tcl dirs” are set correctly. In particular, pay attention to the correct version of tcl.
In launch.tcl, where there is a switch or other decision for the value “redhat7.3”, replace it with or add to it your OS_DIRNAME.
Set the values of the variables TCL_LIBRARY_ and TK_LIBRARY to include the correct version of your Tcl/Tk
Note that some of these changes may already be reflected in your environment settings above, and some may be different. Since launch.tcl is the script that starts Slicer, I find it better at least to make it self-consistent.
You'll have to edit the script ${SLICER_HOME}/Scripts/cmaker.tcl and set the variables according to your system's configuration. In particular, make sure that the BUILD variable is the same as your OS_DIRNAME.
In the list of TARGETS, the Modules/vtkSlicerTensors target is unavailable at the moment, and should be removed from the list.
You may encounter compilation errors caused by incompatibility between the VTK version on the developers' system and on yours. To fix this, you may have to edit the C++ files that produce the errors, and manually add an #include directive so that the missing class declarations will be included.
The module vtkITK could not be compiled this way, and requires some more tweaking.
To build the Modules, cd to
SLICER_HOME, and type:
> tclsh
./Scripts/cmaker.tcl
Note that the build instructions for the Modules are different from the ones above. The instructions above were given by Steve Pieper, and specifically match the launch.tcl script. You may be able to build one or more of the Modules as standalone units, using cmake, and possibly some source editing as described above. But this does not comply with the launch script, unless you instruct cmake to build the targets in a ${OS_DIRNAME}/bin subdirectory. Yet I believe cmaker.tcl does a better job for you.