You need:
Since MITK is under active development we recommend to use subversion 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 mitk.org
To checkout MITK's current subversion repository do:
svn co http://svn2.mitk.org/trunk/mitk ./mitk
If you prefer a graphical client, use svn://mbi.dkfz-heidelberg.de/mitkExt/trunk/mitk
as the repository URL for the trunk.
Create a new directory for the binary tree, change to it and call CMake:
In the shell: mkdir mitkBinary
(assuming you are still in the directory you did the checkout in)
cd mitkBinary
ccmake ../mitk
make
If you use Windows, then you just start the CMake GUI and enter the location of the source and of the binary tree. CMake will create a Visual Studio solution in the root of your binary tree.
Essential variables to configure are ITK_DIR and VTK_DIR. If not configured by CMake you have to set DESIRED_QT_VERSION to your QT version.
<binary_dir>/mitk/bin
and the libraries in <binary_dir>/mitk/lib
.We recommend using a batchfile to set the desired environment variables and parameters.
Using Windows 32 bit and Microsoft Visual Studio 2008 it could look like this:
@echo off REM ------------- Configuration options -------------- REM Set MITK Binary dir @SET MITK_DIR=C:\svn\mitkBinary REM Choose toolkit versions @SET VTK_DIR=V:\windows\x32\VTK-5.4.0_Qt451_VC9.0_Bin @SET ITK_DIR=V:\windows\x32\ITK-3.14.0_VC9.0_Bin @SET QT_DIR=V:\windows\x32\QT-4.5.1_VC9.0_Bin REM @SET BOOST_DIR=V:\windows\x32\boost REM Only needed by MBI members @SET OSGI_RUNTIME=%MITK_DIR%\bin\BlueBerry\org.blueberry.osgi @SET CMAKE_DIR="C:\Program Files (x86)\CMake 2.6\bin" REM ----------- Setup configuration --------------- REM Disable VS2005 Secure C Runtime Library Warnings, Disable Microsoft c++ extensions, enable minimal rebuild @set CL=/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE REM @set LINK=/LARGEADDRESSAWARE @call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat" IF NOT DEFINED BUILDTYPE (SET BUILDTYPE=Debug) REM Setup path for toolkit directories @set PATH=%ITK_DIR%\bin\%BUILDTYPE%;%OSGI_RUNTIME%\bin\%BUILDTYPE%;%VTK_DIR%\bin\%BUILDTYPE%;%QT_DIR%\bin;%CMAKE_DIR%;%PATH% REM Print startup commands @echo. @echo. @echo Using Visual Studio 9 settings @echo libraries directories: @echo %VTK_DIR% @echo %ITK_DIR% @echo %QT_DIR% @echo. REM | Change to working directory cd %MITK_DIR% REM | Cosmetics TITLE=QT4-Extern 32 Bit-%BUILDTYPE% REM | Aliases, invoke by %alias% set start=MITK.sln REM | Change to shell call cmd
Usually you need to change the file paths to fit your setup.
For other system configurations, please adjust:
call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" amd64
@set CL=/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /bigobj /MP
To configure MITK do:
C:\svn\mitkBinary>cmake-gui
C:\svn\mitkBinary>%start%
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 binary tree or in the MITK_DOXYGEN_OUTPUT_DIR if specified. See below.
How to create a new MITK Plug-in
In the 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})