BioImage Suite Source Code Issues

1. Overview

As stated in the installation page, installing BioImage Suite consists of four parts.
  1. Installation of a pre-compiled binary itk241_ distribution containing the Insight Toolkit (ITK) v 2.4.1.  For more information on ITK see www.itk.org 
  2. Installation of a combo binary vtk44_yale distribution containing the Tcl/Tk scripting language, various extensions and the Visualization Toolkit. This includes binary versions of:
  3. Optionally the installation of a combo binary bioimagesuite_extra which primarily provides the MINC2 libraries and XERCESC -- these are optional (XERCESC is only used for fMRI Tool to load .xml files).
  4. Installation of the BioImage Suite software package itself.
All of the Open Source software listed in 1 -- 3 above essentially compiled without changes on all platforms.

BioImage Suite consists of a mixture of C++ libraries and .tcl code.  The development process is described in the lecture notes from a seminar taught by Xenios Papademetris (Introduction to Programming for Medical Image Analysis with VTK)

The BioImage Source code is released under the GNU General Public License (v2).

2. Compiling BioImage Suite

Note: These notes are for BioImage Suite 2.5.

Notes

Note that the binary bioimagesuite_extra, itk241 and vtk44 distributions distributed with BioImage Suite are needed for compiling this. While these are open source, it is easier to use the precompiled versions to avoid unnecessary troubles. (See below for some notes on building these distributions if needed.)

BioImage Suite is an application not a toolkit. While we provide the source code under the terms of the GPL, support for compiling this is limited to this document! A certain familiarity with the UNIX operating system and cmake is assumed.

Steps

  1. Place the BioImage Suite source code into a directory we will refer to as ${MYSRC}.
  2. Edit the setpaths.csh or setpaths.sh file to reflect their new location. i.e. in setpaths.csh change the line
    setenv BASE /usr/local/bioimagesuite

    to something like ${MYSRC}/bioimagesuite_src/bioimagesuite ... use absolute paths.

  3. Source the appropriate setpaths file (much like when running the software) to set all environment variables i.e.
    source ${MYSRC}/bioimagesuite/setpaths.csh 
    (or setpaths.sh if using one of the sh/ksh/bash shells. or modify setpaths.bat on MS-Windows).

  4. Configure the build
  5. cd ${MYSRC}/build
    ccmake ..

    Set the following variables as:

    LIBRARY_OUTPUT_PATH = ${MYSRC}/bioimagesuite/lib
    EXECUTABLE_OUTPUT_PATH = ${MYSRC}/bioimagesuite/bin

    You may also need to specify the positions of vtk, itk etc. If you are using the precompiled distributions, this is all taken care off for you. If not you will need to specify

  6. Compile
  7. Simply type make

  8. To run from the source tree build version
  9. bis.tcl

    To verify that this is the source build click on the "Which" button on the bottom the main pxmenu application. If it says something like ${MYSRC}/bioimagesuite then all is good. 


3. Compiling the Prerequisites

These are some notes on building the binary distributions vtk44_yale, itk241_yale and bioimagesuite_extra. They are by no means complete. We strongly suggest using the binary versions provided if at all possible. The exact sources used for these packages are available from the download page.

The vtk44_yale distribution

Tcl/Tk and Extensions

* Tcl and Tk -- use tcl 8.4.11/tk 8.4.11
cd unix;
./configure  --enable-shared --prefix=/usr/local/vtk44_yale
Mac OS X Aqua
tcl:  ./configure  --prefix=/usr/local/vtk44_carbon_yale --disable-framework --enable-shared --enable-threads 
tk:   ./configure  --prefix=/usr/local/vtk44_carbon_yale --disable-framework --enable-shared --enable-threads --enable-aqua
itcl: ./configure  --prefix=/usr/local/vtk44_carbon_yale --disable-framework --enable-shared --enable-threads --enable-aqua
Mac OX X X11
Tcl:  ./configure  --prefix=/usr/local/vtk44_x11_yale --disable-framework --enable-shared --enable-thread
Tk:   ./configure  --prefix=/usr/local/vtk44_x11_yale --disable-framework --enable-shared --enable-threads --with-x --disable-aqua
Itcl: ./configure  --prefix=/usr/local/vtk44_x11_yale --disable-framework --enable-shared --enable-threads --with-x --disable-aqua
* Incr Tcl (3.2.1)
./configure  --enable-shared --prefix=/usr/local/vtk44_yale --with-gcc
* Iwidgets 4.0.1
./configure  --enable-shared --prefix=/usr/local/vtk44_yale --with-itcl=../itcl3.2.1
* Tcllib - 1.8
./configure  --enable-shared --prefix=/usr/local/vtk44_yale 
* Metakit - 2.4.9.3
cd builds
../unix/configure 
../unix/configure --enable-shared --prefix=/usr/local/vtk44_yale --with-tcl=/usr/local/vtk44_yale/include/
You may need to create the file libmk4.lai if it is not automatically generated. It is not critical but it is needed for make install to work.
# Generated by ltmain.sh - GNU libtool 1.4.3 (1.922.2.110 2002/10/23 01:39:54)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libmk4.so'

