|
MITK
2012.02.99-273470b0
Medical Imaging Interaction Toolkit
|
The MITK build system (which is based on CMake) supports a "superbuild" process, meaning that it will download, configure, and build all required third-party libraries (except Qt) automatically. These instructions will show you how to use the MITK superbuild.
For more advanced users, the last sections explain how to inject custom build libraries into the superbuild process.
You need:
Nokia provides several binary packages for Qt. You must make sure that the package you download matches your toolchain. On Linux, getting Qt by installing the packages provided by your Linux package manager is the preferred way.
On Windows, the Nokia provided binaries are compiled for 32bit architectures. You cannot build your own project for a 64bit machine and use the 32bit Qt libraries. You have two options for a 64bit Qt-based application:
To compile Qt on Windows using Visual Studio, follow the steps below:
configure.exe -prefix C:\Qt\4.7.4_vc9_x64 -debug-and-release -qt-sql-sqlite -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -mp -nomake examples -nomake demos -nomake docs
nmake nmake install
Since MITK is under active development we recommend to use git to get the most recent version. To make sure you get a stable tree, check the MITK dashboard before checking out. If the build tree is not clean, you can specify an older revision for the checkout or get a stable tar ball from www.mitk.org.
If you don't want to use Git, you may also download the current source code (or any other older version) as a tar.gz package by clicking on the snapshot link. You can then skip the clone step below.
To clone MITK's current git repository do:
git clone http://git.mitk.org/MITK.git
Create a new directory for the superbuild binary tree, change to it and call CMake:
In the shell (assuming you current directory is the same as the one where you issued the git clone command):
mkdir MITK-superbuild cd MITK-superbuild ccmake ../MITK
If you use Windows, then you just start the CMake GUI and enter the location of the source and of the binary tree, choose a suitable generator and configure the project.
CMake will present you a couple of options, these are the most important ones:
MITK_USE_BLUEBERRY Build the BlueBerry application frameworkMITK_USE_Boost Build MITK code which depends on Boost (this will download Boost 1.45.0)MITK_USE_Boost_LIBRARIES If you need binary Boost libraries, specify them here.MITK_USE_OpenCV Build MITK code which depends on OpenCV (this will download and build OpenCV 2.3)MITK_USE_Python Enables Python wrapping in MITK. This will also configure ITK, VTK, and OpenCV (if enabled) to build Python wrappers.MITK_USE_QT Build MITK code which depends on QtQT_QMAKE_EXECUTABLE The path to the qmake executable of your Qt installationIf you are satisfied with the configuration of your MITK superbuild, generate the project files with CMake by pressing "Generate".
Linux users usually just enter "make" (optionally supplying the number threads to be used for a parallel build):
make -j4
Windows users using Visual Studio can open the generated MITK-superbuild.sln solution file in the MITK-superbuild directory and start the build by building the BUILD_ALL project.
The MITK superbuild configured MITK with all needed external libraries. The build directories of these libraries, and of MITK itself are located inside the MITK-superbuild directory. For example, the directory layout may look like:
MITK-superbuild |- ITK-build |- VTK-build |- MITK-build
To change the configuration of the MITK build, choose the MITK-build directory as the binary directory in the CMake GUI. After generating the project files, build the MITK project by either issuing "make" in the MITK-build directory (Linux), or by opening MITK-build/MITK.sln and building the project with Visual Studio.
You may also change the configuration of any project configured via the superbuild process. Make sure to also build the changed project and also the projects which depend on it.
On Linux, just execute the application you want to run. MITK executables are located in MITK-superbuild/MITK-build/bin
On Windows, the PATH environment variable must contain the directories containging third-party libraries. The MITK build system generated Windows Batch files in the MITK-build directory which set up a correct environment and opens the appropriate Visual Studio solution file. Use (and maybe modify/enhance) these Batch files to be able to start and debug MITK applications from inside Visual Studio.
If you have the Doxygen documentation tool installed, you get a new project (Visual Studio) or "make" target named "doc". You can build this to generate the HTML documentation of MITK in the Documentation/Doxygen directory of your MITK-build binary tree or in the MITK_DOXYGEN_OUTPUT_DIR CMake variable (if specified).
How to create a new MITK Plug-in
In the MITK-build binary tree the MITKConfig.cmake file is generated. You can include it in your own project with
find_package(MITK)
On Windows you also need find_package(ITK) find_package(VTK) to get the library dependencies right.
After that you can set your include path with
include_directories(${QMITK_INCLUDE_DIRS})
and create an application:
link_directories(${MITK_LINK_DIRECTORIES}) add_executable(MyApp MyApp.cpp) target_link_libraries(Step1 ${QMITK_LIBRARIES})
You can inject pre-build third-party libraries into the MITK superbuild by setting certain CMake variables before the first configure step. MITK will then use these third-party libraries instead of downloading and building them itself. Note you must take care to configure those libraries with all options MITK requires.
The variables listed below are provided for injecting third-party libraries. Their occurrence in the CMake GUI or in ccmake may depend on specific MITK_USE_* options set to ON. You may also use the variable names below without the EXTERNAL_ prefix, for example when providing their values on a command line call to CMake.
EXTERNAL_BOOST_ROOT Set this variable to your custom Boost installationEXTERNAL_CTK_DIR Set this variable to your CTK binary tree (the directory containing the CTKConfig.cmake file)EXTERNAL_CableSwig_DIR Set this variable to your CableSwig binary tree for Python wrapping (the directory containing the CableSwigConfig.cmake file)EXTERNAL_DCMTK_DIR Set this variable to your DCMTK binary tree (the directory containing the DCMTKConfig.cmake file)EXTERNAL_GDCM_DIR Set this variable to your GDCM binary tree (the directory containing the GDCMConfig.cmake file)EXTERNAL_ITK_DIR Set this variable to your ITK binary tree (the directory containing the ITKConfig.cmake file)EXTERNAL_OpenCV_DIR Set this variable to your OpenCV binary tree (the directory containing the OpenCVConfig.cmake file)EXTERNAL_VTK_DIR Set this variable to your VTK binary tree (the directory containing the VTKConfig.cmake file)To set CMake options before the first configure step is invoked, supply them on the command line, i.e.
ccmake -DITK_DIR:PATH=/opt/ITK-release ../MITK
See the following link for more information about how to configure third-party libraries: How to build ITK, VTK and QT