TubeTK/Build Instructions: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
 
(142 intermediate revisions by 6 users not shown)
Line 1: Line 1:
= Recommended Build Procedure =
There are two ways of building TubeTK:


TubeTK is known to compile on Windows, Macs, and Linux.
* (Option 1) Slicer-Dependent Build
* (Option 2) Stand-Alone Build


== Overview ==
If you are going to use TubeTK as a library for building your own C++ programs or for processing data using the command-line or scripts, it is sufficient to build TubeTK as a (Option 2) Stand-Alone Build.


* Process
If you want a graphical user interface (albeit to a limited subset of TubeTK's methods), you should follow the (Option 1) Slicer-Dependent Build instructions.
** Install system-level pre-requisites
** Download source
** Configure using CMake (http://cmake.org)
** Build


* Requirements
= (Option 1) Slicer-Dependent Build =
** The following must be installed prior to trying to build TubeTK
** CMake
** git
** svn
** Qt (optional)


* Packaged with TubeTK
It uses a compiled version of Slicer to provide its dependencies. 
** The following are automatically downloaded and built when TubeTK is built
** ITK
** VTK
** Slicer's command-line registration tools


= Windows =
In this build format,
# TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.
# TubeTK methods are available from within the Slicer application against which it is built.


* CMake
This build format is tested nightly on Windows, OS X, and Linux machines.
* git
* svn
* Qt


run CMake (cmake-gui)
This build format has the following steps:
Where is the source code: your TubeTK source directory
* Install requirements and options
Where to build the binaries: your new TubeTK build directory
* Download source
Press the 'Configure' button
* Configure using CMake
* Build


== Build the Code ==
== Install Requirements and Options ==


* Open Microsoft Visual Studio
=== CMake ===
* File -> Open -> Project/Solution -> open tubetk-Release/TubeTK.sln
CMake 3.4 or greater is required.
* The Mac/Windows binaries can be downloaded from [http://cmake.org http://cmake.org]
* The linux installation from source is easiest.  Assuming an older version of cmake is already installed, and you want to install v3.4.1, do the following:
sudo apt-get build-dep cmake
sudo apt-get install libgtkmm-2.4-dev glade-gtk2 libglademm-2.4-dev
git clone http://github.com:/Kitware/CMake.git
cd CMake
git checkout v3.4.1
cd ..
mkdir CMake-Release
cd CMake-Release
cmake ../CMake -DCMAKE_BUILD_TYPE=Release
make -j8


* Perform the initial build using your compiler at the top-level of tubetk-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
=== Slicer ===
** Right click on the "ALL_BUILD" project and select "Build".
* Subsequent builds should be initiated in the subdir tubetk-Release/TubeTK-Build to save time.  This will build TubeTK only.  You may have to periodically build from the top-level of tubetk-Release to get updates to the libraries that TubeTK depends on.
** Right click on the "TubeTK" project and select "Build".


= Macs =
* If you are building the Stand-Alone version of TubeTK, you do not need to build Slicer.


* CMake
* If you are building the Slicer-Dependent version of TubeTK, you must build Slicer from source:
** Install CMake Mac OS X Universal binary from [http://cmake.org/cmake/resources/software.html CMake] download website.
** Source: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions
* X11
** Install X11 ( Note: Mac OS X 10.7 Lion already ships with X11 )
* git
* svn
* Qt


Launch the X11 terminal to install git, svn and and Qt. Then, follow the steps described in the Linux build section to download, configure and build tubetk in Mac OS X.  During CMake configuration, select "Unix Makefiles" generator. Tubetk has been successively built on Mac OS X 10.7 using gcc 4.2 ( dash5.kitware ).
<b>Notes:</b>
* To address the multiple dependencies required (and optional) for VTK, we recommend installing the build dependencies of ParaView prior to building Slicer:
sudo apt-get build-dep paraview


= Linux =


== Install system-level dependencies ==
=== Boost (optional) ===


TubeTK makes heavy use of ITK and VTK.  Each of these packages depends on a variety of system-level packages, many of which are not installed by default on Linux systems.  These dependencies are similar to the dependencies needed to install ParaView. So, the following will install all of the dependencies needed to build VTK and ITK (as needed by ParaView and TubeTK).
Download and build Boost:
* http://www.boost.org/


   sudo apt-get build-dep paraview
<b>Notes:</b>
* Linux: TubeTK creates dynamic libraries that have static links to Boost libraries.  Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
** <code> ./bootstrap.sh <br> </code>
** <code> ./bjam -j14 </code>
** <code> ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14 </code>
* Mac: if compiling for compatibility with older versions of MacOS, you may need to build boost using the following command:
** <code> ./b2 toolset=clang cxxflags="-stdlib=libstdc++" linkflags="-stdlib=libstdc++" link=static install -a </code>
** Slicer and TubeTK matches its build environment with the environment used to build qmake.   This means that all code build using Slicer and TubeTK must also build using that environment.  So, on some systems you will need to specify stdlib=libstdc++ (for 10.8) or stdlib-libc++ (for 10.9 and beyond).  See the comments starting in line 103 of https://github.com/Slicer/Slicer/blob/master/CMake/SlicerBlockSetCMakeOSXVariables.cmake


* We also build the qt gui in vtk, so do
== Download Source ==


  sudo apt-get install qt-sdk
Download the source via git
* <code> git clone https://github.com/KitwareMedical/TubeTK TubeTK </code>


* CMake, and in particular the curses (text-interface) version
== Configure ==


  sudo apt-get install cmake-curses-gui
Create a directory, outside of the source directory, to hold the compilation
* <code> mkdir TubeTK-Release </code>
* <code> cd TubeTK-Release </code>


* git
Within that compilation directory, run cmake and point it to where the source is located. We recommend using a cmake with a GUI configuration editor.  This is the default on Windows and Mac.  On Linux (or from Mac command-line) type:
* <code> cmake-gui ../TubeTK </code>


  sudo apt-get install git gitk
Set the following CMake variables
* TubeTK_USE_SLICER = On
* Slicer_DIR = <Path to your Slicer build directory>
* Linux and Mac only, also set:
** CMAKE_BUILD_TYPE = <same build type as Slicer installation: Debug or Release>


* svn
== Build ==


=== Windows ===
Load the TubeTK solution file in Visual Studio
* <code> Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln </code>
** INITIAL BUILD: Perform the initial build using the TubeTK.sln file at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
** SUBSEQUENT BUILDS: Subsequent builds <b>MUST</b> be initiated using the TubeTK.sln file in the subdir <b>TubeTK-Release/TubeTK-build</b>.  This will build TubeTK only.  You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
* Choose your build type: Release, Debug, etc.  It MUST match the build type chosen for Slicer.
* <code> Right click on the "ALL_BUILD" project and select "Build". </code>


* Qt
=== Linux and OS X ===
* INITIAL BUILD: Perform the initial build using your compiler at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
** <code> cd TubeTK-Release </code>
** <code> make -j8 </code>
* SUBSEQUENT BUILDS: Subsequent builds <b>MUST</b> be initiated in the subdir TubeTK-Release/TubeTK-build.  This will build TubeTK only.  You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
** <code> cd TubeTK-Release/TubeTK-build </code>
** <code> make -j8 </code>


== Establish directory structure ==
= (Option 2) Stand-Alone Build =


mkdir ~/src
In this build format, TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.
cd ~/src


== Download the source ==
This build format is tested nightly on Windows, OS X, and Linux machines.


git clone git://gitorious.org/tubetk/tubetk.git
This build format has the following steps:
mkdir ~/src/tubetk-Release
* Install requirements and options
* Download source
* Configure using CMake
* Build


== Run CMake to configure ==
== Install Requirements and Options ==


cd ~/src/tubetk-Release
=== GIT ===
ccmake ../tubetk
press 'c' to configure
Set CMAKE_BUILD_TYPE to Release
press 'c' to configure again
press 'g' to generate


== Build the code ==
Install the latest stable release.
* Windows
** http://msysgit.github.io/
* Linux
** <code> sudo apt-get install git </code>
* Mac
** git is included with MacOS


Perform the initial build using your compiler at the top-level of tubetk-ReleaseThis will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
=== Qt ===
cd ~/src/tubetk-Release
QT version 4.8.6 or 4.8.7 is REQUIRED.
make -j4
* Windows
** You will want the 64-bit version of Qt, with WebKIT supportSee details at:
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions/Prerequisites/Qt#Windows_3
* Linux
** Qt is included with most versions of Linux
* Mac
** Download the installer from
*** http://download.qt.io/archive/qt/4.8/


Subsequent builds should be initiated in the subdir tubetk-Release/TubeTK-Build to save time. This will build TubeTK onlyYou may have to periodically build from the top-level of tubetk-Release to get updates to the libraries that TubeTK depends on.
=== CMake ===
  cd ~/src/tubetk-Release/TubeTK-Build
CMake 3.0 or greater is required.
  make -j4
* The Mac/Windows binaries can be downloaded from http://cmake.org
* The linux installation from source is easiest.  Assuming an older version of cmake is already installed, and you want to install v3.4.1, do the following:
  sudo apt-get build-dep cmake
sudo apt-get install libgtkmm-2.4-dev glade-gtk2 libglademm-2.4-dev
  git clone http://github.com:/Kitware/CMake.git
cd CMake
git checkout v3.4.1
cd ..
mkdir CMake-Release
cd CMake-Release
cmake ../CMake -DCMAKE_BUILD_TYPE=Release
  make -j8


= Trouble Shooting =
=== Boost (optional) ===


== Cannot find Git ==
Download and build Boost:
* http://www.boost.org/


* If CMake complains that it cannot find Git:
<b>Notes:</b>
** Toggle the 'Advanced' checkbox to ON
* Linux: TubeTK creates dynamic libraries that have static links to Boost libraries.  Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
** Set the value of GIT_EXECUTABLE value to C:\Program Files (x86)\Git\bin\git.exe, or its equivalent on your system
** <code> ./bootstrap.sh <br> </code>
** Press the 'Configure' button twice
** <code> ./bjam -j14 </code>
** Toggle the 'Advanced' checkbox to OFF
** <code> ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14 </code>


== Missing libraries on build ==
=== Python (optional) ===


Confirm the following CMake variables
Versions 2.7.x is supported at this time.


* BUILD_TESTING: ON
Download and install per system instructions at:
* CMAKE_BUILD_TYPE: Specify Debug, Release, RelWithDebInfo or MinSizeRel
* https://www.python.org/downloads/
* TubeTK_USE_CTK: ON
* Windows
* TubeTK_USE_QT: OFF
** Pre-compiled version of numpy, scipy, etc are available as wheels at:
** If you have Qt 4.6.3 or greater installed, you can turn it on.
http://www.lfd.uci.edu/~gohlke/pythonlibs/
** If you do not have Qt, CMake will complain until you turn this option off.
** Using these wheels is recommended over Anaconda and other installation packages, because they also include and expose versions of Qt (for example) that are incompatible with Slicer and TubeTK.
* TubeTK_USE_SUPERBUILD: ON
* Linux and Mac
** If "ON", then cmake will fetch and compile ITK and VTK from the Slicer git repository, and will fetch and compile TCLAP, ModuleDescriptionParser, and GenerateCLP from the Slicer3 svn repository
** Python is already included with most Linux and Mac variants.
* TubeTK_USE_VTK: ON
* USE_SYSTEM_ITK: OFF
** If "ON", then you can tell TubeTK to use an ITK build that is already present on your system (using the CMake variable ITK_DIR).  See the warning below.
* USE_SYSTEM_VTK: OFF
** If "ON", then you can tell TubeTK to use a VTK build that is already present on your system (using the CMake variable VTK_DIR).  See the warning below.


== Download Source ==


= Advanced =
Download the source via git
* <code> git clone https://github.com/KitwareMedical/TubeTK TubeTK </code>


== Using a pre-existing ITK or VTK installation ==
== Configure ==


You can configure CMake variables to use an existing ITK or VTK installation instead of its embedded versions.  This is NOT recommended, because of inter-dependencies that require specific version of these libraries, and built using specific options, to be used.
Before starting the configuration, make sure that you have <code>virtualenv</code> installed ('''Linux Only''').
* USE_SYSTEM_ITK: OFF
** If "ON", then you can tell TubeTK to use an ITK build that is already present on your system (using the CMake variable ITK_DIR).  See the warning below.
* USE_SYSTEM_VTK: OFF
** If "ON", then you can tell TubeTK to use a VTK build that is already present on your system (using the CMake variable VTK_DIR).  See the warning below.


* Dependencies on ITK and VTK versions and build options
If not, just install it with :
** Note that TubeTK relies on ITK and VTK from 3D Slicer (https://github.com/Slicer/ITK and https://github.com/Slicer/VTK, respectively)
* <code> sudo apt-get install pyton-pip </code>
** Slicer's repositories for ITK/VTK contain enhancements that have not yet made it into the ITK/VTK repositories themselves.
* <code> pip install virtualenv </code>


=== Build Errors ===


If you get build errors similar to:
Create a directory, outside of the source directory, to hold the compilation
* <code> mkdir TubeTK-Release </code>
* <code> cd TubeTK-Release </code>


> tubetk-Release/Insight/Utilities/vxl/core/vnl/algo/vnl_svd.h: In copy constructor ‘vnl_matrix_inverse<double>::vnl_matrix_inverse(const vnl_matrix_inverse<double>&)’:
Within that compilation directory, run cmake and point it to where the source is located. We recommend using a cmake with a GUI configuration editorThis is the default on Windows and MacOn Linux (or from Mac command-line) type:
> tubetk-Release/Insight/Utilities/vxl/core/vnl/algo/vnl_matrix_inverse.h:35: instantiated from ‘void itk::tube::LDAGenerator<ImageT, LabelmapT>::GenerateLDA() [with ImageT = itk::Image<float, 2u>, LabelmapT = itk::Image<unsigned char, 2u>]’
* <code> cmake-gui ../TubeTK </code>
> tubetk/Base/Filtering/itkTubeNJetLDAGenerator2F.cxx:53: instantiated from here
  > tubetk-Release/Insight/Utilities/vxl/core/vnl/algo/vnl_svd.h:193: error: ‘vnl_svd<T>::vnl_svd(const vnl_svd<T>&) [with T = double]’ is private
> tubetk-Release/Insight/Utilities/vxl/core/vnl/algo/vnl_matrix_inverse.h:35: error: within this context
  > tubetk/Base/Filtering/itkTubeLDAGenerator.txx: In member function ‘void itk::tube::LDAGenerator<ImageT, LabelmapT>::GenerateLDA() [with ImageT = itk::Image<float, 2u>, LabelmapT = itk::Image<unsigned char, 2u>]’:
> tubetk/Base/Filtering/itkTubeNJetLDAGenerator2F.cxx:53: instantiated from here
> tubetk/Base/Filtering/itkTubeLDAGenerator.txx:572: note: synthesized method ‘vnl_matrix_inverse<double>::vnl_matrix_inverse(const vnl_matrix_inverse<double>&)’ first required here


you likely do not have the correct version of ITK.  Perhaps you have ITK from the official ITK repository instead of from 3D Slicer, or perhaps you haven't fetched updates lately?
Linux and Mac only, set the CMake variables:
* Generally, unless you are modifying ITK or VTK yourself, it is simpler to have TubeTK build its own versions of ITK and VTK.
* CMAKE_BUILD_TYPE = <same build type as Slicer installation: Debug or Release>


== Recommended Compilation Options ==
== Build ==


* For Linux developers (and Linux dashboard machines) we recommend:
=== Windows ===
** CMAKE_CXX_FLAGS:STRING=-W -Wall -Wextra -Wshadow -Wno-system-headers -Wwrite-strings -Wno-deprecated -Woverloaded-virtual
Load the TubeTK solution file in Visual Studio
** CMAKE_C_FLAGS:STRING=-W -Wall -Wextra -Wshadow -Wno-system-headers -Wwrite-strings
* <code> Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln </code>
* A summary of warning options for gcc and g++ are given at:
** Perform the initial build using your compiler at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
** http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
* <code> Right click on the "ALL_BUILD" project and select "Build". </code>
** http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/C_002b_002b-Dialect-Options.html
** Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-build to save time. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
*** <code> Right click on the "TubeTK" project and select "Build". </code>


= Inside TubeTK =
=== Linux and OS X ===
Perform the initial build using your compiler at the top-level of TubeTK-Release.  This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
* <code> cd $HOME/TubeTK-Release </code>
* <code> make </code>
Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-build to save time.  This will build TubeTK only.  You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
* <code> cd $HOME/TubeTK-Release/TubeTK-build </code>
* <code> make </code>


* As noted above, TubeTK uses CMake's Superbuild include other libraries, as needed for the options selected.
* Libraries that may be automatically downloaded and included by TubeTK include:
** ITK
** VTK
** CTK
** Select tools from the NA-MIC Kit:
*** TCLAP, GenerateCLP, ModuleDescriptionParser, RegisterImages
* Libraries that must be externally installed if you want to use them with TubeTK
** CMake (2.8.2 or greater - REQUIRED)
** Qt (4.6.2 or greater - OPTIONAL)
* You can manually install the above toolkits and then configure TubeTK to use those installations instead of building its own copies of those toolkits, BUT we don't recommend heading down that road.
** Requires CMake expertise
** Requires making sure each of the toolkits is correctly configured (via their own cmake configuration processes) for use with TubeTK.
** If you still want to try this complex, manual, unsupported approach, then the following steps will help somewhat:
**# Read tubetk/SuperBuild.cmake to find out the current set of cmake options required for each library.
**# For example, at one point in tubetk history, you were required to build ITK v3.20.0, as mirrored and customized on the Slicer github account, using the following cmake vars
**#* BUILD_SHARED_LIBS = OFF (or ON, but libs are VERY small in ITK because of templates)
**#* ITK_USE_LIBXML2 = ON
**#* ITK_USE_REVIEW = ON
**#* ITK_USE_OPTIMIZED_REGISTRATION_METHODS = ON
**#* ITK_USE_TRANSFORM_IO_FACTORIES = ON
**#* CMAKE_CXX_FLAGS = -fPIC
**#* CMAKE_C_FLAGS = -fPIC
**#** adding -fPIC to both c and cxx flags can be ignored if you build with shared libs ON.
**# You must also build non-cmake libraries, such as Qt 4.6.2 or greater
**#* Tips for installing Open Source Qt to run with Visual Studio
**#*# Open a visual studio command shell.
**#*# Go to the Qt source directory and run "configure -platform win32-msvc2005". This will tell Qt to prepare itself for being compiled by the Visual Studio compiler. If you use another version of VS than 2005, replace win32-msvc-2005 with the appropriate one.
**#*# Type "nmake" and take a break when it compiles.
**#*# Add QMAKESPEC=win32-msvc2005 as a system environment variable and add QTDIR=your_dir into the system path. It is done.
**#* Tips for installing Qt on Linux
**#*# apt-get qt4
**# After Qt, you must also build the Slicer customized version of VTK v5.6, from the Slicer github account, using the appropriate cmake vars, such as
**#* BUILD_SHARED_LIBS = ON
**#* VTK_USE_GUISupport = ON
**#* VTK_USE_QVTK
**# Again, many details are missing in the above list.  We really recommend using Superbuild instead.


= References =
[[Category:TubeTK|Build Instructions]]
 
* Superbuild and EXTERNAL_PROJECTS
** Dave Cole's article in the October Kitware Source [http://www.kitware.com/products/archive/kitware_quarterly1009.pdf]

Latest revision as of 12:11, 1 November 2016

There are two ways of building TubeTK:

  • (Option 1) Slicer-Dependent Build
  • (Option 2) Stand-Alone Build

If you are going to use TubeTK as a library for building your own C++ programs or for processing data using the command-line or scripts, it is sufficient to build TubeTK as a (Option 2) Stand-Alone Build.

If you want a graphical user interface (albeit to a limited subset of TubeTK's methods), you should follow the (Option 1) Slicer-Dependent Build instructions.

(Option 1) Slicer-Dependent Build

It uses a compiled version of Slicer to provide its dependencies.

In this build format,

  1. TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.
  2. TubeTK methods are available from within the Slicer application against which it is built.

This build format is tested nightly on Windows, OS X, and Linux machines.

This build format has the following steps:

  • Install requirements and options
  • Download source
  • Configure using CMake
  • Build

Install Requirements and Options

CMake

CMake 3.4 or greater is required.

  • The Mac/Windows binaries can be downloaded from http://cmake.org
  • The linux installation from source is easiest. Assuming an older version of cmake is already installed, and you want to install v3.4.1, do the following:
sudo apt-get build-dep cmake
sudo apt-get install libgtkmm-2.4-dev glade-gtk2 libglademm-2.4-dev
git clone http://github.com:/Kitware/CMake.git
cd CMake
git checkout v3.4.1
cd ..
mkdir CMake-Release
cd CMake-Release
cmake ../CMake -DCMAKE_BUILD_TYPE=Release
make -j8

Slicer

  • If you are building the Stand-Alone version of TubeTK, you do not need to build Slicer.

Notes:

  • To address the multiple dependencies required (and optional) for VTK, we recommend installing the build dependencies of ParaView prior to building Slicer:
sudo apt-get build-dep paraview


Boost (optional)

Download and build Boost:

Notes:

  • Linux: TubeTK creates dynamic libraries that have static links to Boost libraries. Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
    • ./bootstrap.sh
    • ./bjam -j14
    • ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14
  • Mac: if compiling for compatibility with older versions of MacOS, you may need to build boost using the following command:
    • ./b2 toolset=clang cxxflags="-stdlib=libstdc++" linkflags="-stdlib=libstdc++" link=static install -a
    • Slicer and TubeTK matches its build environment with the environment used to build qmake. This means that all code build using Slicer and TubeTK must also build using that environment. So, on some systems you will need to specify stdlib=libstdc++ (for 10.8) or stdlib-libc++ (for 10.9 and beyond). See the comments starting in line 103 of https://github.com/Slicer/Slicer/blob/master/CMake/SlicerBlockSetCMakeOSXVariables.cmake

Download Source

Download the source via git

Configure

Create a directory, outside of the source directory, to hold the compilation

  • mkdir TubeTK-Release
  • cd TubeTK-Release

Within that compilation directory, run cmake and point it to where the source is located. We recommend using a cmake with a GUI configuration editor. This is the default on Windows and Mac. On Linux (or from Mac command-line) type:

  • cmake-gui ../TubeTK

Set the following CMake variables

  • TubeTK_USE_SLICER = On
  • Slicer_DIR = <Path to your Slicer build directory>
  • Linux and Mac only, also set:
    • CMAKE_BUILD_TYPE = <same build type as Slicer installation: Debug or Release>

Build

Windows

Load the TubeTK solution file in Visual Studio

  • Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln
    • INITIAL BUILD: Perform the initial build using the TubeTK.sln file at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
    • SUBSEQUENT BUILDS: Subsequent builds MUST be initiated using the TubeTK.sln file in the subdir TubeTK-Release/TubeTK-build. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
  • Choose your build type: Release, Debug, etc. It MUST match the build type chosen for Slicer.
  • Right click on the "ALL_BUILD" project and select "Build".

Linux and OS X

  • INITIAL BUILD: Perform the initial build using your compiler at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
    • cd TubeTK-Release
    • make -j8
  • SUBSEQUENT BUILDS: Subsequent builds MUST be initiated in the subdir TubeTK-Release/TubeTK-build. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
    • cd TubeTK-Release/TubeTK-build
    • make -j8

(Option 2) Stand-Alone Build

In this build format, TubeTK produces a set of libraries and command-line programs that can be used to process images from the command line and to build other applications.

This build format is tested nightly on Windows, OS X, and Linux machines.

This build format has the following steps:

  • Install requirements and options
  • Download source
  • Configure using CMake
  • Build

Install Requirements and Options

GIT

Install the latest stable release.

Qt

QT version 4.8.6 or 4.8.7 is REQUIRED.

  • Windows
    • You will want the 64-bit version of Qt, with WebKIT support. See details at:

http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions/Prerequisites/Qt#Windows_3

CMake

CMake 3.0 or greater is required.

  • The Mac/Windows binaries can be downloaded from http://cmake.org
  • The linux installation from source is easiest. Assuming an older version of cmake is already installed, and you want to install v3.4.1, do the following:
sudo apt-get build-dep cmake
sudo apt-get install libgtkmm-2.4-dev glade-gtk2 libglademm-2.4-dev
git clone http://github.com:/Kitware/CMake.git
cd CMake
git checkout v3.4.1
cd ..
mkdir CMake-Release
cd CMake-Release
cmake ../CMake -DCMAKE_BUILD_TYPE=Release
make -j8

Boost (optional)

Download and build Boost:

Notes:

  • Linux: TubeTK creates dynamic libraries that have static links to Boost libraries. Since Boost static libraries on Linux are not compiled with fPIC, you must compile Boost from source to use it with TubeTK.
    • ./bootstrap.sh
    • ./bjam -j14
    • ./bjam cxxflags=-fPIC cflags=-fPIC -a link=static -j14

Python (optional)

Versions 2.7.x is supported at this time.

Download and install per system instructions at:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

    • Using these wheels is recommended over Anaconda and other installation packages, because they also include and expose versions of Qt (for example) that are incompatible with Slicer and TubeTK.
  • Linux and Mac
    • Python is already included with most Linux and Mac variants.

Download Source

Download the source via git

Configure

Before starting the configuration, make sure that you have virtualenv installed (Linux Only).

If not, just install it with :

  • sudo apt-get install pyton-pip
  • pip install virtualenv


Create a directory, outside of the source directory, to hold the compilation

  • mkdir TubeTK-Release
  • cd TubeTK-Release

Within that compilation directory, run cmake and point it to where the source is located. We recommend using a cmake with a GUI configuration editor. This is the default on Windows and Mac. On Linux (or from Mac command-line) type:

  • cmake-gui ../TubeTK

Linux and Mac only, set the CMake variables:

  • CMAKE_BUILD_TYPE = <same build type as Slicer installation: Debug or Release>

Build

Windows

Load the TubeTK solution file in Visual Studio

  • Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln
    • Perform the initial build using your compiler at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
  • Right click on the "ALL_BUILD" project and select "Build".
    • Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-build to save time. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
      • Right click on the "TubeTK" project and select "Build".

Linux and OS X

Perform the initial build using your compiler at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.

  • cd $HOME/TubeTK-Release
  • make

Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-build to save time. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.

  • cd $HOME/TubeTK-Release/TubeTK-build
  • make