# Names of this library.
library_names='libmk4.so libmk4.so'

# The name of the static archive.
old_library='libmk4.a'

# Libraries that this one depends upon.
dependency_libs=' -lstdc++'

# Version information for libmk4.
current=0
age=0
revision=0

# Is this an already installed library?
installed=yes

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/local/vtk44_yale/lib'

VTK 4.4

Use the patched source provided -- to change * vtkDataArray.cxx -- to eliminate a GetRange() bug -- we simply used a later version of the file from the VTK CVS release. * vtkImageReslice.cxx -- to set Optimization to Off by default as this gave us trouble with some of our nonlinear transformations in certain cases * Enable all libraries -- set Java/Python OFF, Tcl ON. Build Shared. Before running CMAKE set
TCL_LIBRARY_PATH=/usr/local/vtk44_yale/lib:/usr/local/vtk44_yale/lib/vtk/tcl
TK_LIBRARY_PATH=/usr/local/vtk44_yale/lib:/usr/local/vtk44_yale/lib/vtk/tcl
When configuring cmake
CMAKE_INSTALL_PREFIX=/usr/local/vtk44_yale
BUILD_SHARED_LIBS=ON
VTK_WRAP_TCL=ON
Mac OS X Aqua
BUILD_EXAMPLES                   OFF                                                                                                                                          
 BUILD_SHARED_LIBS                ON                                                                                                                                           
 CMAKE_BACKWARDS_COMPATIBILITY    2.2                                                                                                                                          
 CMAKE_BUILD_TYPE                                                                                                                                                              
 CMAKE_INSTALL_PREFIX             /usr/local/vtk44_carbon_yale                                                                                                                 
 TCL_INCLUDE_PATH                 /usr/local/vtk44_carbon_yale/include                                                                                                         
 TCL_LIBRARY                      /usr/local/vtk44_carbon_yale/lib/libtcl8.4.dylib                                                                                             
 TK_INCLUDE_PATH                  /usr/local/vtk44_carbon_yale/include                                                                                                         
 TK_INTERNAL_PATH   /Users/xenios/vtksrc/tk8.4.11/macosx;/Users/xenios/vtksrc/tk8.4.11/xlib;/Users/xenios/vtksrc/VTK/Rendering/tkOSXInternals                    
 TK_LIBRARY                       /usr/local/vtk44_carbon_yale/lib/libtk8.4.dylib                                                                                              
 VTK_APPLE_RESOURCE               /Developer/Tools/Rez                                                                                                                         
 VTK_DATA_ROOT                    VTK_DATA_ROOT-NOTFOUND                                                                                                                       
 VTK_USE_CARBON                   ON                                                                                                                                           
 VTK_USE_COCOA                    OFF                                                                                                                                          
 VTK_USE_HYBRID                   ON                                                                                                                                           
 VTK_USE_PARALLEL                 ON                                                                                                                                           
 VTK_USE_PATENTED                 ON                                                                                                                                           
 VTK_USE_RENDERING                ON                                                                                                                                           
 VTK_WRAP_JAVA                    OFF                                                                                                                                          
 VTK_WRAP_PYTHON                  OFF                                                                                                                                          
 VTK_WRAP_TCL                     ON  
 OPENGL_gl_LIBRARY                -framework OpenGL                                                                                                                            
 OPENGL_glu_LIBRARY               -framework AGL 
