Medical Imaging Interaction Toolkit 2016.3.0
Medical Imaging Interaction Toolkit
The CMake-based build system of MITK 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 explains how to inject custom build libraries into the superbuild process.
As we do not provide Qt in the MITK superbuild you need to install Qt manually. Installing Qt dramatically improved since Qt 5, as The Qt Company provides sophisticated online installers for all supported platforms.
Since MITK is under active development we recommend to use Git to check out the latest stable release from the homepage. If you decide to use the most current nightly release, make sure to 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 a snapshot of the current source code (or any other older version) as a tar.gz package.
To clone MITK's current Git repository do:
Create a new directory for the superbuild binary tree, change to it and call CMake:
In the shell (assuming your current directory is the same as the one where you issued the git clone command):
CMake will present you a couple of options, these are the most important ones:
CMAKE_PREFIX_PATHThe path to your Qt installation, e.g., C:/Qt/5.4/msvc2013_64_opengl or /home/user/Qt/5.4/gcc_64
MITK_USE_ACVDBuild MITK code which depends on ACVD (this will download and build ACVD)
MITK_USE_BLUEBERRYBuild the BlueBerry application framework
MITK_USE_BoostBuild MITK code which depends on Boost (this will download Boost 1.56)
MITK_USE_Boost_LIBRARIESIf you need binary Boost libraries, specify them here.
MITK_USE_OpenCVBuild MITK code which depends on OpenCV (this will download and build OpenCV 2.4)
MITK_USE_PythonEnables Python wrapping in MITK. This will also configure ITK, VTK, and OpenCV (if enabled) to build Python wrappers.
MITK_USE_QTBuild MITK code which depends on Qt
MITK_USE_SOFABuild MITK code which depends on SOFA (this will download and build SOFA)
CMAKE_PREFIX_PATHIf Qt5 is not found automatically, set this variable to the base directory of your Qt5 installation.
If you are satisfied with the configuration of your MITK superbuild, generate the project files with CMake by pressing "Generate".
Linux and Mac OS X users usually just enter "make" (optionally supplying the number threads to be used for a parallel build):
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
The MITK superbuild configures MITK as well as all 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:
To change the configuration of the MITK build itself, choose the MITK-build directory as the binary directory in the CMake GUI (not the MITK-superbuild directory). After generating the project files, build the MITK project by either issuing "make" in the MITK-build directory (Linux, Mac OS X), or by opening MITK-build/MITK.sln (Windows).
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
On Windows, the
PATH environment variable must contain the directories containing the third-party libraries. The MITK build system generated Windows batch files in the
MITK-build directory set up a correct environment and opens the appropriate Visual Studio solution file. Use 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).
Please see How to create a new MITK Plugin
To use MITK in your external project, add the CMake command
find_package(MITK REQUIRED) to your CMakeLists.txt and make use of the CMake macros
mitk_create_executable() provided by MITK.
Here is an example CMakeLists.txt (from the Examples/QtAppExample/ directory) which allows you to create a Qt-based application using MITK to display an image.
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 by itself. Note that you must take care of configuring 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_ROOTSet this variable to your custom Boost installation
EXTERNAL_CTK_DIRSet this variable to your CTK binary tree (the directory containing the CTKConfig.cmake file)
EXTERNAL_CableSwig_DIRSet this variable to your CableSwig binary tree for Python wrapping (the directory containing the CableSwigConfig.cmake file)
EXTERNAL_DCMTK_DIRSet this variable to your DCMTK binary tree (the directory containing the DCMTKConfig.cmake file)
EXTERNAL_GDCM_DIRSet this variable to your GDCM binary tree (the directory containing the GDCMConfig.cmake file)
EXTERNAL_ITK_DIRSet this variable to your ITK binary tree (the directory containing the ITKConfig.cmake file)
EXTERNAL_OpenCV_DIRSet this variable to your OpenCV binary tree (the directory containing the OpenCVConfig.cmake file)
EXTERNAL_VTK_DIRSet 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.
See the following link for more information about how to configure third-party libraries: How to build ITK, VTK and Qt