Uploaded by 康伟


MITK Documentation
Release nightly
Dec 13, 2017
Indices and tables
MITK Documentation, Release nightly
namespace mitk
namespace std
STL namespace.
file AboutTestingPage.dox
file Annotation.dox
file Applications.dox
file Architecture.dox
file BasicDataTypes.dox
file BlueBerryExamples.dox
file BlueBerryExtensionPointReference.dox
file BlueBerryExtensionPointsIntro.dox
file BlueBerryIntro.dox
file BlueBerrySelectionServiceIntro.dox
file BuildInstructions.dox
file CMakeFAQ.dox
file Coding.dox
file Concepts.dox
file DataInteraction.dox
file DataInteractionTechnical.dox
file DataManagement.dox
file Deployment.dox
file DeveloperManualPortal.dox
file DevelopmentApplication.dox
file DICOMTesting.dox
file DirectoryStructure.dox
file DocumentationExample.dox
file DocumentationGuide.dox
file Exceptions.dox
file ExtensionPointReference.dox
file FirstSteps.dox
file GeometryMigration.dox
file GeometryOverview.dox
file GettingToKnowMITK.dox
file Groups.dox
file HowToNewProject.dox
file Interaction.dox
MITK Documentation, Release nightly
file InteractionHowTo.dox
file InteractionMigration.dox
file InteractionTestingHowTo.dox
file KnownProblems.dox
file Logging.dox
file MiniAppCommandLineToolHowTo.dox
file MiniApps.dox
file MitkImage.dox
file MITKModuleManualsList.dox
file MITKPerspectiveManualsList.dox
file MITKPluginManualsList.dox
file Modularization.dox
file ModuleMicroServices.dox
file NewDataType.dox
file NewEvents.dox
file NewModule.dox
file NewPlugin.dox
file NewView.dox
file OverlayMigration.dox
file Overview.dox
file Pages.dox
file Persistence.dox
file Pipelining.dox
file Properties.dox
file QVTKRendering.dox
file ReaderWriterPage.md
file README.md
file RenderingTests.dox
file SettingUpMITK.dox
file Starting.dox
file Step00.dox
file Step01.dox
file Step02.dox
file Step03.dox
file Step04.dox
file Step05.dox
MITK Documentation, Release nightly
file Step06.dox
file Step07.dox
file Step08.dox
file Step09.dox
file Step10.dox
file StyleGuideAndNotes.dox
file SupportedPlatforms.md
file TestsGeneral.dox
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TES
use the deprecated old MITK testing style If possible
file ThirdPartyLibs.dox
file Troubleshooting.dox
file Tutorial.dox
file UserManualPortal.dox
group ToolManagerEtAl
A couple of classes related to the Segmentation plugin. See also QmitkSegmentationTechnicalPage.
group MITKModules
This group includes all MITK Modules.
group BlueBerryPlugins
This group includes all BlueBerry Plugins.
group MITKPlugins
This group includes all MITK Plugins.
group MITKExamplePlugins
This group includes all MITK example plugins demonstrating specific framework features.
group MITKTestingAPI
In this group, the API documentation of methods useful for testing is collected. The more general concepts of
testing in MITK are described on the General: Tests in MITK page.
group MITKDeprecatedAPI
group MicroServices
group MicroServicesUtils
page Overview
The Medical Imaging Interaction Toolkit (MITK) is a versatile and flexible open-source project. It can be used
as a C++ toolkit or application framework for software development. The following sections describe the most
common usage scenarios.
MITK Documentation, Release nightly
I want to use MITK as an application
You will use the MITK Workbench as an end user and will find user manuals in User Manual and MITK Plugin
I want to develop my own software framework, and use some of MITK’s data structures and algorithms
You will use MITK as a toolkit and probably benefit most from the Build Instructions and MITK API Documentation.
I want to use the MITK and BlueBerry software framework to develop my own software
Here you have again two options.
I want use the MITK Workbench and extend its capabilities
You are using MITK as software framework and writing your own modules and plugins for MITK. You want to
read the Build Instructions and further on Development. Also you might want to take a look at our CMake FAQ.
I want to create my own application based on MITK
This is probably the most common way to use MITK. You are using MITK as software framework and building
your own project and application using MITK. You want to read Creating a new MITK project and the general
information in Development. Also you might want to take a look at our CMake FAQ.
page ApplicationsPage
page MiniAppExplainPage
page PerspectiveListPage
page PluginListPage
page UserManualPortal
To get an introduction to the usage of any MITK based application please read MITKUserManualPage. It will
give you an overview of most of the common questions, such as how to load or save data or navigate within it.
This is a good starting point for first questions.
Depending on what kind of work you intend do perform with MITK, certain applications are better suited to your
needs than others. MITK offers a number of these Applications, each of which features a set of Plugins, which
can solve certain tasks. To Learn more about MITK applications, please visit the Using MITK and Applications.
For more specific information on how a plugin operates you can find the plugin documentation in MITK Plugin
Manuals. The Plugin documentation usually explains the functionality in depth and should solve most problems
you might encounter with the plugin. Depending on the application you are using you might have only some or
all of the listed plugins available.
Lastly, if your question is not answered here, please use our Mailinglist to let us know about your problem.
Alternatively, you can contact us directly.
List of topics
• MITKUserManualPage
• Using MITK and Applications
• MITK Plugin Manuals
• MITK Perspective Manuals
• MITK MiniApps
page BlueBerryExamples
The following examples give an introduction to Blueberry.
The source code of the examples can be found in mitk/Examples/Plugins/
MITK Documentation, Release nightly
Run the examples by executing startBlueBerryExampleLauncher_release.bat (or startBlueBerryExampleLauncher_debug.bat depending on the configured build type).
All examples can be found among the shown list.
• BlueBerryExampleMinimalApplication
• BlueBerryExampleMultiplePerspectives
• Selection Service
• Extension Points
• BlueBerryExampleCustomViewer
page BlueBerryExampleExtensionPoint
A minimal applictaion that definines an extension point and collects extensions.
1. Introduction
2. Extension Point Definition
3. Extension Contribution
page IntroductionExtensionPoints
The BlueBerry application framework provides the concept of extension points and extensions. The main goal
is to allow the extension of functionality of a plugin (based on the contract defined by the extension point) by
several other plugins. Both the extension point and the extension are defined in the according plugin.xml.
page BlueBerryIntro
BlueBerry is an application framework used in MITK for creating modular and extensible end-user applications.
More high-level documentation can be found below:
• The Workbench: What are Views, Editors, Perspectives?
• BlueBerry Examples
Please see the BlueBerry Examples for code examples demonstrating different features of the application framework.
The BlueBerry developer reference is available here:
• BlueBerry Plugins
• BlueBerry Extension-Point Reference
MITK Documentation, Release nightly
page BlueBerryWorkbench
BlueBerry makes use of the Eclipse UI guidlines which state some concepts on how to build up a GUI. The
different objects of the platform UI shall be described here:
page BlueBerrySelectionServiceIntro
2. BlueBerryExampleSelectionServiceQt
3. BlueBerryExampleSelectionServiceMitk
page IntroductionSelectionService
The selection service provided by the BlueBerry workbench allows efficient linking of different parts within
the workbench window: View parts that provide additional information for particular objects and update their
content automatically whenever such objects are selected somewhere in the workbench window. For example the
“Properties” view in MITK applications behaves in this way: Wherever an element is selected in the workbench
this view lists the properties of that element.
Other aspects of the workbench like the enablement of global actions may also depend on the current selection.
Each workbench window has its own selection service instance. The service keeps track of the selection in the
currently active part and propagates selection changes to all registered listeners. Such selection events occur
when the selection in the current part is changed or when a different part is activated. Both can be triggered by
user interaction or programmatically.
page BlueBerryExtPointsIndex
The following extension points can be used to extend the capabilities of the platform infrastructure:
Platform Core Expressions
• org.blueberry.core.expressions.definitions
• org.blueberry.core.expressions.commonExpression
• org.blueberry.core.expressions.propertyTesters
Platform Runtime
• org.blueberry.osgi.applications
• org.blueberry.core.runtime.products
• org.blueberry.ui.editors
MITK Documentation, Release nightly
• org.blueberry.ui.elementFactories
• org.blueberry.ui.keywords
• org.blueberry.ui.menus
• org.blueberry.ui.perspectiveExtensions
• org.blueberry.ui.perspectives
• org.blueberry.ui.preferencePages
• org.blueberry.ui.presentationFactories
• org.blueberry.ui.services
• org.blueberry.ui.tweaklets
• org.blueberry.ui.views
• org.blueberry.tests
page xp_org_blueberry_core_expressions_definitions
page xp_org_blueberry_core_expressions_commonExpression
page xp_org_blueberry_core_expressions_propertyTesters
page xp_org_blueberry_osgi_applications
page xp_org_blueberry_core_runtime_products
page xp_org_blueberry_ui_elementFactories
page xp_org_blueberry_ui_menus
page xp_org_blueberry_ui_perspectiveExtensions
page xp_org_blueberry_ui_editors
page xp_org_blueberry_ui_perspectives
page xp_org_blueberry_ui_presentationFactories
page xp_org_blueberry_ui_services
page xp_org_blueberry_ui_keywords
page xp_org_blueberry_ui_preferencePages
page xp_org_blueberry_ui_tweaklets
page xp_org_blueberry_ui_views
page xp_org_blueberry_tests
page DeploymentPage
page DevelopmentApplication
MITK offers a powerful application featuring a plugin system and many predefined plugins. You can configure
this application to offer a set of functionality to the user and easily create an installer.
Working with the application, you will have to learn about extension points and the Blueberry framework itself.
If you are new to the matter, please also consult The Architecture of MITK and First steps in Development.
• BlueBerry Application Framework
MITK Documentation, Release nightly
• BlueBerry Examples
The BlueBerry framework extension-point reference is available here:
• BlueBerry Extension-Point Reference
The MITK application extension-point reference is available here:
• MITK Extension-Point Reference
page mitkExtPointsIndex
The following extension points can be used to extend the capabilities of MITK Plugins:
Input Devices
• org.mitk.core.ext.inputdevices
page xp_org_mitk_core_ext_inputdevices
page AnnotationPage
page BasicDataTypesPage
This page describes how to use very foundational data-tyes in MITK like mitk::Vector, mitk::Point and
mitk::Matrix and how they can interact.
page Concepts
The following items describe some issues about MITK on a more abstract level.
1. OverviewPage
2. Coding Concepts
(a) General Information
(b) Coding Style
(c) Macros in MITK
(d) MicroServices_Overview
3. Data Concepts
(a) Numeric MITK data types and their usage.
(b) Data Management Concept
(c) Reader and Writer
(d) MITK Image
(e) Properties
(f) Geometry Overview
(g) Pipelining Concept
(h) Annotation Concept
(i) Persistence Concept
4. Rendering Concept
5. Interaction
(a) Interaction Concepts
MITK Documentation, Release nightly
(b) Interaction and Undo/Redo Concepts
6. Logging Concept
7. Error Handling and Exception Concept
8. Modularization Concept
(a) Overview
(b) How to create your own application
If you want to start using MITK, you also want to see the chapter Development.
page DataInteractionPage
page DataInteractionTechnicalPage
This page describes some technicalities of the implementation and the workflow, for a detailed list of tutorials
see Topics related to interaction - further information: .
page DataManagementPage
As MITK is used to process large and diverse data the management thereof becomes an important issue. In
order to abstract the management of data from the actual format of the data it is encapsulated.
page DICOMTesting
page ExceptionPage
page GeometryOverviewPage
page InteractionPage
The following page refers to the deprecated interaction frame work. Please refer to Interaction Concepts
for information about the current one.
page LoggingPage
page MitkImagePage
page ModularizationPage
MITK has been designed to be modular and flexible, to facilitate reuse of existing code and functionality if
possible. As such there are several levels of modularization which can be chosen when working with MITK,
depending on the use case.
page ImplementNewEventsPage
page PersistenceConceptPage
In general, persistence referes to the capability of an application to permanently store data, settings, states, etc.
so that they outlive a restart. Normal data objects, such as images, surfaces, etc., which are visible in the data
storage of MITK can be saved easily by the save/load functions, see Data Management Concept for more details.
This page focus on the persistence of settings, configurations, object states and parameters of the application.
Depending on the component, e.g. plugin, module, etc., where you want to store your settings, MITK offers
various ways to do so:
1. For code inside UI independent modules with low dependencies to other libraries the
mitk::PersistenceService inside the MITK persistence module can be used to store parameters by
using the mitk::PropertyList class: MITK Persistence Service
2. UI dependent code where the Qt library is available can use QSettings: Qt Settings
3. If the UI setting of Plugins should be stored permanently, the persistence features of blueberry can be used:
Persistence Features of Blueberry
4. Extended features, which include persistence, are provided by the configuration service. Configuration
MITK Documentation, Release nightly
page PipelineingConceptPage
page PropertiesPage
page QVTKRendering
The MITK rendering pipeline is derived from the VTK rendering pipeline.
page ReaderWriterPage
This page is work in progress and will introduce you to the IO-System of MITK.
Introductory slides
Several Talks have been given on the IO-System. The following list should provide you with a good starting
• Introduction to MimeTypes: http://www.mitk.org/images/e/e8/MimeTypes.pdf (by Caspar J. Goch)
• Introduction to the IO-System: http://www.mitk.org/images/0/0b/Newio.pdf (by Keno März)
• IO-Streams and the new IO System: http://www.mitk.org/images/9/95/Streams.pdf (by Keno März)
Quick start: Reading and writing files using IOUtil
mitk::IOUtil class provides convenience methods for loading data into a data storage or just returning BaseData
objects without user interaction. The mitk::IOUtil::Save() and mitk::IOUtil::Load() methods cover the typical
use cases and automatically select the best matching mitk::IFileReader and mitk::IFileWriter instance. In most
cases, this is the easiest way to read or write a file.
// load files directly into datastorage
// load basedata into local vector
std::vector< mitk::Basedata::Pointer > basedatas;
basedatas = mitk::IOUtil::Load("/path/to/my/file.nrrd");
// write basedata to file (here: surface as PLY
mitk::IOUtil::Save(mySurface, "/Save/surface/here.ply");
// write basedata to file (here: surface as STL
mitk::IOUtil::Save(mySurface, "/Save/surface/here.stl");
When reading a file using IOUtil, the IO-Framework first determines the mime-type of the given file. Afterwards, the best reader is selected internally, instantiated, and executed. The resulting BaseData Objects are
returned to the developer as the method result.
Quick start: Creating your own reader or writer
If you implement a new BaseData, usually matching readers and writers are required. The following guide will
help you to quickly set up these up and get them working in MITK.
Create new classes for reader and writers. Optimally, place them in an extra IO-Module that is configured
as autoload. This way, they are available to the application from the start. If you are working with common data, the appropriate module is MitkIOExt. You can either extend mitk::AbstractFileIO, which will allow you to implement a class with reader and writer abilities, or you can extend mitk::AbstractFileReader or
mitk::AbstractFileWriter specifically.
MITK Documentation, Release nightly
Implement the given Methods. A good example on how to write a simple reader and writer is the mitkPointSetReaderService.cpp and mitkPointSetWriterService.cpp class, from which you can take implementation cues.
The following is a simplified version of the header file:
namespace mitk
class PointSetReaderService: public AbstractFileReader // 2) Extend the Abstract
File Reader
PointSetReaderService(); // 3) Provide Constructor and Destructor
virtual ~PointSetReaderService();
// 4) Overwrite the Read Method as seen here
using AbstractFileReader::Read;
virtual std::vector< itk::SmartPointer<BaseData> > Read();
// 5) Provide a clone method
PointSetReaderService(const PointSetReaderService& other);
virtual PointSetReaderService* Clone() const;
Follow these steps to implement a new Reader:
A) Create a new cpp and h file in an appropriate submodule. Usually, a reader or writer should be located in the
same module as the BaseData derivate it reads/writes.
B) Extend AbstractFileReader . This is highly recommended because it enables integration of your Reader into
the Registery. It will then automatically be used by the application to load this type of files.
C) Provide a constructor . It should contain a minimal amount of information and might look like this:
: AbstractFileReader(CustomMimeType(IOMimeTypes::POINTSET_MIMETYPE_NAME()),
˓→"MITK Point Set Reader")
Note the call to the superclass constructor containing the MIME-type. You can either reuse an existent MIME
type here or create your own MIME-type locally . Finally, register the service to make it available to MITK.
D) Provide a Clone Method: Readers are clones when the registry requires a new reader. Provide a clone method
to accommodate for this. Use the mitkPointSetReaderService.cpp as a reference if necessary.
MITK Documentation, Release nightly
E) Instantiate it in the module activator. Open the module activator and make sure that the new Reader/Writer
is instantiated and held somewhere in the code. Also, unregister the reader/writer in the unload function if
Reader/Writer Options
Options are a powerful concept to modify Reader/Writer behaviour and to automate user interaction with minimal development overhead. In principal, options are represented by a simple map and a few getter and setter
typedef std::map<std::string, us::Any> Options;
Options GetOptions();
void SetOptions(const Options& options);
us::Any GetOption(const std::string& name);
void SetOptions(const Options& options);
In its constructor, a reader or writer can set its options as a number map entries consisting of an human-readable
option name and a default value. When a user tries to read/write a file via the interface, an options menu is
generate from the map.
The user can then modify these options, which are automatically set in the reader/writer. You can use raw-images
to see this behaviour in action.
Mime Types
The MimeType class provides meta-data about a specific data format. Every mitk::IFileReader and
mitk::IFileWriter instance must be associated with exactly one mime-type via a service property.
Mime-type are used for categorizing data formats and creating filter strings in file open and save dialogs. Hence
they effectively control the accessible set of data formats from a graphical user interface. Minimally, mimetypes should provide a name and a list of handled extensions in lower case. Additionally, it is highly encouraged
to set a category and a comment which will provide user-readable strings for user interaction.
It is important to understand the difference between mitk::MimeType and mitk::CustomMimeType. The former is an immutable stack object and can be pulled from mitk::MimeTypeProvider. it should be used for
all interaction with MimeTypes. mitk::CustomMimeType is the heap-object pendant which is wrapped by
mitk::MimeType and should exclusively be used for registration purposes, i.e. when you register a new MimeType.
Additional Capabilities
You can extend your reader writer with useful capabilities. All of these are optional
• Priority: Reader use a ranking with Get- and SetRanking in order to signify how well they are suited to
read a file. If several readers are able to read a file, the one with the highest Ranking level will be chosen.
MITK Documentation, Release nightly
• ProgressCallbacks : Readers are executed in a thread automatically. If the reader implements callbacks, the
progress bar will be more accurate during loading of files. Note: Progress callbacks are work in progress.
Ranking strategies
Convenience classes
Developers usually do not interact with the service registry directly to retrieve and select a matching
mitk::IFileReader or mitk::IFileWriter instance.
The QmitkIOUtil class is a wrapper around mitk::IOUtil, providing file open and save dialogues for selecting a
file name from a within a graphical user interface.
FileReaderRegistry and FileWriterRegistry
Access to mitk::IFileReader and mitk::IFileWriter objects and their service references.
Integrating external I/O mechanisms
The MITK I/O system integrates with several external I/O systems.
ITK Reader and Writer
The I/O classes from ITK are automatically added to the service registry of MITK. They can be transparently
used via the mitk::IFileReader and mitk::IFileWriter interfaces or the mitk::IOUtil methods.
VTK Reader and Writer
VTK does not provide a mechanism to enumerate all available I/O classes. Hence MITK provides manual
integration of a specific set of VTK readers and writers.
Error handling and recovery
page RenderingTests
Available sections:
1. What is an automatic rendering test?
2. How to create a rendering test
page GeneralTests
page DeveloperManualPortal
Development with MITK can happen under several conditions. Depending on whether you are using the Toolkit
or the entire application, different sections may apply to you. In case you are unsure about what you need,
please refer to The Architecture of MITK text. An extensive Introduction to MITK is available under Starting
your MITK Development.
Once you have made yourself familiar with MITK, you should have a look at the Development Concepts, as
MITK implements a lot of high-level functionality. Knowing about these concepts will prevent you from reimplementing functionality.
Once you start consuming more specific functionality, the Module Manual will be helpful to understand how a
specific plugin works and what functionality it provides.
Finally, generated API-Documentation can be found here.
• Starting your MITK Development
– The Architecture of MITK
MITK Documentation, Release nightly
– Setting Up Mitk
– Getting to know MITK
– First steps in Development
– Testing
• MITK Concepts
• MITK Module Manuals
• Developing with the MITK Application Framework
– MITK Extension-Point Reference
• Deploying MITK
page InteractionHowTo
page InteractionTestingHowTo
page AboutTestingPage
Testing is a very important part of ensuring code quality. We use CDash for testing whether MITK builds on a
variety of platforms and configurations. You can find our dashboard here.
Additionally we support tests of software function as well. More detailed information on testing in MITK can
be found below.
• General: Tests in MITK
• Automatic Rendering Tests
• MITK DICOM testing
• Interaction Testing in MITK
page Architecture
MITK is an open source software toolkit for medical image processing, subsequent data analysis and integration
of medical hardware. It is designed with the aim of providing a modular and reusable code base to enable rapid
development of new features. Following this design philosophy, MITK includes many specialized modules.
This document is aimed at giving an overview of the general structure of MITK. It will give you an introduction
to the coding and design concepts behind the toolkit.
page FirstSteps
This section will show you how to extend MITK for your own project.
• How to create a new MITK Plugin
• How to create a new MITK Module
• How to create a new custom data type
• Adding a new view to a MITK Plugin
• CMake FAQ
• StatemachineEditor
• How to create a MiniApp command line tool
page MiniAppCommandLineToolHowToPage
This page will give you an overview of creating your own command line tool that can be integrated into a
MiniApp. If you don’t know about MiniApps, you can read about their purpose and use at MITK MiniApps
MITK Documentation, Release nightly
page NewDataTypePage
page NewModulePage
page NewPluginPage
The MITK Plugin Generator is a command line tool to simplify the process of creating your own MITK project
(optional) and plugins. It can either be downloaded here or used from an existing MITK build.
The Plugin Generator takes the following command line arguments:
./MitkPluginGenerator -h
A CTK plugin generator for MITK (version 1.2.0)
-h, --help
Show this help text
-o, --out-dir
Output directory (default: /tmp)
-l, --license
Path to a file containing license information
˓→(default: :/MITKLicense.txt)
-v, --vendor
The vendor of the generated code (default: DKFZ,
˓→ Medical and Biological Informatics)
-q, --quiet
Do not print additional information
-y, --confirm-all
Answer all questions with 'yes'
-u, --check-update
Check for updates and exit
-n, --no-networking
Disable all network requests
Plugin View options
-vc, --view-class
-vn, --view-name
The View's' class name
View's human readable name
Plugin options
-ps, --plugin-symbolic-name
-pn, --plugin-name
* The plugin's symbolic name
The plugin's human readable name
Project options
˓→(default: :/LICENSE.txt)
Path to a file containing copyright information
The project name
The application name
[* - options are required]
If a project name is provided via the project-name argument, the new plugin will be generated as part of a
new project.
page NewViewPage
A plugin can bundle several views. If you want to extend an existing plugin, for example created as in How to
create a new MITK Plugin, by an additional view, you only need to adapt a few files. This guide will give you a
quick overview of what to do. We assume you are adding the view “Useful Functions View” and use default file
names and locations (relative to your plugin folder root).
page CodingPage
page DirectoryStructurePage
To avoid clutter and ease the administration of the source code the MITK source code is structured into several
subdirectories according to their function. This document aims at helping you finding what you want within this
page DocumentationExample
This page will try to give an example of some of the most commonly used commands and techniques for
documenting your code using doxygen. The corresponding source file can be found below.
MITK Documentation, Release nightly
For the generated documentation page see DocumentationExample .
page DocumentationGuide
page GettingToKnowMITK
This section will show you around MITK and acquaint you with the basic concepts.
• Directory Structure
• The MITK Tutorial
• CMake FAQ
• The MITK Style Guide and Technical Notes
• Writing Documentation
• Coding
• Known Problems
• Troubleshooting
page KnownProblemsPage
“Installing” MITK via cmake (or using “make install”) is not yet supported.
• Sometimes remote X sessions will display black rendering windows. It is not known whether this is a
problem within MITK or within the X implementation.
• MITK CHILI plugin has limitations when working with DICOMDIR data sources (bug #1756)
page StyleGuideAndNotesPage
The following document is a description of the accepted coding style for the Medical Imaging Interaction Toolkit
(MITK). Developers who wish to contribute code to MITK should read and adhere to the standards described
page TroubleshootingPage
NOTE: In case of errors such as:
!1.132! WARNING: QmitkSliceWidget data is not an image!
!1.150! WARNING: QmitkSliceWidget data is not an image!
make sure your working directory is set correctly. This is especially an issue when directly running the
application from the IDE. It should be set to:
page Step00Page
To build the tutorials follow the Build Instructions and make sure that MITK_BUILD_EXAMPLES is
checked/set to ON.
The tutorial source files can be found in the Examples\Tutorial\ subdirectory of the source tree. The tutorial
executables are in the bin\Release\ or bin\Debug\ subdirectory (Windows) respectively the bin\ subdirectory
(Linux/Mac) of the binary tree after compilation (called MitkStepX, corresponding to the tutorial step).
[Next step] [Main tutorial page]
MITK Documentation, Release nightly
page Step01Page
Path to files used in this step: http://mitk.org/download/tutorial-data/Pic3D.nrrd
Open your IDE. All steps can be found among the listed projects. The first program shows how to display an
image in a 2D view. The picture above is a screenshot of the program. The program has to be executed using
the image file Pic3D.nrrd.
If you are using Visual Studio use the StartVS_release.bat in your bin\ subdirectory to start it with all required
paths set. To set the image file path in Visual Studio, right click on “MitkStep1”-project and go to ‘Properties
-> Configuration Properties -> Debugging’. Now insert the image file path to Pic3D.nrrd in the “Command
Arguments” text field. Then right click on the “MitkStep1”-project again and select “Set as StartUp Project”.
Start to run the code. Use this also in the following steps.
The code is divided into parts I through V. First of all a DataTree has to be created. Then data has to be read
from a file which afterwards has to be put into the tree. Part IV creates a window and passes the tree to it. The
last part deals with some Qt-specific initialization.
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
See LICENSE.txt or http://www.mitk.org for details.
#include "QmitkRegisterClasses.h"
#include "QmitkRenderWindow.h"
#include <mitkStandaloneDataStorage.h>
#include <QApplication>
#include <itksys/SystemTools.hxx>
#include <mitkIOUtil.h>
MITK Documentation, Release nightly
//## @brief Load image (nrrd format) and display it in a 2D view
int main(int argc, char *argv[])
QApplication qtapplication(argc, argv);
if (argc < 2)
fprintf(stderr, "Usage:
%s [filename] \n\n",
return 1;
// Register Qmitk-dependent global instances
// Part I: Basic initialization
// Create a DataStorage
// The DataStorage manages all data objects. It is used by the
// rendering mechanism to render all data objects
// We use the standard implementation mitk::StandaloneDataStorage.
mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New();
// Part II: Create some data by reading a file
// Load datanode (eg. many image formats, surface formats, etc.)
mitk::IOUtil::Load(argv[1], *ds);
// Part IV: Create window and pass the datastorage to it
// Create a RenderWindow
QmitkRenderWindow renderWindow;
// Tell the RenderWindow which (part of) the datastorage to render
// Initialize the RenderWindow
mitk::TimeGeometry::Pointer geo = ds->ComputeBoundingGeometry3D(ds->GetAll());
// mitk::RenderingManager::GetInstance()->InitializeViews();
// Select a slice
mitk::SliceNavigationController::Pointer sliceNaviController = renderWindow.
if (sliceNaviController)
// Part V: Qt-specific initialization
renderWindow.resize(256, 256);
MITK Documentation, Release nightly
// for testing
#include "QtTesting.h"
if (strcmp(argv[argc - 1], "-testing") != 0)
return qtapplication.exec();
return QtTesting();
// cleanup: Remove References to DataStorage. This will delete the object
ds = nullptr;
[Previous step] [Next step] [Main tutorial page]
page Step02Page
Step2.cpp Contains the code for this example.
• Path to files used in this step: http://mitk.org/download/tutorial-data/Pic3D.nrrd (image) http://mitk.org/
download/tutorial-data/lungs.vtk (surface)
This program shows how to load multiple data sets. The picture above shows the result of the program when
reading both the image file and the surface file. In order to obtain the result the program has to be executed using
the image file Pic3D.nrrd and the surface file lungs.vtk.
The code for this example equals the code of Step 1 except for part II and part III which are changed as follows:
// Part II: Create some data by reading files
[Previous step] [Next step] [Main tutorial page]
page Step03Page
Step3.cpp Contains the code that both creates a 3D view and turns volume rendering on.
• Path to files used in this step: http://mitk.org/download/tutorial-data/Pic3D.nrrd (image) http://mitk.org/
download/tutorial-data/lungs.vtk (surface)
As in the previous step, one or more data sets (many images, surface and other formats) may be loaded. The
difference is that they are displayed in a 3D view. The QmitkRenderWindow is now used for displaying a 3D
view, by setting the used mapper-slot to Standard3D. Since volume-rendering is a (rather) slow procedure, the
default is that images are not displayed in the 3D view.
• Step 3a works for default condition for surface mesh. To run this tutorial with Step 3a, pass the argument
as “lungs.vtk” (without quotes).
• Step 3b works for surface mesh with volume rendering. To run this tutorial with Step 3b, pass the arguments as “Pic3D.nrrd lungs.vtk” (without quotes).
page Step04Page
Step4.cpp Contains the code of step 4a + b.
• Path to files used in this step: http://mitk.org/download/tutorial-data/Pic3D.nrrd (image) http://mitk.org/
download/tutorial-data/lungs.vtk (surface)
MITK Documentation, Release nightly
As in Step 2 and Step 3 one or more data sets may be loaded.
This now creates three views on the data. The QmitkRenderWindow is used for displaying a 3D view as in
Step 3, but without volume-rendering. Furthermore two 2D views for slicing through the data are created. The
class QmitkSliceWidget is used, which is based on the class QmitkRenderWindow, but additionally provides
sliders to slice through the data. We create two instances of QmitkSliceWidget, one for axial and one for sagittal
slicing. Step 4b enhances the program in that the two slices are also shown at their correct position in 3D as
well as intersection-line, each in the other 2D view.
As in the previous steps, to obtain the result the program has to be executed using the image file Pic3D.nrrd and
the surface file lungs.vtk.
page Step05Page
Step5.cpp Contains the code for this step.
• Path to files used in this step: http://mitk.org/download/tutorial-data/Pic3D.nrrd (image) http://mitk.org/
download/tutorial-data/lungs.vtk (surface)
In addition to Step 4 where 3 views were created on the data, we now want to interactively add points.
A node containing a PointSet as data is added to the data tree and a PointSetDataInteractor is associated with the
node, which handles the interaction. The interaction pattern is defined in a state-machine, stored in an external
XML file. Thus, we need to load a state-machine.
A state machine describes interaction pattern with different states (states beeing something like “a point is
selected”) and transitions to these states (e.g. “select a point”). These transitions are associated with actions.
In this way it is possible to model complex interaction schemes. By what these transitions and actions are
triggered is described in a configuration file. It maps user events to identifiers that are used in the state machine
patterns. In this way the user interaction can be changed by simply loading a different configuration file for a
state machine, and the user may add points now with a right click instead of left click + SHIFT, as in our case.
Therefore after loading the state machine pattern the PointSetDataInteractor is also given a event configuration
More information about interaction in MITK can be found here.
In order to add a point the shift key has to be pressed while left clicking in a render window. You can also move
points or remove them (left click while pressing ALT).
A PointSet and a node for it have to be created to be able to interactively adding points:
mitk::PointSet::Pointer pointSet = mitk::PointSet::New();
mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New();
// Store the point set in the DataNode
// Add the node to the tree
// Create PointSetDataInteractor
mitk::PointSetDataInteractor::Pointer interactor =
// Set the StateMachine pattern that describes the flow of the interactions
MITK Documentation, Release nightly
// Set the configuration file, which describes the user interactions that
trigger actions
// in this file SHIFT + LeftClick triggers add Point, but by modifying this
// it could as well be changes to any other user interaction.
// Assign the pointSetNode to the interactor,
// alternatively one could also add the DataInteractor to the pointSetNode
˓→using the SetDataInteractor() method.
[Previous step] [Next step] [Main tutorial page]
page Step06Page
The source is now split among several files:
• Step6.cpp
• Step6.h
• Step6RegionGrowing.txx
• Step6RegionGrowing1.cpp
• Step6RegionGrowing2.cpp
• Step6main.cpp
• Path to files used in this step: http://mitk.org/download/tutorial-data/Pic3D.nrrd (image)
In this step the program is enhanced by the possibility to start a region-grower at interactively added points. We
will see how MITK images can be accessed as ITK images. We now load the image file Pic3D.nrrd only since
the surface will be the result of the region-growing.
Add points in the image by pressing SHIFT+left mouse key, then adjust the thresholds and press ‘Start region
The class Step6 inherits from QWidget and provides methods for setting up the widgets.
Step6RegionGrowing.cpp contains a method for performing the region-growing. Step6main.cpp contains
main. Like in ITK and VTK class member names start with m_ followed by the proper member name starting
with a capital letter (e.g. m_Tree). Function names start with capital letters. To learn more about style
conventions in MITK read The MITK Style Guide.
The widgets are initialized as in the previous steps but with an additional QVBox for a button to start the
// Create controlsParent widget with horizontal layout
QWidget *controlsParent = new QWidget(this);
QHBoxLayout *hlayout = new QHBoxLayout(controlsParent);
MITK Documentation, Release nightly
QLabel *labelThresholdMin = new QLabel("Lower Threshold:", controlsParent);
m_LineEditThresholdMin = new QLineEdit("-1000", controlsParent);
QLabel *labelThresholdMax = new QLabel("Upper Threshold:", controlsParent);
m_LineEditThresholdMax = new QLineEdit("-400", controlsParent);
This creates a button to start the segmentation and its clicked() signal is connected to the method StartRegionGrowing():
page Step07Page
• Step7.h
• Step7main.cpp
• Path to files used in this step: http://mitk.org/download/tutorial-data/Pic3D.nrrd (image)
In this step the result of the previous step is converted into a surface by means of a VTK filter.
Step7 inherits from Step6. It enhances the method StartRegionGrowing() by processing the result image.
[Previous step] [Next step] [Main tutorial page]
page Step08Page
• Step8.h
• Step8main.cpp
• Path to files used in this step: http://mitk.org/download/tutorial-data/Pic3D.nrrd (image)
In this step a QmitkStdMultiWidget is used. It offers four views of the data. From top left to bottom left the
views are initialized as axial, sagittal and coronar. The bottom right view is initialized as 3D view.
Step8 inherits from Step6. The method SetupWidgets() is changed: A QmitkStdMultiWidget is used instead of
one QmitkRenderWindow and two instances of QmitkSliceWidget.
// Part Ia: create and initialize QmitkStdMultiWidget
[Previous step] [Next step]
MITK Documentation, Release nightly
page Step09Page
MITK uses a very modular concept to maximize reusability and portability. A MITK application based on the
BlueBerry application framework (for example the MITK Workbench) consists of several bundles (or plug-ins).
A bundle can contain resources and program logic. It can also contribute so-called Views to the main application,
which provide a specific user interface for controlling the bundles functions.
The creation of a MITK plug-in is considerably facilitated by using the MITK PluginGenerator as described in
How to create a new MITK Plugin if you want to add a new view to an existing plugin see Adding a new view
to a MITK Plugin.
The mentioned tool was used to create a plug-in called org.mitk.example.gui.regiongrowing. Let’s first take a
look at which files the PluginGenerator has created:
modules.dox......................... Doxygen file for documenting your plug-in
icon.png............................ The icon of your plug-in. GIMP or other
˓→programs (including your text editor)
can be used to change this
QmitkRegionGrowingView.cpp.......... The most important file, implementing
QmitkRegionGrowingView.h............ Header file of the functionality
QmitkRegionGrowingViewControls.ui... XML file of the Qt Designer, describes
˓→buttons, combo boxes, etc. of your controls
CMakeLists.txt \...................... Build system related files for CMake
manifest_headers.cmake................ Information about your plug-in
plugin.xml ........................... BlueBerry integration
If you are not familiar with Qt development, please look into this Qt company page describing .ui files (no,
forget about the please, DO it!)
The C++ files implement a subclass of QmitkAbstractView. In this special case of QmitkRegionGrowing, we
added the option to set some seed points and run a region grower. If you are interested in the concrete changes
necessary to turn a freshly generated QmitkRegionGrowing into an integrated one:
The plug-in will be build as part of MITK Workbench. Do use it start MITK Workbench an select the region
growing view in the view menu.
To add a mitk::PointSet for the seed points: QmitkRegionGrowingView.h
Add includes and forward declarations:
#include "mitkIRenderWindowPartListener.h"
#include "mitkPointSet.h"
#include <itkImage.h>
class QmitkPointListWidget;
Add the point set and a pointer to a QmitkPointListWidget as a private member:
mitk::PointSet::Pointer m_PointSet;
QmitkPointListWidget *m_PointListWidget;
MITK Documentation, Release nightly
// create a QmitkPointListWidget and add it to the widget created from .ui file
m_PointListWidget = new QmitkPointListWidget();
m_Controls.verticalLayout->addWidget(m_PointListWidget, 1);
// retrieve a possibly existing IRenderWindowPart
if (mitk::IRenderWindowPart *renderWindowPart = GetRenderWindowPart())
// let the point set widget know about the render window part (crosshair
// create a new DataNode containing a PointSet with some interaction
m_PointSet = mitk::PointSet::New();
mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New();
pointSetNode->SetName("seed points for region growing");
pointSetNode->SetProperty("helper object", mitk::BoolProperty::New(true));
pointSetNode->SetProperty("layer", mitk::IntProperty::New(1024));
// add the pointset to the data storage (for rendering and access by other
// tell the GUI widget about the point set
To use the ITK region grower:
Add the private method:
template <typename TPixel, unsigned int VImageDimension>
void ItkImageProcessing(itk::Image<TPixel, VImageDimension> *itkImage,
˓→mitk::BaseGeometry *imageGeometry);
Add includes:
// Qmitk
#include "QmitkPointListWidget.h"
#include "QmitkRenderWindow.h"
// ITK
#include <itkConnectedThresholdImageFilter.h>
MITK Documentation, Release nightly
// So we have an image. Let's see if the user has set some seed points
if (m_PointSet->GetSize() == 0)
// no points there. Not good for region growing
"Region growing functionality",
"Please set some seed points inside the image
"(hold Shift key and click left mouse button
˓→inside the image.)");
// actually perform region growing. Here we have both an image and some
seed points
image, ItkImageProcessing, image->GetGeometry()) // some magic to call
˓→the correctly templated function
And add the new method:
template <typename TPixel, unsigned int VImageDimension>
void QmitkRegionGrowingView::ItkImageProcessing(itk::Image<TPixel,
˓→VImageDimension> *itkImage,
mitk::BaseGeometry *imageGeometry)
typedef itk::Image<TPixel, VImageDimension> InputImageType;
typedef typename InputImageType::IndexType IndexType;
// instantiate an ITK region growing filter, set its parameters
typedef itk::ConnectedThresholdImageFilter<InputImageType, InputImageType>
typename RegionGrowingFilterType::Pointer regionGrower =
regionGrower->SetInput(itkImage); // don't forget this
// determine a thresholding interval
IndexType seedIndex;
TPixel min(std::numeric_limits<TPixel>::max());
TPixel max(std::numeric_limits<TPixel>::min());
mitk::PointSet::PointsContainer *points = m_PointSet->GetPointSet()->
for (mitk::PointSet::PointsConstIterator pointsIterator = points->Begin();
˓→pointsIterator != points->End();
// first test if this point is inside the image at all
if (!imageGeometry->IsInside(pointsIterator.Value()))
// convert world coordinates to image indices
imageGeometry->WorldToIndex(pointsIterator.Value(), seedIndex);
// get the pixel value at this point
TPixel currentPixelValue = itkImage->GetPixel(seedIndex);
MITK Documentation, Release nightly
// adjust minimum and maximum values
if (currentPixelValue > max)
max = currentPixelValue;
if (currentPixelValue < min)
min = currentPixelValue;
MITK_INFO << "Values between " << min << " and " << max;
min -= 30;
max += 30;
// set thresholds and execute filter
mitk::Image::Pointer resultImage;
mitk::CastToMitkImage(regionGrower->GetOutput(), resultImage);
mitk::DataNode::Pointer newNode = mitk::DataNode::New();
// set some properties
newNode->SetProperty("binary", mitk::BoolProperty::New(true));
newNode->SetProperty("name", mitk::StringProperty::New("dumb segmentation"));
newNode->SetProperty("color", mitk::ColorProperty::New(1.0, 0.0, 0.0));
newNode->SetProperty("volumerendering", mitk::BoolProperty::New(true));
newNode->SetProperty("layer", mitk::IntProperty::New(1));
newNode->SetProperty("opacity", mitk::FloatProperty::New(0.5));
// add result to data tree
Have fun using MITK!
If you meet any difficulties during your first steps, don’t hesitate to ask on the MITK mailing list [email protected]! People there are kind and will try to help you.
[Previous step] [Next Step] [Main tutorial page]
page Step10Page
page TutorialPage
If you have set up and compiled MITK already and want to know more about developing with MITK you might
want to read the Tutorial chapters. If you want help setting up MITK and creating your own project using MITK
you should take a look at Creating a new MITK project.
page BuildInstructionsPage
page HowToNewProject
This page is intended to give a comprehensive guide to setting up your own MITK based project. It will use the
application framework provided by MITK and is probably the preferred way for most users.
MITK Documentation, Release nightly
The first part of this document is a tutorial aimed at newcomers to MITK and possibly CMake and tries to give
as much help as possible on setting up your own project. If you are looking for more technical information
about customizing MITK, the structure of the superbuild or packaging you might want to read the Information
for advanced users.
If you have set up your MITK project already and want to start developing you could take a look at The MITK
page SettingUpMITK
This section will get you started with your MITK Development environment.
• Supported Platforms
• Build Instructions
• Third-party libraries
• Creating a new MITK project
• Testing
page SupportedPlatformsPage
MITK is a cross-platform framework that is available for the following platforms:
• Windows
• Linux/X11
• Mac OS X
Supported Platforms Details
The MITK team provides support for the most frequently used platforms and continuously runs testing procedures to ensure compatibility. Due to the large amount of possible combinations of operating systems and
compiler versions, we divide platform support into two test categories: Tier 1 and Tier 2.
Although MITK may be built on a broader range of platform-compiler combinations, only a subset of these are
actively supported by the MITK development team.
Tier 1 Platforms
All Tier 1 platforms are continuously tested by our unit test suite and other internal testing procedures. Errors
or bugs discovered in these platforms are prioritized and corrected as soon as possible.
Tier 2 Platforms
Tier 2 platforms may or may not be tested on a regular basis. Some Tier 2 platforms are used by individual
members of the MITK development team on a daily basis and some only receive occasional testing. While we
strive to support these platforms, MITK users should note that errors may be present in released versions as well
as in the current master branch.
All platforms not listed above are not officially supported by the MITK team. However, we will happily accept
contributions to improve support for other platforms.
page thirdpartylibs
The following third-party libraries can be used with MITK by default and can, in part, be automatically downloaded during superbuild.
MITK Documentation, Release nightly
MITK Documentation, Release nightly
For copyright information on any of the above toolkits see the corresponding home page or the corresponding
source folder.
libSVM http://www.csie.ntu.edu.tw/~cjlin/libsvm/
page StartingDevelopment
This introduction will acquaint you with the most important workflows to get you started with your MITK
development. First, The Architecture of MITK will explain the differences between the application and the
toolkit. Setting Up Mitk will get you started with a working environment for MITK development. Getting to
know MITK will walk you trough the folder structure, the module system, and plugin system. This chapter also
contains an extensive tutorial on how to work with MITK. The First steps in Development section will then
show you how to extend MITK for your own project.
• The Architecture of MITK
• Setting Up Mitk
– Supported Platforms
– Build Instructions
– Third-party libraries
– Creating a new MITK project
• Getting to know MITK
MITK Documentation, Release nightly
– Directory Structure
– The MITK Tutorial
– CMake FAQ
– The MITK Style Guide and Technical Notes
– Writing Documentation
– Coding
– Known Problems
• First steps in Development
– How to create a new MITK Plugin
– Adding a new view to a MITK Plugin
– How to create a new MITK Module
– CMake FAQ
– StatemachineEditor
• Testing
page GeometryMigration
page InteractionMigration
page MITKModuleManualsListPage
page OverlayMigration
page deprecatedSince2012_09
page deprecatedSince2013_03
page deprecatedSince2013_06
page deprecatedSince2013_09
page deprecatedSince2014_03
page deprecatedSince2014_10
page deprecatedSince2015_05
page deprecatedSince2016_03
page deprecatedSince2016_11
page deprecated
page index
The Medical Imaging Interaction Toolkit (MITK) is a free open-source software system for development of
interactive medical image processing software. MITK combines the Insight Toolkit (ITK) and the Visualization
Toolkit (VTK) with an application framework.
The links below provide high-level and reference documentation targeting different usage scenarios:
MITK Documentation, Release nightly
• Get a high-level overview about MITK with pointers to further documentation
• End-users looking for help with MITK applications should read the MITK User Manual
• Developers contributing to or using MITK, please see the MITK Developer Manual as well as the MITK
API Reference
See the MITK homepage for details.
Supported Platforms
MITK is a cross-platform C++ toolkit and officially supports:
• Windows
• macOS
• Linux
For details, please read the Supported Platforms page.
Copyright (c) German Cancer Research Center.
MITK is available as free open-source software under a BSD-style license.
The MITK source code and binaries for the MitkWorkbench application are released regularly according to the
MITK release cycle. See the Download page for a list of releases.
The official MITK source code is available in the MITK Git repository. The Git clone command is
git clone https://phabricator.mitk.org/source/mitk.git MITK
Active development takes place in the MITK master branch and its usage is advised for advanced users only.
How to Contribute
Contributions of all kind are happily accepted. However, to make the contribution process as smooth as possible,
please read the How to contribute to MITK page if you plan to contribute to MITK.
Build Instructions
MITK uses CMake to configure a build tree. The following is a crash course about cloning, configuring, and
building MITK on a Linux/Unix system:
git clone https://phabricator.mitk.org/source/mitk.git MITK
mkdir MITK-build
cd MITK-build
cmake ../MITK
make -j4
Read the comprehensive Build Instructions page for details.
Useful Links
• Homepage
• Download
• Mailing List
• Bug Tracker
MITK Documentation, Release nightly
Indices and tables
• genindex
• modindex
• search
MITK Documentation, Release nightly
Chapter 1. Indices and tables
mitk (C++ type), 1
std (C++ type), 1