Also add in vtkTkRenderWidget.cxx and vtkTkImageViewerWidget.cxx under VTK_USE_CARBON
 #ifdef VTK_USE_CARBON

#if defined(i386)
#undef Status
#endif
  #include "vtkCarbonRenderWindow.h"
  #include "tkMacOSXInt.h"

....
Mac OS X X11
BUILD_EXAMPLES                   OFF                                                                                                                                          
 BUILD_SHARED_LIBS                ON                                                                                                                                           
 CMAKE_BACKWARDS_COMPATIBILITY    2.2                                                                                                                                          
 CMAKE_BUILD_TYPE                                                                                                                                                              
 CMAKE_INSTALL_PREFIX             /usr/local/vtk44_x11_yale                                                                                                                    
 TCL_INCLUDE_PATH                 /usr/local/vtk44_x11_yale/include                                                                                                            
 TCL_LIBRARY                      /usr/local/vtk44_x11_yale/lib/libtcl8.4.dylib                                                                                                
 TK_INCLUDE_PATH                  /usr/local/vtk44_x11_yale/include/;/Users/xenios/x11vtk/tk8.4.11/xlib/;/Users/xenios/x11vtk/tk8.4.11/generic                                 
 TK_INTERNAL_PATH                 /Users/xenios/x11vtk/VTK/Rendering/tkInternals/tk84OSX                                                                                       
 TK_LIBRARY                       /usr/local/vtk44_x11_yale/lib/libtk8.4.dylib                                                                                                 
 VTK_DATA_ROOT                    VTK_DATA_ROOT-NOTFOUND                                                                                                                       
 VTK_USE_CARBON                   OFF                                                                                                                                          
 VTK_USE_COCOA                    OFF                                                                                                                                          
 VTK_USE_HYBRID                   ON                                                                                                                                           
 VTK_USE_PARALLEL                 ON                                                                                                                                           
 VTK_USE_PATENTED                 ON                                                                                                                                           
 VTK_USE_RENDERING                ON                                                                                                                                           
 VTK_USE_X                        ON                                                                                                                                           
 VTK_WRAP_JAVA                    OFF                                                                                                                                          
 VTK_WRAP_PYTHON                  OFF                                                                                                                                          
 VTK_WRAP_TCL                     ON               
 CMAKE_X_CFLAGS                   -I/usr/X11R6/include                                                                                                                         
 CMAKE_X_LIBS                     -lSM;-lICE;/usr/X11R6/lib/libX11.a;/usr/X11R6/lib/libXext.a                                                                                  
 OPENGL_INCLUDE_DIR               /usr/X11R6/include                                                                                                                           
 OPENGL_gl_LIBRARY                /usr/X11R6/lib/libGL.dylib                                                                                                                   
 OPENGL_glu_LIBRARY               /usr/X11R6/lib/libGLU.dylib                                                                                                                  

CLAPACK

Compiling CLAPACK This can be a pain, as Makefiles need to be edited by hand. Using the " -fPIC" flag us helpful. This needs to be added to both "make.inc" but also to all other Makefiles! Since CLAPACK is in C, there is no good reason to not use the binary version provided. It will link just fine with libraries compiled with other compiler. Manually create /usr/local/vtk44_yale/lib/lapack and

cp F2CLIB/libf77.a /usr/local/vtk44_yale/lib/lapack
cp F2CLIB/libI77.a /usr/local/vtk44_yale/lib/lapack
cp blas.a /usr/local/vtk44_yale/lib/lapack/libblas.a
cp lapack.a /usr/local/vtk44_yale/lib/lapack/liblapack.a

Config Files

The following two files need to be created in /usr/local/vtk44_yale/lib/lapack * CLAPACKConfig.cmake

#-----------------------------------------------------------------------------
#
# CLAPACKConfig.cmake - CLAPACK CMake configuration file for external projects.
#
# This file is  used by the UseCLAPACK.cmake module to load CLAPACK's settings f
or an external project.


# The CLAPACK include file directories.
SET(CLAPACK_INCLUDE_DIRS "/usr/local/vtk44_yale/lib/lapack/")

# The CLAPACK library directories.
SET(CLAPACK_LIBRARY_DIRS "/usr/local/vtk44_yale/lib/lapack/")

# The location of the UseCLAPACK.cmake file.
SET(CLAPACK_USE_FILE "/usr/local/vtk44_yale/lib/lapack/UseCLAPACK.cmake")

# The name of the CLAPACK project
SET(CMAKE_BUILD_SETTING_PROJECT_NAME "CLAPACK")
* UseCLAPACK.cmake
#
# This module is provided as CLAPACK_USE_FILE by CLAPACKConfig.cmake.  It can
# be included in a project to load the needed compiler and linker
# settings to use CLAPACK.
#

# Add include directories needed to use CLAPACK.
INCLUDE_DIRECTORIES(${CLAPACK_INCLUDE_DIRS})

# Add link directories needed to use CLAPACK.
LINK_DIRECTORIES(${CLAPACK_LIBRARY_DIRS})

SET(CLAPACK_LIBRARIES lapack blas I77 F77 )

The itk241_yale distribution

ITK 2.4.1

BUILD_SHARED_LIBS: ON
CMAKE_INSTALL_PREFIX: /usr/local/itk241_yale

The bioimagesuite_extra distribution

Xercesc

After you untar the source tree
cd xerces-c-src_2_7_0/
setenv XERCESCROOT `pwd`
cd src
cd xercesc
./runConfigure -P /usr/local/bioimagesuite_extra -x g++ -c gcc
For 64-bit linux install add -b 64 to the line above (and perhaps -p linux)

Minc2, Netcdf 3.6.1, HDF5 1.6.5

setenv FC ""
setenv CXX ""
On Solaris setenv CFLAGS "-fPIC" ! * Netcdf
cd src
./configure --prefix=/usr/local/bioimagesuite_extra/minc20_yale 
* hdf5
./configure --prefix=/usr/local/bioimagesuite_extra/minc20_yale --disable-shared
* minc2
./configure --prefix=/usr/local/bioimagesuite_extra/minc20_yale CFLAGS=-I/usr/local/bioimagesuite_extra/minc20_yale/include/ LDFLAGS=-L/usr/local/bioimagesuite_extra/minc20_yale/lib/ --enable-minc2
On Solaris add -fPIC to CFLAFS.

4. Miscellaneous

BioImage Suite is developed primarily on Linux workstations running CentOS 4.4/5.0 and the gcc 3.2 compiler. In addition the development team has access to a Sparc Ultra 10, an SGI Octane (2xR12K), a pair of Mac Minis (powerpc and intel) and a number of Windows XP/2000/VISTA computers.

Some of the versions are compiled and/or tested inside virtual machines hosted using VMware Server 1.0 . Such virtual machines include Linux versions: Red Hat 7.3, Red Hat 8.0, Fedora Core 3-5, Debian Sarge 3.1, Ubuntu 5.10,6.06 and OpenSUSE 10.0. In addition we have virtual machines for Solaris x86 v10, Darwin x86 v8.01 and Free BSD 6.0, as well as Windows 98.

BioImage Suite has been successfully compiled using gcc versions 2.95, 2.96, 3.2, 3.3, 3.4 and 4.01 on Linux and other operating systems, as well as Microsoft Visual Studio .NET 2003/2005 (and also using gcc3.3 under cygwin).



5. Additional Notes

BioImage Suite is an integrated image analysis software suite developed at Yale University. We acknowledge support from the National Institutes of Health (NIH)/National Institute of Biomedical Imaging and Bioengineering (NIBIB) under grant R01 EB006494. If you are using BioImage Suite for a paper please add something like this in the acknowledgment section.
Image analysis performed using the BioImage Suite software suite. This is
supported in part by the NIH-NIBIB under grant R01 EB006494, Papademetris,
X. (PI).  
It will help us keep the project funded. For the reference section use something like
BioImage Suite: An integrated medical image analysis
suite. X. Papademetris, M. Jackowski, N. Rajeevan, H Okuda, R.T. Constable
and L.H Staib. Section of Bioimaging Sciences, Dept. of Diagnostic
Radiology, Yale School of Medicine. www.bioimagesuite.org 

Content by
Xenophon Papademetris